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.bz2"
CHECKSUM_SHA256="fd6a6de3da48de8d1bb738ab6be4ad67f7cb0986c39bd3f7d51dd24f7854bdec"
SOURCE_DIR="libXpm-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="4.11.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libxpm$secondaryArchSuffix = $portVersion
	cmd:cxpm$secondaryArchSuffix
	cmd:sxpm$secondaryArchSuffix
	lib:libXpm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libX11$secondaryArchSuffix
	lib:libXext$secondaryArchSuffix
	lib:libXt$secondaryArchSuffix
	"

PROVIDES_devel="
	libxpm${secondaryArchSuffix}_devel = $portVersion
	devel:libXpm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxpm$secondaryArchSuffix == $portVersion base
	devel:libX11$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libintl$secondaryArchSuffix
	devel:libX11$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libXt$secondaryArchSuffix
	devel:util_macros
	devel:xtrans
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libxpm$secondaryArchSuffix \
	$libDir/libXpm.so.$libVersion

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

INSTALL()
{
	make install

	if [ -z "$secondaryArchSuffix" ]; then
		install -m 0755 -d "$developDocDir"
		install -m 0644 -t "$developDocDir" README
		#maybe_manDir="$manDir"
	else
		#rm -rf "$manDir"
		rm -rf "$developDir/documentation"
		#maybe_manDir=
	fi

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

	prepareInstalledDevelLib libXpm

	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
