1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils fortran-2 multilib toolchain-funcs
11 DEB_P=${DEB_PN}_${DEB_PV}
13 DESCRIPTION="CERN program library for High Energy Physics"
14 HOMEPAGE="https://cernlib.web.cern.ch/cernlib/"
16 mirror://debian/pool/main/${DEB_PN:0:1}/${DEB_PN}/${DEB_P}.orig.tar.gz
17 mirror://debian/pool/main/${DEB_PN:0:1}/${DEB_PN}/${DEB_P}-${DEB_PR}.debian.tar.gz"
20 LICENSE="GPL-2 LGPL-2 BSD"
21 KEYWORDS="amd64 hppa sparc x86 ~amd64-linux ~x86-linux"
33 S="${WORKDIR}/${DEB_PN}-${DEB_PV}"
37 epatch "${FILESDIR}"/${P}-nogfortran.patch
38 # set some default paths
40 -e "s:/usr/local:${EROOT}/usr:g" \
41 -e "s:prefix)/lib:prefix)/$(get_libdir):" \
42 -e "s:\$(prefix)/etc:${EROOT}/etc:" \
43 -e 's:$(prefix)/man:$(prefix)/share/man:' \
44 debian/add-ons/cernlib.mk || die "sed failed"
46 # use system blas and lapack set by gentoo framework
48 -e "s:\$DEPS -lm:$($(tc-getPKG_CONFIG) --libs blas):" \
49 -e "s:\$DEPS -llapack -lm:$($(tc-getPKG_CONFIG) --libs lapack):" \
50 -e 's:`depend $d $a blas`::' \
52 debian/add-ons/bin/cernlib.in || die "sed failed"
54 cp debian/add-ons/Makefile .
55 export DEB_BUILD_OPTIONS="$(tc-getFC) nostrip nocheck"
57 einfo "Applying Debian patches"
60 epatch "${FILESDIR}"/${P}-fgets.patch
61 epatch "${FILESDIR}"/${P}-ypatchy-short-name.patch
62 # since we depend on cfortran, do not use the one from cernlib
63 rm src/include/cfortran/cfortran.h || die
68 -e "s/-O2/${CFLAGS}/g" \
69 -e "s|\(CcCmd[[:space:]]*\)gcc|\1$(tc-getCC)|g" \
70 -e "s|\(CplusplusCmd[[:space:]]*\)g++|\1$(tc-getCXX)|g" \
71 -e "s|\(FortranCmd[[:space:]]*\)gfortran|\1$(tc-getFC)|g" \
73 || die "sed linux.cf failed"
75 -e "s|\(ArCmdBase[[:space:]]*\)ar|\1$(tc-getAR)|g" \
76 -e "s|\(RanlibCmd[[:space:]]*\)ranlib|\1$(tc-getRANLIB)|g" \
77 src/config/Imake.tmpl \
78 || die "sed Imake.tmpl failed"
81 -e 's/\$(FCLINK)/\$(FCLINK) $(LDFLAGS)/' \
82 -e 's/\$(CCLINK)/\$(CCLINK) $(LDFLAGS)/' \
83 src/config/{biglib,fortran,Imake}.rules \
84 src/patchy/Imakefile \
85 || die "sed for ldflags propagation failed"
87 # add missing headers for implicit
89 -e '0,/^#include/i#include <stdlib.h>' \
90 src/kernlib/kerngen/ccgen*/*.c || die
94 # parallel make breaks and complex patched imake system, hard to debug
95 emake -j1 cernlib-indep cernlib-arch
99 LD_LIBRARY_PATH="${S}"/shlib emake -j1 cernlib-test
105 dodoc changelog README.* deadpool.txt NEWS copyright
106 newdoc add-ons/README README.add-ons