# 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 debug doc examples gdal gif glut introspection inventor jasper jpeg png producer tiff truetype xine" RDEPEND="virtual/opengl >=dev-libs/openthreads-1.4.2 producer? ( >=media-libs/openproducer-1.0.1 )" DEPEND="${RDEPEND} 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 ) 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 compile the" eerror "examples. Please add \"producer\" to your" eerror "USE flags or remove \"examples\"." 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 } src_compile() { # Compilation options in the form of # OPTION ?= yes/no # are read from the file # ${OSG_DEPENDENCIES} function myconf { # Write config options to the dependencies file if use ${flag} ; then echo "${1} ?= yes" >> "${T}/myconf" else echo "${1} ?= no" >> "${T}/myconf" fi } for flag in ${IUSE} ; do # Match each USE flag with a config option case ${flag} in coin) myconf COIN_INSTALLED ;; examples) myconf COMPILE_EXAMPLES ;; gdal) myconf GDAL_INSTALLED ;; gif) myconf LIBUNGIF_INSTALLED ;; glut) myconf GLUT_INSTALLED ;; introspection) myconf COMPILE_INTROSPECTION ;; inventor) myconf INVENTOR_INSTALLED ;; jasper) myconf JASPER_INSTALLED ;; jpeg) myconf LIBJPEG_INSTALLED ;; png) myconf LIBPNG_INSTALLED ;; producer) myconf PRODUCER_INSTALLED ;; tiff) myconf LIBTIFF_INSTALLED ;; truetype) myconf FREETYPE_INSTALLED ;; xine) myconf XINE_INSTALLED ;; esac done # SGI OpenGL Performer. No ebuild available to test. echo "PERFORMER_INSTALLED ?= no" >> "${T}/myconf" # Quicktime support is for Mac OS X Only. echo "QUICKTIME_INSTALLED ?= no" >> "${T}/myconf" cat "${T}/myconf" export OSG_DEPENDENCIES="${T}/myconf" if use debug ; then emake debug || die "emake debug failed" else emake || die "emake failed" fi if use doc ; then export OSGHOME="${S}" doxygen doc/Doxyfiles/all_Doxyfile \ || die "doxygen failed" fi } 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 cp -r "${WORKDIR}/${MY_PN}-Data" \ "${D}/usr/share/${PN}" echo "OSG_FILE_PATH=/usr/share/${PN}" \ > "${T}/99${PN}" doenvd "${T}/99${PN}" fi rm -rf "${D}/usr/share/${MY_PN}" }