# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 inherit eutils DESCRIPTION="NETGEN is an automatic 3d tetrahedral mesh generator" HOMEPAGE="http://www.hpfem.jku.at/netgen/" SRC_URI="ngs44.tar.gz" LICENSE="LGPL" KEYWORDS="amd64 x86" IUSE="opencascade blas lapack gmp" RDEPEND="opencascade? ( sci-libs/opencascade ) blas? ( virtual/blas ) lapack? ( virtual/lapack ) gmp? ( dev-libs/gmp ) " pkg_nofetch() { einfo "Please download ${SRC_URI} from ${HOMEPAGE} and move it to ${DISTDIR}" } DEPEND="${RDEPEND} virtual/opengl virtual/x11 >=dev-lang/tk-8.0 >=dev-lang/tcl-8.0 x86? ( >=dev-tcltk/tix-8.1 )" src_unpack() { unpack ${A} MY_S=${WORKDIR}/ngs44 cd ${MY_S} epatch ${FILESDIR}/togl_tk.patch epatch ${FILESDIR}/meshtype.patch epatch ${FILESDIR}/densemat.patch epatch ${FILESDIR}/debian-netgen_4.4-7.patch } src_compile() { cd ${MY_S} export MACHINE="LINUX" export LAPACK="-lg2c" # Fix the Makefiles local tk_version tk_version=$(grep TK_VER /usr/include/tk.h | sed 's/^.*"\(.*\)".*/\1/') tk_release_serial=$(grep TK_RELEASE_SERIAL /usr/include/tk.h | awk '{print $3}') sed -i "s:tk8.4:tk${tk_version}:g" ./Makefile sed -i "s:tk8.4:tk${tk_version}:g" ./libsrc/makefile.mach.LINUX # 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.8.4:tix${tix_version}:g" ./Makefile fi local tcl_version tcl_version=$(grep TCL_VER /usr/include/tcl.h | sed 's/^.*"\(.*\)".*/\1/') sed -i "s:tcl8.4:tcl${tcl_version}:g" ./Makefile sed -i "s:tcl8.4:tcl${tcl_version}:g" ./libsrc/makefile.mach.LINUX sed -i "s:CPP_DIR=.:CPP_DIR=${MY_S}:g" ./Makefile sed -i "s:-L/usr/openwin/lib -L/usr/X11R6/lib -L/usr/lib/GL3.5:-L/usr/X11R6/lib -L/usr/lib/GL:g" ./libsrc/makefile.mach.LINUX if use opencascade; then sed -i "s:/opt/OpenCASCADE5.2:$CASROOT/../:g" ./Makefile # This was a dirty hack and it does not work. All of this is based on old fashion Makefile and somehow # I do not succeed to remove the dependency on OpenCascade. # There is probably a flag or something to switch off. Any help is welcome! # else # sed -i "s:OCC_DIR=/opt/OpenCASCADE5.2:# OCC_DIR=/opt/OpenCASCADE5.2:g" ./Makefile # sed -i "s:OCCINC_DIR=\$(OCC_DIR)/ros/inc:# OCCINC_DIR=\$(OCC_DIR)/ros/inc:g" ./Makefile # sed -i "s:OCCLIB_DIR=\$(OCC_DIR)/ros/lin/lib:# OCCLIB_DIR=\$(OCC_DIR)/ros/lin/lib:g" ./Makefile # sed -i "s:-locc::g" ./Makefile # sed -i "s:occlib:# occlib:g" ./Makefile fi if use lapack; then LAPACK = "${LAPACK} -llapack" fi if use blas; then LAPACK = "${LAPACK} -lblas" fi if use gmp; then LAPACK = "${LAPACK} -lgmp" fi sed -i "s:# lapack = -llapack -lblas -lgmp -lg2c:lapack = $LAPACK:g" ./Makefile # Copy tkInt.h from the system to the source to correct the issue with togl.cpp cp -p /usr/lib/tk${tk_version}/include/generic/tkInt.h ./togl/tkInt${tk_version}p${tk_release_serial}.h cp -p /usr/lib/tk${tk_version}/include/generic/tkIntDecls.h ./togl/tkIntDecls${tk_version}p${tk_release_serial}.h sed -i "s:tkIntDecls.h:./tkIntDecls${tk_version}p${tk_release_serial}.h:g" ./togl/tkInt${tk_version}p${tk_release_serial}.h # Build 2 extra demo applications #sed -i "s:# appdemo:appdemo:g" ./Makefile #sed -i "s:# appaddon:appaddon:g" ./Makefile #sed -i "s:# appngs:appngs:g" ./Makefile #sed -i "s:# cd demoapp: cd demoapp:g" ./Makefile #sed -i "s:# cd ngsolve: cd ngsolve:g" ./Makefile less Makefile emake || die "emake failed" } src_install() { cd ${MY_S} dobin ng dodoc ./doc/ng4.pdf LGPL VERSION dodir /usr/share/${PF} insinto /usr/share/${PF} find . -name "*.tcl" -exec doins --parents {} \; dodir /usr/share/${PF}/tutorials insinto /usr/share/${PF}/tutorials doins ./tutorials/* }