/[gentoo-x86]/sci-libs/lapack-atlas/lapack-atlas-3.9.23-r2.ebuild
Gentoo

Contents of /sci-libs/lapack-atlas/lapack-atlas-3.9.23-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Thu Jan 31 11:03:51 2013 UTC (3 months, 3 weeks ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
Dropped as announced due to fragile runtime and buildtime behaviour; find new version in sci overlay named sci-libs/atlas

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-libs/lapack-atlas/lapack-atlas-3.9.23-r2.ebuild,v 1.9 2012/10/18 21:02:51 jlec Exp $
4
5 EAPI="3"
6
7 inherit eutils flag-o-matic fortran-2 toolchain-funcs autotools versionator
8
9 MY_PN="${PN/lapack-/}"
10 PATCH_V="3.9.21"
11 L_PN="lapack"
12 L_PV="3.1.1"
13 BlasRelease=$(get_version_component_range 1-3)
14
15 DESCRIPTION="F77 and C LAPACK implementations using available ATLAS routines"
16 HOMEPAGE="http://math-atlas.sourceforge.net/"
17 SRC_URI1="mirror://sourceforge/math-atlas/${MY_PN}${PV}.tar.bz2"
18 SRC_URI2="http://www.netlib.org/${L_PN}/${L_PN}-lite-${L_PV}.tgz"
19 SRC_URI="${SRC_URI1} ${SRC_URI2}
20 mirror://gentoo/${MY_PN}-${PATCH_V}-shared-libs.2.patch.bz2
21 mirror://gentoo/${L_PN}-reference-${L_PV}-autotools.patch.bz2"
22
23 SLOT="0"
24 LICENSE="BSD"
25 IUSE="doc"
26 KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
27
28 CDEPEND="
29 virtual/blas
30 virtual/cblas
31 app-admin/eselect-lapack
32 ~sci-libs/blas-atlas-${BlasRelease}"
33 DEPEND="${CDEPEND}
34 virtual/pkgconfig
35 >=sys-devel/libtool-1.5"
36 RDEPEND="${CDEPEND}
37 doc? ( app-doc/lapack-docs )"
38
39 S="${WORKDIR}/ATLAS"
40 S_LAPACK="${WORKDIR}/${L_PN}-lite-${L_PV}"
41 BLD_DIR="${S}/gentoo-build"
42 RPATH="${DESTTREE}/$(get_libdir)/${L_PN}/${MY_PN}"
43 S_LAPACK="${WORKDIR}"/${L_PN}-lite-${L_PV}
44
45 src_prepare() {
46 epatch "${DISTDIR}"/${MY_PN}-${PATCH_V}-shared-libs.2.patch.bz2
47 epatch "${FILESDIR}"/${MY_PN}-asm-gentoo.patch
48 epatch "${FILESDIR}"/${PN}-${PATCH_V}-lam.patch
49
50 # make sure the compile picks up the proper includes
51 sed -i \
52 -e "s|INCLUDES.*=|INCLUDES = -I${EPREFIX}/usr/include/atlas/|" \
53 "${S}"/CONFIG/src/SpewMakeInc.c \
54 || die "failed to append proper includes"
55
56 cp "${FILESDIR}"/eselect.lapack.atlas "${T}"/
57 sed -i -e "s:/usr:${EPREFIX}/usr:" \
58 "${T}"/eselect.lapack.atlas || die
59 if [[ ${CHOST} == *-darwin* ]] ; then
60 sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
61 "${T}"/eselect.lapack.atlas || die
62 sed -e /LIBTOOL/s/libtool/glibtool/ -i CONFIG/src/SpewMakeInc.c
63 epatch "${FILESDIR}"/${PN}-3.9.3-darwin-make-top.patch
64 fi
65
66 mkdir "${BLD_DIR}" || die "failed to generate build directory"
67 cd "${BLD_DIR}"
68 cp "${FILESDIR}"/war . && chmod a+x war || die "failed to install war"
69 sed -i -e '1c\#! '"${EPREFIX}"'/bin/bash' war
70 cd "${S_LAPACK}"
71 epatch "${WORKDIR}"/${L_PN}-reference-${L_PV}-autotools.patch
72 epatch "${FILESDIR}"/${L_PN}-reference-${L_PV}-test-fix.patch
73 eautoreconf
74 }
75
76 src_configure() {
77 cd "${BLD_DIR}"
78 local archselect=
79 if use amd64 || use ppc64; then
80 archselect="-b 64"
81 elif use alpha; then
82 archselect=""
83 else
84 archselect="-b 32"
85 fi
86
87 # Remove -m64 on alpha, since the compiler doesn't support it
88 use alpha && sed -i -e 's/-m64//g' "${S}"/CONFIG/src/probe_comp.c
89
90 # unfortunately, atlas-3.9.0 chokes when passed
91 # x86_64-pc-linux-gnu-gcc and friends instead of
92 # plain gcc. Hence, we'll have to workaround this
93 # until it is fixed by upstream
94 local c_compiler=$(tc-getCC)
95 if [[ "${c_compiler}" == *gcc* ]]; then
96 c_compiler="gcc"
97 fi
98
99 ../configure \
100 --cc="${c_compiler}" \
101 --cflags="${CFLAGS}" \
102 --prefix="${ED}/${DESTTREE}" \
103 --libdir="${ED}/${DESTTREE}"/$(get_libdir)/atlas \
104 --incdir="${ED}/${DESTTREE}"/include \
105 -C ac "${c_compiler}" -F ac "${CFLAGS}" \
106 -C if $(tc-getFC) -F if "${FFLAGS:-'-O2'}" \
107 -Ss pmake "\$(MAKE) ${MAKEOPTS}" \
108 -Si cputhrchk 0 ${archselect} \
109 || die "configure failed"
110
111 cd "${S_LAPACK}"
112 # set up the testing routines
113 sed -e "s:g77:$(tc-getFC):" \
114 -e "s:-funroll-all-loops -O3:${FFLAGS} $(pkg-config --cflags blas cblas):" \
115 -e "s:LOADOPTS =:LOADOPTS = ${LDFLAGS} $(pkg-config --cflags blas cblas):" \
116 -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas cblas):" \
117 -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.so -Wl,-rpath,${S_LAPACK}/SRC/.libs:" \
118 -e "s:EXT_ETIME$:INT_CPU_TIME:" \
119 make.inc.example > make.inc \
120 || die "Failed to set up make.inc"
121 cd "${S_LAPACK}"
122 econf
123 }
124
125 src_compile() {
126 # build atlas' part of lapack
127 cd "${BLD_DIR}"
128 for d in src/lapack interfaces/lapack/C/src interfaces/lapack/F77/src interfaces/lapack/C2F/src; do
129 cd "${BLD_DIR}"/${d}
130 make lib || die "Failed to make lib in ${d}"
131 done
132
133 cd "${S_LAPACK}"
134 emake || die "Failed to make reference lapack lib"
135
136 cd "${S_LAPACK}"/SRC
137 einfo "Copying liblapack.a/*.o to ${S_LAPACK}/SRC"
138 cp -sf "${BLD_DIR}"/gentoo/liblapack.a/*.o .
139 einfo "Copying liblapack.a/*.lo to ${S_LAPACK}/SRC"
140 cp -sf "${BLD_DIR}"/gentoo/liblapack.a/*.lo .
141 einfo "Copying liblapack.a/.libs/*.o to ${S_LAPACK}/SRC"
142 cp -sf "${BLD_DIR}"/gentoo/liblapack.a/.libs/*.o .libs/
143
144 RPATH="${DESTTREE}"/$(get_libdir)/${L_PN}/${MY_PN}
145 local flibs
146 [[ $(tc-getFC) =~ gfortran ]] && flibs=-lgfortran
147 [[ $(tc-getFC) =~ g77 ]] && flibs=-lg2c
148 ../libtool --mode=link --tag=F77 $(tc-getFC) ${LDFLAGS} \
149 $(pkg-config --libs blas cblas) -latlas ${flibs} \
150 -o liblapack.la *.lo -rpath "${RPATH}" \
151 || die "Failed to create liblapack.la"
152
153 # making pkg-config file
154 sed -e "s:@LIBDIR@:$(get_libdir)/lapack/atlas:" \
155 -e "s:=/usr:=${EPREFIX}/usr:" \
156 -e "s:@PV@:${PV}:" \
157 -e "s:@EXTLIBS@:-lm ${flibs}:g" \
158 "${FILESDIR}"/lapack.pc.in > "${S}"/lapack.pc \
159 || die "sed lapack.pc failed"
160 }
161
162 src_install () {
163 dodir "${RPATH}"
164
165 cd "${S_LAPACK}"/SRC
166 ../libtool --mode=install cp liblapack.la "${D}/${RPATH}" \
167 || die "Failed to install lapack-atlas library"
168
169 ESELECT_PROF=atlas
170 eselect lapack add $(get_libdir) "${T}"/eselect.lapack.atlas ${ESELECT_PROF}
171
172 insinto /usr/include/atlas
173 doins "${S}"/include/clapack.h || die "Failed to install clapack.h"
174 dosym atlas/clapack.h /usr/include/clapack.h
175
176 cd "${S}"
177 dodoc README doc/AtlasCredits.txt doc/ChangeLog \
178 || die "Failed to install docs"
179
180 insinto /usr/$(get_libdir)/lapack/atlas
181 doins "${S}"/lapack.pc || die "Failed to install lapack.pc"
182 }
183
184 src_test() {
185 cd "${S_LAPACK}"/TESTING/MATGEN
186 emake || die "Failed to create tmglib.a"
187 cd ..
188 emake || die "lapack-reference tests failed"
189 }
190
191 pkg_postinst() {
192 local current_lib=$(eselect lapack show | cut -d' ' -f2)
193 # this snippet works around the eselect bug #189942 and makes
194 # sure that users upgrading from a previous lapack-atlas
195 # version pick up the new pkg-config files
196 if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
197 local configfile="${EROOT}"/etc/env.d/lapack/$(get_libdir)/config
198 [[ -e ${configfile} ]] && rm -f ${configfile}
199 eselect lapack set ${ESELECT_PROF}
200 elog "lapack has been eselected to ${ESELECT_PROF}"
201 else
202 elog "Current eselected lapack is ${current_lib}"
203 elog "To use blas ${ESELECT_PROF} implementation, you have to issue (as root):"
204 elog "\t eselect lapack set ${ESELECT_PROF}"
205 fi
206 }

  ViewVC Help
Powered by ViewVC 1.1.17