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

Contents of /sci-libs/blas-atlas/blas-atlas-3.9.21-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20