# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils MY_PN=OpenSceneGraph MY_P=${MY_PN}-${PV}-1 DESCRIPTION="Cross-platform, high performance 3D graphics toolkit" HOMEPAGE="http://www.openscenegraph.org/" SRC_URI="${HOMEPAGE}downloads/developer/${MY_P}.tar.gz examples? ( ${HOMEPAGE}downloads/data/${MY_PN}-Data-1.0.zip )" LICENSE="OSGPL free-noncomm" SLOT="0" KEYWORDS="~x86" IUSE="coin doc examples gdal gif glut introspection inventor jasper jpeg png producer tiff truetype xine" DEPEND="virtual/opengl >=dev-libs/openthreads-1.4.2 coin? ( media-libs/coin ) doc? ( app-doc/doxygen ) gdal? ( sci-libs/gdal ) gif? ( media-libs/giflib ) glut? ( virtual/glut ) inventor? ( media-libs/openinventor ) jasper? ( media-libs/jasper ) jpeg? ( media-libs/jpeg ) png? ( media-libs/libpng sys-libs/zlib ) producer? ( >=media-libs/openproducer-1.0.1 ) tiff? ( media-libs/tiff ) truetype? ( media-libs/freetype ) xine? ( media-libs/xine-lib )" S="${WORKDIR}/${MY_P}" pkg_setup() { if use examples && ! use producer ; then echo eerror "Open Producer is required to build the" eerror "examples." echo eerror "To continue, either remove \"examples\"" eerror "from your USE flags or add \"producer\"." echo die fi } src_unpack() { unpack ${A} cd "${S}" sed -i "s:OPTF.*=.*:OPTF=\"${CXXFLAGS}\":" \ Make/makedefs \ || die "sed CXXFLAGS failed" if use gif ; then sed -i 's/-lungif/-lgif/' \ Make/makedefs \ || die "sed lgif failed" fi if use doc ; then # Fix OUTPUT_DIRECTORY sed -i 's:\$(OSGHOME)/::' \ doc/Doxyfiles/all_Doxyfile \ || die "sed doxyfile failed" fi } src_compile() { # This package has no configure script. # Compilation options in the form of # OPTION ?= yes/no # are read from a given file, specified # in ${OSG_DEPENDENCIES} function myconf { # Write config options to dependencies file einfo "${confopt} = ${2}" echo "${1} ?= ${2}" >> "${T}/my_dependencies" } for useopt in ${IUSE} ; do # Match each USE flag with a config option case ${useopt} in coin) local confopt=COIN_INSTALLED ;; doc) # doc isn't used here continue ;; examples) local confopt=COMPILE_EXAMPLES ;; gdal) local confopt=GDAL_INSTALLED ;; gif) local confopt=LIBUNGIF_INSTALLED ;; glut) local confopt=GLUT_INSTALLED ;; introspection) local confopt=COMPILE_INTROSPECTION ;; inventor) local confopt=INVENTOR_INSTALLED ;; jasper) local confopt=JASPER_INSTALLED ;; jpeg) local confopt=LIBJPEG_INSTALLED ;; png) local confopt=LIBPNG_INSTALLED ;; producer) local confopt=PRODUCER_INSTALLED ;; tiff) local confopt=LIBTIFF_INSTALLED ;; truetype) local confopt=FREETYPE_INSTALLED ;; xine) local confopt=XINE_INSTALLED ;; esac use ${useopt} && \ myconf ${confopt} yes \ || myconf ${confopt} no done # SGI OpenGL Performer. No ebuild available to test. local confopt=PERFORMER_INSTALLED myconf ${confopt} no # Quicktime support is for Mac OS X Only. local confopt=QUICKTIME_INSTALLED myconf ${confopt} no export OSG_DEPENDENCIES="${T}/my_dependencies" emake || die "emake failed" use doc && doxygen doc/Doxyfiles/all_Doxyfile } src_install() { make install \ "INST_LOCATION=${D}/usr/" \ "INST_EXAMPLES=${D}/usr/bin/" \ || die "make install failed" if use doc ; then dodoc doc/ProgrammingGuide/ProgrammingGuide.odt dohtml -r doc/doxygen/html/ fi dodoc AUTHORS.txt ChangeLog NEWS.txt README.txt insinto "${ROOT}/usr/$(get_libdir)/pkgconfig" doins "${S}/Make/${PN}.pc" if use examples ; then cd "${S}/examples" for example in $(ls) ; do rm -rf ${example}/Linux32.Opt/ done local expath="/usr/share/doc/${PF}/examples/" mkdir -p "${D}/${expath}" cp -r "${S}/examples" \ "${D}/${expath}source" cp -r "${WORKDIR}/${MY_PN}-Data" \ "${D}/${expath}data" echo "OSG_FILE_PATH=${expath}data" \ > "${T}/99${PN}" doenvd "${T}/99${PN}" fi rm -rf "${D}/usr/share/${MY_PN}/" }