SUMMARY="X.Org Xpm library"
DESCRIPTION="The X.Org project provides an open source implementation of the \
X Window System. \
The development work is being done in conjunction with the freedesktop.org \
community. \
The X.Org Foundation is the educational non-profit corporation whose \
Board serves this effort, and whose Members lead this work."
HOMEPAGE="https://www.x.org/"
COPYRIGHT="1989-95 GROUPE BULL
	1998 Arnaud LE HORS
	1996 Lorens Younes"
# TODO: check all the licenses in the COPYING file in the next century.
LICENSE="MIT"
REVISION="4"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXpm-$portVersion.tar.gz"
CHECKSUM_SHA256="53ddf924441b7ed2de994d4934358c13d9abf4828b1b16e1255ade5032b31df7"
SOURCE_DIR="libXpm-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	libxpm$secondaryArchSuffix = $portVersion
	lib:libxpm$secondaryArchSuffix = $portVersion
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:cxpm = $portVersion
		"
fi

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libx11$secondaryArchSuffix
	lib:libxcb$secondaryArchSuffix
	lib:libxau$secondaryArchSuffix
	"

PROVIDES_devel="
	libxpm${secondaryArchSuffix}_devel = $portVersion
	devel:libxpm$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	libxpm$secondaryArchSuffix == $portVersion base
	devel:libx11$secondaryArchSuffix
	devel:libxcb$secondaryArchSuffix
	devel:libxau$secondaryArchSuffix
	"

# looks like all x11 deps are needed
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libx11$secondaryArchSuffix
	devel:util_macros$secondaryArchSuffix
	devel:xproto$secondaryArchSuffix
	devel:xtrans$secondaryArchSuffix
	devel:inputproto$secondaryArchSuffix
	devel:kbproto$secondaryArchSuffix
	devel:xcb_proto$secondaryArchSuffix
	devel:libxslt$secondaryArchSuffix
	devel:libpthread_stubs$secondaryArchSuffix
	devel:libxcb$secondaryArchSuffix
	devel:libxau$secondaryArchSuffix
	devel:xextproto$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:automake
	cmd:autoconf
	cmd:autoreconf
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	libtoolize --force --copy --install
	autoreconf -i
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# remove libtool library file
	rm $libDir/libXpm.la

	prepareInstalledDevelLibs \
		libXpm

	fixPkgconfig

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $binDir $documentationDir
	fi

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
