| 1 |
# Copyright 1999-2009 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/cgal/cgal-3.3.1.ebuild,v 1.4 2009/08/12 21:29:10 bicatali Exp $ |
| 4 |
|
| 5 |
EAPI=2 |
| 6 |
|
| 7 |
inherit eutils toolchain-funcs |
| 8 |
|
| 9 |
MYP=CGAL-${PV} |
| 10 |
|
| 11 |
DESCRIPTION="C++ library for geometric algorithms and data structures" |
| 12 |
HOMEPAGE="http://www.cgal.org/" |
| 13 |
SRC_URI="ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/${MYP}.tar.gz" |
| 14 |
|
| 15 |
LICENSE="LGPL-2.1 QPL" |
| 16 |
SLOT="0" |
| 17 |
KEYWORDS="~amd64 ~x86" |
| 18 |
IUSE="examples gmp lapack opengl qt3 taucs X zlib" |
| 19 |
|
| 20 |
RDEPEND="dev-libs/boost |
| 21 |
dev-libs/mpfr |
| 22 |
lapack? ( virtual/lapack ) |
| 23 |
opengl? ( virtual/opengl ) |
| 24 |
qt3? ( x11-libs/qt:3 ) |
| 25 |
taucs? ( sci-libs/taucs ) |
| 26 |
X? ( x11-libs/libX11 ) |
| 27 |
zlib? ( sys-libs/zlib )" |
| 28 |
DEPEND="${RDEPEND} |
| 29 |
lapack? ( dev-util/pkgconfig )" |
| 30 |
|
| 31 |
S="${WORKDIR}/${MYP}" |
| 32 |
|
| 33 |
src_prepare() { |
| 34 |
epatch "${FILESDIR}"/${P}-rpath.patch |
| 35 |
# a patch from debian on missing qt headers |
| 36 |
epatch "${FILESDIR}"/${P}-qt.patch |
| 37 |
epatch "${FILESDIR}"/${P}-gcc44.patch |
| 38 |
# sed for blas and lapack gentoo style |
| 39 |
sed -e 's:Intel MKL:Gentoo BLAS-LAPACK:' \ |
| 40 |
-e "s:^LIBS.=.*:LIBS=$(pkg-config --libs-only-l lapack | sed 's/-l//g'):" \ |
| 41 |
-e "s:^STDLIBDIRS.=*:STDLIBDIRS=$(pkg-config --libs-only-L lapack | sed 's/-L//g'):" \ |
| 42 |
config/support/S48a-MKL64 \ |
| 43 |
> config/support/S48e-GENTOOLAPACK || die |
| 44 |
sed -i -e 's/-O2//' install_cgal || die |
| 45 |
} |
| 46 |
|
| 47 |
src_configure() { |
| 48 |
CGALDIR="${S}/usr" |
| 49 |
MYCONF="-ni |
| 50 |
--prefix=${CGALDIR} |
| 51 |
--cxx=$(tc-getCXX) |
| 52 |
--without-autofind |
| 53 |
--with-boost |
| 54 |
--with-boost_program_options |
| 55 |
--with-mpfr |
| 56 |
--with-gmp |
| 57 |
--with-gmpxx" |
| 58 |
|
| 59 |
use lapack && MYCONF="${MYCONF} --with-gentoolapack" |
| 60 |
use opengl && MYCONF="${MYCONF} --with-opengl" |
| 61 |
use taucs && MYCONF="${MYCONF} --with-gentoolapack --with-taucslapack" |
| 62 |
use X && MYCONF="${MYCONF} --with-x11" |
| 63 |
use zlib && MYCONF="${MYCONF} --with-zlib" |
| 64 |
use qt3 && MYCONF="${MYCONF} --with-qt3mt --qt_incl_dir ${QTDIR}/include --qt_lib_dir ${QTDIR}/lib" |
| 65 |
} |
| 66 |
|
| 67 |
src_compile() { |
| 68 |
./install_cgal ${MYCONF} || die "compilation failed" |
| 69 |
grep -q failed compile.log && die "see ${S}/compile.log for problems" |
| 70 |
} |
| 71 |
|
| 72 |
src_test() { |
| 73 |
cd "${S}"/examples |
| 74 |
export CGAL_MAKEFILE="${CGALDIR}/share/cgal/cgal.mk" |
| 75 |
emake || die "emake examples failed" |
| 76 |
# basic testing, does not compare with original |
| 77 |
for t in */*.cpp; do |
| 78 |
local run_testt=${t%.cpp} |
| 79 |
if [[ -x ${run_test} ]]; then |
| 80 |
${run_test} || die "Running test from ${t} failed" |
| 81 |
fi |
| 82 |
done |
| 83 |
} |
| 84 |
|
| 85 |
src_install(){ |
| 86 |
mv usr/lib usr/$(get_libdir) |
| 87 |
sed -i \ |
| 88 |
-e "s:${CGALDIR}:/usr:g" \ |
| 89 |
"${CGALDIR}/share/cgal/cgal.mk" || die "sed cgal.mk failed" |
| 90 |
cp -pPR usr "${D}" || die "install failed" |
| 91 |
|
| 92 |
if use examples; then |
| 93 |
insinto /usr/share/doc/${PF} |
| 94 |
doins -r demo examples || die "samples install failed" |
| 95 |
fi |
| 96 |
echo "CGAL_MAKEFILE=/usr/share/cgal/cgal.mk" > 99cgal |
| 97 |
doenvd 99cgal || die |
| 98 |
} |