SUMMARY="Client/server app to drive LCD displays"
DESCRIPTION="LCDproc controls various LCD and VFD devices in a standardized way, and ships with a \
client to display various system statistics. Supports multiple platforms (Linux, *BSD, Solaris). \
Client/server model allows multiple clients to use one display."
HOMEPAGE="http://www.lcdproc.org"
COPYRIGHT="1998-2014 William W. Ferrell, Selene Scriven and many other contributors"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="https://github.com/lcdproc/lcdproc/releases/download/v$portVersion/lcdproc-$portVersion.tar.gz"
CHECKSUM_SHA256="d48a915496c96ff775b377d2222de3150ae5172bfb84a6ec9f9ceab962f97b83"
PATCHES="lcdproc-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

GLOBAL_WRITABLE_FILES="
	settings/LCDd.conf keep-old
	settings/lcdexec.conf keep-old
	settings/lcdproc.conf keep-old
	settings/lcdvc.conf keep-old
	"

PROVIDES="
	lcdproc$secondaryArchSuffix = $portVersion
	cmd:fortune.pl$commandSuffix
	cmd:iosock.pl$commandSuffix
	cmd:LCDd$commandSuffix
	cmd:lcdexec$commandSuffix
	cmd:lcdident.pl$commandSuffix
	cmd:lcdmetar.pl$commandSuffix
	cmd:lcdproc$commandSuffix
	cmd:lcdvc$commandSuffix
	cmd:tail.pl$commandSuffix
	cmd:x11amp.pl$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libusb$secondaryArchSuffix
	lib:libusb_1.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libncurses$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libusb$secondaryArchSuffix
	devel:libusb_1.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export CFLAGS="-DBSD_SOURCE"
	export LDFLAGS="-lbsd"
	autoreconf -vfi
	runConfigure --omit-dirs "bindir sbindir" ./configure \
		--bindir=$commandBinDir \
		--sbindir=$commandBinDir \
		--enable-drivers=picolcd \
		--enable-libusb \
		--enable-libusb-1.0
	make
}

INSTALL()
{
	make install
}
