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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20