# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: inherit eutils toolchain-funcs versionator flag-o-matic DESCRIPTION="Software development platform including components for 3D surface and solid modeling, visualization, data exchange and rapid application development." HOMEPAGE="http://www.opencascade.org" SRC_URI="ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/thierry/${P}.tar.bz2 ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/thierry/${PN}-samples-java-${PV}.tar.bz2 ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/thierry/${PN}-samples-qt-${PV}.tar.bz2 ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/thierry/${PN}-tutorial-${PV}.tar.bz2" # The source code here is NOT in the same form than the one distributed on opencascade.org # The source available on opencascade.org requires a Java installation procedure that does not # always work on Gentoo. The source code can however be extracted 'by hand' using # 'java -cp ./Linux/setup.jar -DOS_NAME=Linux -Dtemp.dir=/some/big/dir/tmp run' # and removing 'by hand' all the existing Linux binaries. # The source code extracted using this method is available (for the time being) # on the FreeBSD ftp server. # An other possibility is to download the Salome binary for linux (500Mb...) # and to extract the source code for OpenCascade from there. # # In any case, none of these solutions are really satisfactory. A better method should # be found LICENSE="Open CASCADE Technology Public License" SLOT="6" KEYWORDS="amd64 x86" IUSE="examples debug java fltk stlport X opengl" DEPEND="java? ( =virtual/jdk ) opengl? (=virtual/opengl) X? ( =virtual/x11 ) >=dev-lang/tcl-8.4 >=dev-lang/tk-8.4 >=dev-tcltk/itcl-3.2 >=dev-tcltk/itk-3.2 x86? ( >=dev-tcltk/tix-8.1 ) fltk? ( x11-libs/fltk ) stlport? ( dev-libs/STLport ) sys-devel/autoconf sys-devel/automake sys-devel/libtool" src_unpack() { unpack ${A} cd ${S}/ros sed -i "s:/usr/ports/cad/opencascade/:/var/tmp/portage/${PF}/:g" ./env.* local tk_version tk_version=$(grep TK_VER /usr/include/tk.h | sed 's/^.*"\(.*\)".*/\1/') sed -i "s:tk8.4:tk${tk_version}:g" ./env.* local itcl_version itcl_version=$(grep ITCL_VER /usr/include/itcl.h | sed 's/^.*"\(.*\)".*/\1/') sed -i "s:itcl3.2:itcl${itcl_version}:g" ./env.* # tix 8.4.0 does not build on AMD64 at the moment. Hopefully this will # be corrected soon. if use x86 ; then local tix_version tix_version=$(grep TIX_VER /usr/include/tix.h | sed 's/^.*"\(.*\)".*/\1/') sed -i "s:tix8.1:tix${tix_version}:g" ./env.* fi local itk_version itk_version=$(grep ITK_VER /usr/include/itk.h | sed 's/^.*"\(.*\)".*/\1/') sed -i "s:itk3.2:itk${itk_version}:g" ./env.* local tcl_version tcl_version=$(grep TCL_VER /usr/include/tcl.h | sed 's/^.*"\(.*\)".*/\1/') sed -i "s:tcl8.4:tcl${tcl_version}:g" ./env.* } src_compile() { cd ${S}/ros # Two solutions to deal with GCC-4.1, use this patch or add some flags to # CXXFLAGS (see below) # epatch ${FILESDIR}/CASCADE_6.1.0_gcc4.1.patch chmod u+x configure source env.ksh aclocal || die "aclocal failed" autoheader || die "autoheader failed" automake -a -c -f libtoolize --force --copy || die "libtoolize failed" autoconf || die "autoconf failed" # Determine the configure options if use opengl && use !X; then ewarn "OpenGL functionnalities imply X support! Check your USE flags configuration." die fi local myconf="--prefix=/usr/${P}/ros/lin --with-tcl=/usr/lib/ --with-tk=/usr/lib/" if use X; then myconf="${myconf} --with-x --with-xmu-include=/usr/include --with-xmu-library=/usr/lib" if use opengl; then myconf="${myconf} --with-gl-include=/usr/include --with-gl-library=/usr/lib" fi else myconf="${myconf} --without-x --without-gl --without-xmu" fi if use !debug; then myconf="${myconf} --disable-debug --enable-production" else myconf="${myconf} --enable-debug" fi if use stlport; then # myconf="${myconf} --with-stlport-library=/usr/lib/ --with-stlport-libname=stlport_gcc --with-stlport-include=/usr/include/stlport" # To specify everything seems to screw up the configuration process regarding the setting # up of CXXFLAGS myconf="${myconf} --with-stlport-libname=stlport_gcc" else myconf="${myconf} --without-stlport" fi # CXXFLAGS are slightly modified to allow the compilation of OpenCascade-6.1 with gcc-4.1.x if version_is_at_least "4.1" $(gcc-version) ; then append-flags -ffriend-injection -fpermissive fi econf $(use_with java) \ $(use_with fltk) \ ${myconf} || die "econf failed" emake || die "emake failed" } src_install() { cd ${S}/ros emake DESTDIR="${D}" install || die "emake install failed" dosym /usr/${P}/ros/lin /usr/${P}/ros/Linux # Fix the environment files cp env.ksh 50${P} sed -i "s:export::g" ./50${P} sed -i "1,2d" ./50${P} sed -i "s:/var/tmp/portage/${PF}/work/${P}/ros:/usr/${P}/ros/:g" ./50${P} sed -i "2,12d" ./50${P} sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk:/usr:g" ./50${P} sed -i "22d" ./50${P} sed -i "27,36d" ./50${P} sed -i "2i\ PATH=\$CASROOT/Linux/bin/\n LDPATH=\$CASROOT/Linux/lib/" ./50${P} dodir /etc/env.d insinto /etc/env.d doins 50${P} rm 50${P} sed -i "s:/var/tmp/portage/${PF}/work/${P}/ros:/usr/${P}/ros/:g" ./env.ksh sed -i "s:LD_LIBRARY_PATH:LDPATH:g" ./env.ksh sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk/bin\:::g" ./env.ksh sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk/lib\:::g" ./env.ksh sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk:/usr:g" ./env.ksh sed -i "s:/var/tmp/portage/${PF}/work/${P}/ros:/usr/${P}/ros/:g" ./env.csh sed -i "s:LD_LIBRARY_PATH:LDPATH:g" ./env.csh sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk/bin\:::g" ./env.csh sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk/lib\:::g" ./env.csh sed -i "s:\$CASROOT/../3rdparty/\$OS_NAME/tcltk:/usr:g" ./env.csh # Clean the source and regenerate config.h and other Makefiles emake distclean || die "emake distclean failed" econf $(use_with java) \ $(use_with fltk) \ ${myconf} || die "econf failed" # Install the documentation cd ${S}/doc dodoc *.pdf ../LICENSE # Install necessary directories under /usr/opencascade-x.y # I am not sure if I put everything. Any better suggestion is welcome. cd ${S} insinto /usr/${P} doins -r LICENSE data ros tools wok doc if use examples ; then doins -r samples fi }