/[gentoo-x86]/sci-libs/blas-atlas/blas-atlas-3.9.23-r4.ebuild
Gentoo

Contents of /sci-libs/blas-atlas/blas-atlas-3.9.23-r4.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Thu Oct 18 21:15:45 2012 UTC (2 years, 2 months ago) by jlec
Branch: MAIN
Changes since 1.6: +6 -6 lines
sci-libs/blas-atlas: Remove virtual/fortran and always call fortran-2_pkg_setup as intend by the updated fortran-2.eclass

(Portage version: 2.2.0_alpha141/cvs/Linux x86_64, signed Manifest commit with key 8009D6F070EB7916)

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/blas-atlas/blas-atlas-3.9.23-r4.ebuild,v 1.6 2011/06/21 15:42:16 jlec Exp $
4
5 EAPI="3"
6
7 inherit eutils fortran-2 toolchain-funcs multilib
8
9 MY_PN=${PN/blas-/}
10 PATCH_V="3.9.21"
11 DESCRIPTION="Automatically Tuned Linear Algebra Software BLAS implementation"
12 HOMEPAGE="http://math-atlas.sourceforge.net/"
13 SRC_URI="
14 mirror://sourceforge/math-atlas/${MY_PN}${PV}.tar.bz2
15 mirror://gentoo/${MY_PN}-${PATCH_V}-shared-libs.2.patch.bz2"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-macos"
20 IUSE="doc"
21
22 RDEPEND="
23 app-admin/eselect-blas
24 app-admin/eselect-cblas
25 doc? ( app-doc/blas-docs )"
26 DEPEND="app-admin/eselect-blas
27 app-admin/eselect-cblas
28 >=sys-devel/libtool-1.5"
29
30 S="${WORKDIR}/ATLAS"
31 BLD_DIR="${S}"/gentoo-build
32 RPATH=/usr/$(get_libdir)/blas
33
34 pkg_setup() {
35 fortran-2_pkg_setup
36 # icc won't compile (as of icc-10.0.026)
37 # and will blow out $PORTAGE_TMPDIR
38 if [[ $(tc-getCC) = icc* ]]; then
39 eerror "icc compiler is not supported with sci-libs/blas-atlas"
40 die "blas-atlas won't compile with icc"
41 fi
42
43 echo
44 ewarn "Please make sure to disable CPU throttling completely"
45 ewarn "during the compile of blas-atlas. Otherwise, all atlas"
46 ewarn "generated timings will be completely random and the"
47 ewarn "performance of the resulting libraries will be degraded"
48 ewarn "considerably."
49 echo
50 ewarn "For users of <=gcc-4.1 only:"
51 ewarn "If you experience failing SANITY tests during"
52 ewarn "atlas' compile please try passing -mfpmath=387; this"
53 ewarn "option might also result in much better performance"
54 ewarn "than using then sse instruction set depending on your"
55 ewarn "CPU."
56 echo
57 ewarn "If blas-atlas fails during linking with a message"
58 ewarn "'relocation R_X86_64_32 .... recompile with -fPIC.'"
59 ewarn "please re-emerge libtool and then try again."
60 echo
61 }
62
63 src_prepare() {
64 epatch "${DISTDIR}"/${MY_PN}-${PATCH_V}-shared-libs.2.patch.bz2
65 epatch "${FILESDIR}"/${MY_PN}-${PV}-ger-fix.patch
66 epatch "${FILESDIR}"/${MY_PN}-asm-gentoo.patch
67
68 cp "${FILESDIR}"/eselect.{,c}blas.{,threaded-}atlas "${T}"/
69 sed -i -e "s:/usr:${EPREFIX}/usr:" \
70 "${T}"/eselect.{,c}blas.{,threaded-}atlas || die
71 if [[ ${CHOST} == *-darwin* ]] ; then
72 sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
73 "${T}"/eselect.{,c}blas.{,threaded-}atlas || die
74 sed -e /LIBTOOL/s/libtool/glibtool/ -i CONFIG/src/SpewMakeInc.c
75 epatch "${FILESDIR}"/${PN}-3.9.3-darwin-make-top.patch
76 fi
77
78 mkdir "${BLD_DIR}" || die "failed to generate build directory"
79 cd "${BLD_DIR}"
80 cp "${FILESDIR}"/war . && chmod a+x war || die "failed to install war"
81 sed -i -e '1c\#!'"${EPREFIX}"'/bin/bash' war || die
82 }
83
84 src_configure() {
85 cd "${BLD_DIR}"
86 local archselect=
87 if use amd64 || use ppc64; then
88 archselect="-b 64"
89 elif use alpha; then
90 archselect=""
91 else
92 archselect="-b 32"
93 fi
94
95 # Remove -m64 on alpha, since the compiler doesn't support it
96 use alpha && sed -i -e 's/-m64//g' "${S}"/CONFIG/src/probe_comp.c
97
98 # unfortunately, atlas-3.9.0 chokes when passed
99 # x86_64-pc-linux-gnu-gcc and friends instead of
100 # plain gcc. Hence, we'll have to workaround this
101 # until it is fixed by upstream
102 local c_compiler=$(tc-getCC)
103 if [[ "${c_compiler}" == *gcc* ]]; then
104 c_compiler="gcc"
105 fi
106
107 ../configure \
108 --cc="${c_compiler}" \
109 --cflags="${CFLAGS}" \
110 --prefix="${ED}"/usr \
111 --libdir="${ED}"/usr/$(get_libdir)/atlas \
112 --incdir="${ED}"/usr/include \
113 -C ac "${c_compiler}" -F ac "${CFLAGS}" \
114 -C if $(tc-getFC) -F if "${FFLAGS:-'-O2'}" \
115 -Ss pmake "\$(MAKE) ${MAKEOPTS}" \
116 -Si cputhrchk 0 ${archselect} \
117 || die "configure failed"
118
119 # fix LDFLAGS
120 sed -e "s|LDFLAGS =.*|LDFLAGS = ${LDFLAGS}|" \
121 -i "${BLD_DIR}"/Make.inc
122 }
123
124 src_compile() {
125 cd "${BLD_DIR}"
126
127 # atlas does its own parallel builds
128 # — and it fails parallel make, bug #294172
129 emake -j1 || die "emake failed"
130
131 emake -j1 \
132 LIBDIR=$(get_libdir) \
133 RPATH="${EPREFIX}/${RPATH}"/atlas \
134 shared || die "failed to build shared libraries"
135
136 # build shared libraries of threaded libraries if applicable
137 if [[ -d gentoo/libptcblas.a ]]; then
138 emake -j1 \
139 LIBDIR=$(get_libdir) \
140 RPATH="${EPREFIX}${RPATH}"/threaded-atlas \
141 ptshared || die "failed to build threaded shared libraries"
142 fi
143 }
144
145 src_test() {
146 # make check does not work because
147 # we don't build lapack libs
148 for i in F77 C; do
149 einfo "Testing ${i} interface"
150 cd "${BLD_DIR}"/interfaces/blas/${i}/testing
151 make sanity_test || die "emake tests for ${i} failed"
152 if [[ -d "${BLD_DIR}"/gentoo/libptf77blas.a ]]; then
153 make ptsanity_test || die "emake tests threaded for ${i}failed"
154 fi
155 done
156 echo "Timing ATLAS"
157 cd "${BLD_DIR}"
158 emake time || die "emake time failed"
159 }
160
161 src_install () {
162 dodir "${RPATH}"/atlas
163 cd "${BLD_DIR}"/gentoo/libs
164 cp -P libatlas* "${ED}"/usr/$(get_libdir) \
165 || die "Failed to install libatlas"
166
167 # pkgconfig files
168 local extlibs="-lm"
169 local threadlibs
170 [[ $(tc-getFC) =~ gfortran ]] && extlibs="${extlibs} -lgfortran"
171 [[ $(tc-getFC) =~ g77 ]] && extlibs="${extlibs} -lg2c"
172 cp "${FILESDIR}"/blas.pc.in blas.pc
173 cp "${FILESDIR}"/cblas.pc.in cblas.pc
174 sed -i \
175 -e "s:=/usr:=${EPREFIX}/usr:" \
176 -e "s:@LIBDIR@:$(get_libdir)/blas/atlas:" \
177 -e "s:@PV@:${PV}:" \
178 -e "s:@EXTLIBS@:${extlibs}:g" \
179 -e "s:@THREADLIBS@:${threadlibs}:g" \
180 *blas.pc || die "sed *blas.pc failed"
181
182 cp -P *blas* "${ED}/${RPATH}"/atlas \
183 || die "Failed to install blas/cblas"
184
185 ESELECT_PROF=atlas
186 eselect blas add $(get_libdir) "${T}"/eselect.blas.atlas ${ESELECT_PROF}
187 eselect cblas add $(get_libdir) "${T}"/eselect.cblas.atlas ${ESELECT_PROF}
188
189 if [[ -d "${BLD_DIR}"/gentoo/threaded-libs ]]; then
190 dodir "${RPATH}"/threaded-atlas
191 cd "${BLD_DIR}"/gentoo/threaded-libs
192
193 # pkgconfig files
194 cp "${FILESDIR}"/blas.pc.in blas.pc
195 cp "${FILESDIR}"/cblas.pc.in cblas.pc
196 threadlibs="-lpthread"
197 sed -i \
198 -e "s:=/usr:=${EPREFIX}/usr:" \
199 -e "s:@LIBDIR@:$(get_libdir)/blas/threaded-atlas:" \
200 -e "s:@PV@:${PV}:" \
201 -e "s:@EXTLIBS@:${extlibs}:g" \
202 -e "s:@THREADLIBS@:${threadlibs}:g" \
203 *blas.pc || die "sed *blas.pc failed"
204
205 cp -P * "${ED}/${RPATH}"/threaded-atlas \
206 || die "Failed to install threaded atlas"
207 ESELECT_PROF=atlas-threads
208
209 eselect blas add $(get_libdir) "${T}"/eselect.blas.threaded-atlas ${ESELECT_PROF}
210 eselect cblas add $(get_libdir) "${T}"/eselect.cblas.threaded-atlas ${ESELECT_PROF}
211 fi
212
213 insinto /usr/include/atlas
214 doins \
215 "${S}"/include/cblas.h \
216 "${S}"/include/atlas_misc.h \
217 "${S}"/include/atlas_enum.h \
218 "${S}"/include/atlas_aux.h \
219 || die "failed to install headers"
220
221 # These headers contain the architecture-specific
222 # optimizations determined by ATLAS. The atlas-lapack build
223 # is much shorter if they are available, so save them:
224 doins "${BLD_DIR}"/include/*.h \
225 || die "failed to install timing headers"
226
227 sed \
228 -e "s:L/usr/:L${EPREFIX}/usr/:g" \
229 -e "s: /usr/lib: ${EPREFIX}/usr/lib:g" \
230 -i \
231 "${ED}"/usr/$(get_libdir)/*.la \
232 "${ED}"/usr/$(get_libdir)/blas/*/*.la \
233 || die
234
235 # some docs
236 cd "${S}"/doc
237 dodoc INDEX.txt AtlasCredits.txt ChangeLog || die "dodoc failed"
238 # atlas specific doc (blas generic docs installed by blas-docs)
239 if use doc; then
240 insinto /usr/share/doc/${PF}
241 doins atlas*pdf cblasqref.pdf || die "doins docs failed"
242 fi
243 }
244
245 pkg_postinst() {
246 for p in blas cblas; do
247 local current_p=$(eselect ${p} show | cut -d' ' -f2)
248 # this snippet works around the eselect bug #189942 and makes
249 # sure that users upgrading from a previous blas-atlas
250 # version pick up the new pkg-config files
251 if [[ ${current_p} == ${ESELECT_PROF} \
252 || ${current_p} == "threaded-atlas" \
253 || -z ${current_p} ]]; then
254 local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
255 [[ -e ${configfile} ]] && rm -f ${configfile}
256 eselect ${p} set ${ESELECT_PROF}
257 elog "${p} has been eselected to ${ESELECT_PROF}"
258 else
259 elog "Current eselected ${p} is ${current_p}"
260 elog "To use the ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
261 elog "\t eselect ${p} set ${ESELECT_PROF}"
262 fi
263 done
264 }

  ViewVC Help
Powered by ViewVC 1.1.20