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

Contents of /sci-libs/blas-atlas/blas-atlas-3.9.23-r2.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 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-r2.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"
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
33 pkg_setup() {
34 fortran-2_pkg_setup
35 # icc won't compile (as of icc-10.0.026)
36 # and will blow out $PORTAGE_TMPDIR
37 if [[ $(tc-getCC) = icc* ]]; then
38 eerror "icc compiler is not supported with sci-libs/blas-atlas"
39 die "blas-atlas won't compile with icc"
40 fi
41
42 echo
43 ewarn "Please make sure to disable CPU throttling completely"
44 ewarn "during the compile of blas-atlas. Otherwise, all atlas"
45 ewarn "generated timings will be completely random and the"
46 ewarn "performance of the resulting libraries will be degraded"
47 ewarn "considerably."
48 echo
49 ewarn "For users of <=gcc-4.1 only:"
50 ewarn "If you experience failing SANITY tests during"
51 ewarn "atlas' compile please try passing -mfpmath=387; this"
52 ewarn "option might also result in much better performance"
53 ewarn "than using then sse instruction set depending on your"
54 ewarn "CPU."
55 echo
56 ewarn "If blas-atlas fails during linking with a message"
57 ewarn "'relocation R_X86_64_32 .... recompile with -fPIC.'"
58 ewarn "please re-emerge libtool and then try again."
59 echo
60 }
61
62 src_prepare() {
63 epatch "${DISTDIR}"/${MY_PN}-${PATCH_V}-shared-libs.2.patch.bz2
64 epatch "${FILESDIR}"/${MY_PN}-${PV}-ger-fix.patch
65 epatch "${FILESDIR}"/${MY_PN}-asm-gentoo.patch
66
67 cp "${FILESDIR}"/eselect.{,c}blas.{,threaded-}atlas "${T}"/
68 sed -i -e "s:/usr:${EPREFIX}/usr:" \
69 "${T}"/eselect.{,c}blas.{,threaded-}atlas || die
70 if [[ ${CHOST} == *-darwin* ]] ; then
71 sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
72 "${T}"/eselect.{,c}blas.{,threaded-}atlas || die
73 sed -e /LIBTOOL/s/libtool/glibtool/ -i CONFIG/src/SpewMakeInc.c
74 epatch "${FILESDIR}"/${PN}-3.9.3-darwin-make-top.patch
75 fi
76
77 mkdir "${BLD_DIR}" || die "failed to generate build directory"
78 cd "${BLD_DIR}"
79 cp "${FILESDIR}"/war . && chmod a+x war || die "failed to install war"
80 sed -i -e '1c\#!'"${EPREFIX}"'/bin/bash' war || die
81 }
82
83 src_configure() {
84 cd "${BLD_DIR}"
85 local archselect=
86 if use amd64 || use ppc64; then
87 archselect="-b 64"
88 elif use alpha; then
89 archselect=""
90 else
91 archselect="-b 32"
92 fi
93
94 # Remove -m64 on alpha, since the compiler doesn't support it
95 use alpha && sed -i -e 's/-m64//g' "${S}"/CONFIG/src/probe_comp.c
96
97 # unfortunately, atlas-3.9.0 chokes when passed
98 # x86_64-pc-linux-gnu-gcc and friends instead of
99 # plain gcc. Hence, we'll have to workaround this
100 # until it is fixed by upstream
101 local c_compiler=$(tc-getCC)
102 if [[ "${c_compiler}" == *gcc* ]]; then
103 c_compiler="gcc"
104 fi
105
106 ../configure \
107 --cc="${c_compiler}" \
108 --cflags="${CFLAGS}" \
109 --prefix="${ED}/${DESTTREE}" \
110 --libdir="${ED}/${DESTTREE}"/$(get_libdir)/atlas \
111 --incdir="${ED}/${DESTTREE}"/include \
112 -C ac "${c_compiler}" -F ac "${CFLAGS}" \
113 -C if $(tc-getFC) -F if "${FFLAGS:-'-O2'}" \
114 -Ss pmake "\$(MAKE) ${MAKEOPTS}" \
115 -Si cputhrchk 0 ${archselect} \
116 || die "configure failed"
117
118 # fix LDFLAGS
119 sed -e "s|LDFLAGS =.*|LDFLAGS = ${LDFLAGS}|" \
120 -i "${BLD_DIR}"/Make.inc
121 }
122
123 src_compile() {
124 cd "${BLD_DIR}"
125
126 # atlas does its own parallel builds
127 # — and it fails parallel make, bug #294172
128 emake -j1 || die "emake failed"
129
130 RPATH="${DESTTREE}"/$(get_libdir)/blas
131 emake -j1 \
132 LIBDIR=$(get_libdir) \
133 RPATH="${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="${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}/${DESTTREE}"/$(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 "${DESTTREE}"/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 # some docs
228 cd "${S}"/doc
229 dodoc INDEX.txt AtlasCredits.txt ChangeLog || die "dodoc failed"
230 # atlas specific doc (blas generic docs installed by blas-docs)
231 if use doc; then
232 insinto /usr/share/doc/${PF}
233 doins atlas*pdf cblasqref.pdf || die "doins docs failed"
234 fi
235 }
236
237 pkg_postinst() {
238 for p in blas cblas; do
239 local current_p=$(eselect ${p} show | cut -d' ' -f2)
240 # this snippet works around the eselect bug #189942 and makes
241 # sure that users upgrading from a previous blas-atlas
242 # version pick up the new pkg-config files
243 if [[ ${current_p} == ${ESELECT_PROF} \
244 || ${current_p} == "threaded-atlas" \
245 || -z ${current_p} ]]; then
246 local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
247 [[ -e ${configfile} ]] && rm -f ${configfile}
248 eselect ${p} set ${ESELECT_PROF}
249 elog "${p} has been eselected to ${ESELECT_PROF}"
250 else
251 elog "Current eselected ${p} is ${current_p}"
252 elog "To use the ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
253 elog "\t eselect ${p} set ${ESELECT_PROF}"
254 fi
255 done
256 }

  ViewVC Help
Powered by ViewVC 1.1.20