SUMMARY="An open source, real-time graphics middle-ware used by developers"
DESCRIPTION="
The OpenSceneGraph is an open source high performance 3D graphics toolkit, used \
by application developers in fields such as visual simulation, games, virtual \
reality, scientific visualization and modelling. Written entirely in Standard \
C++ and OpenGL it runs on all Windows platforms, OSX, GNU/Linux, IRIX, Solaris \
, HP-Ux, AIX and FreeBSD operating systems. The OpenSceneGraph is now well \
established as the world leading scene graph technology, used widely in the \
vis-sim, space, scientific, oil-gas, games and virtual reality industries."
HOMEPAGE="http://www.openscenegraph.org"
SOURCE_URI="git://github.com/openscenegraph/osg#77f09f9e649cfedd32608ed6ec67bf1de7cd53ac"
REVISION="1"
LICENSE="OSGPL"
COPYRIGHT="2002-2014 Robert Osfield and others"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	openscenegraph$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libOpenThreads$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosg$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgAnimation$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgDB$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgFX$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgGA$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgManipulator$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgParticle$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgPresentation$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgShadow$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgSim$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgTerrain$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgText$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgUtil$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgViewer$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgVolume$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgWidget$secondaryArchSuffix = 3.3.4 compat >= 3
	lib:libosgUI$secondaryArchSuffix = 3.3.4 compat >= 3
"

REQUIRES="
	haiku$secondaryArchSuffix
	mesa$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	mesa${secondaryArchSuffix}_devel
	devel:libsdl$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:cmake
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
"

PATCHES="openscenegraph-3.2.1.patchset"

SOURCE_DIR="OpenSceneGraph-3.2.1"

BUILD()
{
	cmake . -DCMAKE_INSTALL_PREFIX=$prefix -DOSG_USE_QT=OFF -DBUILD_OSG_APPLICATIONS=OFF -DOSG_WINDOWING_SYSTEM=None
	make $jobArgs
	
}

INSTALL()
{
	make install
	
	mkdir -p $includeDir
	mv $prefix/include/* $includeDir/
	rm -rf $prefix/include
	
	mkdir -p $prefix/lib-temp
	mv $prefix/lib/* $prefix/lib-temp/
	mkdir -p $libDir
	mv $prefix/lib-temp/* $libDir
	rm -rf $prefix/lib-temp
	
	prepareInstalledDevelLibs libOpenThreads \
	 libosg libosgAnimation libosgDB libosgFX \
	 libosgGA libosgManipulator libosgParticle \
	 libosgPresentation libosgShadow libosgSim \
	 libosgTerrain libosgText libosgUtil libosgViewer \
	 libosgVolume libosgWidget libosgUI
	
	fixPkgconfig
	
	packageEntries devel $developDir
	
}

PROVIDES_devel="
	openscenegraph${secondaryArchSuffix}_devel = 3.3.4 compat >= 3
	devel:libOpenThreads$secondaryArchSuffix = 3.3.0 compat >= 3
	devel:libosg$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgAnimation$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgDB$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgFX$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgGA$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgManipulator$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgParticle$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgPresentation$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgShadow$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgSim$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgTerrain$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgText$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgUtil$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgViewer$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgVolume$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgWidget$secondaryArchSuffix = 3.3.4 compat >= 3
	devel:libosgUI$secondaryArchSuffix = 3.3.4 compat >= 3
	
"
REQUIRES_devel="
	openscenegraph$secondaryArchSuffix == 3.3.4
"
