SUMMARY="The Persistence of Vision Raytracer"
DESCRIPTION="Persistence of Vision Ray Tracer, or POV-Ray, is a ray \
tracing program using techniques for generating images from text-based \
scene descriptions by tracing the path of light through pixels in an image plane \
and simulating the effects of its encounters with virtual objects. \
Based on DKBTrace, written by David Kirk Buck and Aaron Collins for \
Commodore Amiga computers."
HOMEPAGE="http://www.povray.org/"
COPYRIGHT="1991-2013 Persistence of Vision Raytracer Pty. Ltd."
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/POV-Ray/povray/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="7bee83d9296b98b7956eb94210cf30aa5c1bbeada8ef6b93bb52228bbc83abff"
PATCHES="povray-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="
	settings/povray/3.7/povray.conf keep-old
	settings/povray/3.7/povray.ini keep-old
	"

PROVIDES="
	povray$secondaryArchSuffix = $portVersion
	cmd:povray$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_date_time$secondaryArchSuffix
	lib:libboost_thread$secondaryArchSuffix
	lib:libIex_3_0$secondaryArchSuffix
	lib:libIlmThread_3_0$secondaryArchSuffix
	lib:libImath_3_0$secondaryArchSuffix
	lib:libOpenEXR_3_0$secondaryArchSuffix
	lib:libOpenEXRUtil_3_0$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_date_time$secondaryArchSuffix >= 1.70.0
	devel:libboost_thread$secondaryArchSuffix >= 1.70.0
	devel:libIex_3_0$secondaryArchSuffix
	devel:libIlmThread_3_0$secondaryArchSuffix
	devel:libImath_3_0$secondaryArchSuffix
	devel:libOpenEXR_3_0$secondaryArchSuffix
	devel:libOpenEXRUtil_3_0$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libsdl$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:automake
	cmd:autoupdate
	cmd:awk
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:gettext
	cmd:grep
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	"

BUILD()
{
	pushd unix
	./prebuild.sh
	autoupdate
	popd

	LIBS="-lbsd -lnetwork -lboost_date_time" \
	CXXFLAGS="-std=c++11 -DBOOST_NO_CXX11_CONSTEXPR -D_BSD_SOURCE" \
	runConfigure ./configure \
		COMPILED_BY="HaikuPorts" \
		--disable-optimiz \
		--with-boost-libdir=`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir

	make $jobArgs
}

INSTALL()
{
	mkdir -p $docDir $binDir $dataDir/povray-3.7
	cp -R icons include ini scenes scripts $dataDir/povray-3.7
	cp -R doc $docDir/
	install -Dm755 unix/povray "$binDir"
	install -Dm644 povray.conf $settingsDir/povray/3.7/povray.conf
	install -Dm644 povray.ini $settingsDir/povray/3.7/povray.ini
	install -Dm644 povray.1 "$manDir/man1/povray.1"
}

TEST()
{
	make check
}
