SUMMARY="A C library for setting up and running pipelines"
DESCRIPTION="libpipeline is a C library for setting up and running pipelines \
of processes, without needing to involve shell command-line parsing which is \
often error-prone and insecure.  This alleviates programmers of the need to \
laboriously construct pipelines using lower-level primitives such as fork(2) \
and execve(2)."
HOMEPAGE="http://libpipeline.nongnu.org/"
COPYRIGHT="1994 Markus Armbruster.
	1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005,
	2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
	2003-2017 Colin Watson"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="http://download.savannah.nongnu.org/releases/libpipeline/libpipeline-$portVersion.tar.gz"
CHECKSUM_SHA256="5dbf08faf50fad853754293e57fd4e6c69bb8e486f176596d682c67e02a0adb0"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= 1"

PROVIDES="
	libpipeline$secondaryArchSuffix = $portVersion
	lib:libpipeline$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libpipeline${secondaryArchSuffix}_devel = $portVersion
	devel:libpipeline$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	libpipeline$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libpipeline$secondaryArchSuffix \
	$libDir/libpipeline.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	#remove libtool file
	rm $libDir/*.la

	# prepare develop/lib
	prepareInstalledDevelLib libpipeline
	fixPkgconfig

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $manDir
		maybe_manDir=
	else
		maybe_manDir=$manDir
	fi

	# devel package
	packageEntries devel \
		$developDir \
		$maybe_manDir

	rmdir $documentationDir
}
