SUMMARY="A library to access multiple forms of archives"
DESCRIPTION="
Physfs is short for PhysicsFS. It's a C library that provides abstract \
access to various archives. It is intended for use in video games, and the \
design was somewhat inspired by Quake 3's file subsystem. The programmer \
defines a \"write directory\" on the physical filesystem. No file writing done \
through the PhysicsFS API can leave that write directory, for security.
PhysicsFS gives you platform-abstracted means to determine if CD-ROMs are \
available, the user's home directory, where in the real filesystem your \
program is running, etc."
HOMEPAGE="http://icculus.org/physfs"
SOURCE_URI="http://icculus.org/physfs/downloads/physfs-2.0.3.tar.bz2"
CHECKSUM_SHA256="ca862097c0fb451f2cacd286194d071289342c107b6fe69079c079883ff66b69"
LICENSE="PHYSFS"
COPYRIGHT="2001-2012 Ryan C. Gordon"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

REVISION="2"

PROVIDES="
	physfs$secondaryArchSuffix = $portVersion compat >= 2.0
	lib:libphysfs$secondaryArchSuffix = $portVersion compat >= 2.0
	cmd:test_physfs$secondaryArchSuffix = $portVersion compat >= 2.0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:make
	cmd:gcc$secondaryArchSuffix
	"
PATCH()
{
	sed -i "s,DESTINATION include,DESTINATION $relativeIncludeDir," CMakeLists.txt
	sed -i "s,DESTINATION bin,DESTINATION $relativeBinDir," CMakeLists.txt
}

BUILD()
{
	cmake . -DCMAKE_INSTALL_PREFIX=$prefix \
		-DLIB_SUFFIX="/${secondaryArchSuffix/_/}"
	make $jobArgs
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLib libphysfs
	fixPkgconfig
	
	# devel package
	packageEntries devel \
			$developDir
}

PROVIDES_devel="
	physfs${secondaryArchSuffix}_devel = $portVersion compat >= 2.0
	devel:libphysfs$secondaryArchSuffix = $portVersion compat >= 2.0
	"
REQUIRES_devel="
	physfs$secondaryArchSuffix == $portVersion base
	"
