1 |
commit: a534f20b54b267ea9726ee4de3f9796b75159239 |
2 |
Author: Sébastien Fabbro <bicatali <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 9 18:50:21 2013 +0000 |
4 |
Commit: Sebastien Fabbro <bicatali <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Dec 9 18:50:21 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=a534f20b |
7 |
|
8 |
Bump with lapack-3.5 |
9 |
|
10 |
--- |
11 |
sci-libs/atlas/atlas-3.10.1-r2.ebuild | 270 ++++++++++++++++++++++++++++++++++ |
12 |
1 file changed, 270 insertions(+) |
13 |
|
14 |
diff --git a/sci-libs/atlas/atlas-3.10.1-r2.ebuild b/sci-libs/atlas/atlas-3.10.1-r2.ebuild |
15 |
new file mode 100644 |
16 |
index 0000000..f241af0 |
17 |
--- /dev/null |
18 |
+++ b/sci-libs/atlas/atlas-3.10.1-r2.ebuild |
19 |
@@ -0,0 +1,270 @@ |
20 |
+# Copyright 1999-2013 Gentoo Foundation |
21 |
+# Distributed under the terms of the GNU General Public License v2 |
22 |
+# $Header: $ |
23 |
+ |
24 |
+EAPI=5 |
25 |
+ |
26 |
+FORTRAN_NEEDED=fortran |
27 |
+inherit eutils toolchain-funcs fortran-2 versionator alternatives-2 multilib |
28 |
+ |
29 |
+LAPACKP=lapack-3.5.0.tgz |
30 |
+ |
31 |
+DESCRIPTION="Automatically Tuned Linear Algebra Software" |
32 |
+HOMEPAGE="http://math-atlas.sourceforge.net/" |
33 |
+SRC_URI="mirror://sourceforge/math-atlas/${PN}${PV}.tar.bz2 |
34 |
+ fortran? ( lapack? ( http://www.netlib.org/lapack/${LAPACKP} ) )" |
35 |
+ |
36 |
+LICENSE="BSD" |
37 |
+SLOT="0" |
38 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
39 |
+IUSE="fortran doc generic lapack static-libs threads" |
40 |
+ |
41 |
+RDEPEND="" |
42 |
+DEPEND="${RDEPEND}" |
43 |
+ |
44 |
+S="${WORKDIR}/ATLAS" |
45 |
+ |
46 |
+pkg_setup() { |
47 |
+ local _cpufreq |
48 |
+ for _cpufreq in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do |
49 |
+ if [ -f ${_cpufreq} ]; then |
50 |
+ if grep -q performance ${_cpufreq}; then |
51 |
+ echo 2> /dev/null performance > ${_cpufreq} || \ |
52 |
+ die "${PN} needs all cpu set to performance" |
53 |
+ fi |
54 |
+ fi |
55 |
+ done |
56 |
+ use fortran && fortran-2_pkg_setup |
57 |
+} |
58 |
+ |
59 |
+src_prepare() { |
60 |
+ epatch "${FILESDIR}"/${PN}-3.10.0-x32-support.patch |
61 |
+} |
62 |
+ |
63 |
+src_configure() { |
64 |
+ # hack needed to trick the flaky gcc detection |
65 |
+ local mycc="$(type -P $(tc-getCC))" |
66 |
+ [[ ${mycc} == *gcc* ]] && mycc=gcc |
67 |
+ atlas_configure() { |
68 |
+ local myconf=( |
69 |
+ --prefix="${ED}/usr" |
70 |
+ --libdir="${ED}/usr/$(get_libdir)" |
71 |
+ --incdir="${ED}/usr/include" |
72 |
+ --cc="$(tc-getCC)" |
73 |
+ "-D c -DWALL" |
74 |
+ "-C acg '${mycc}'" |
75 |
+ "-F acg '${CFLAGS}'" |
76 |
+ "-Ss pmake '\$(MAKE) ${MAKEOPTS}'" |
77 |
+ ) |
78 |
+ |
79 |
+ # OpenMP shown to decreased performance over POSIX threads |
80 |
+ # (at least in 3.9.x, see atlas-dev mailing list) |
81 |
+ if use threads; then |
82 |
+ if use generic; then # 2 threads is most generic |
83 |
+ myconf+=( "-t 2" "-Si omp 0" ) |
84 |
+ else |
85 |
+ myconf+=( "-t -1" "-Si omp 0" ) |
86 |
+ fi |
87 |
+ else |
88 |
+ myconf+=( "-t 0" "-Si omp 0" ) |
89 |
+ fi |
90 |
+ |
91 |
+ if use amd64 || use ppc64 || use sparc; then |
92 |
+ if [ ${ABI} = amd64 ] || [ ${ABI} = ppc64 ] || [ ${ABI} = sparc64 ] ; then |
93 |
+ myconf+=( "-b 64" ) |
94 |
+ elif [ ${ABI} = x86 ] || [ ${ABI} = ppc ] || [ ${ABI} = sparc32 ] ; then |
95 |
+ myconf+=( "-b 32" ) |
96 |
+ elif [ ${ABI} = x32 ] ; then |
97 |
+ myconf+=( "-b 48" ) |
98 |
+ else |
99 |
+ myconf+=( "-b 64" ) |
100 |
+ fi |
101 |
+ elif use ppc || use x86; then |
102 |
+ myconf+=( "-b 32" ) |
103 |
+ elif use ia64; then |
104 |
+ myconf+=( "-b 64" ) |
105 |
+ fi |
106 |
+ if use fortran; then |
107 |
+ myconf+=( |
108 |
+ "-C if '$(type -P $(tc-getFC))'" |
109 |
+ "-F if '${FFLAGS}'" |
110 |
+ ) |
111 |
+ if use lapack; then |
112 |
+ myconf+=( |
113 |
+ "-Si latune 1" |
114 |
+ "--with-netlib-lapack-tarfile=${DISTDIR}/${LAPACKP}" |
115 |
+ ) |
116 |
+ else |
117 |
+ myconf+=( "-Si latune 0" ) |
118 |
+ fi |
119 |
+ else |
120 |
+ myconf+=( "-Si latune 0" "--nof77" ) |
121 |
+ fi |
122 |
+ # generic stuff found by make make xprint_enums in atlas build dir |
123 |
+ # basically assuming sse2+sse1 and 2 threads max |
124 |
+ use generic && use x86 && myconf+=( "-V 384 -A 13") |
125 |
+ use generic && use amd64 && myconf+=( "-V 384 -A 24") |
126 |
+ |
127 |
+ local confdir="${S}_${1}"; shift |
128 |
+ myconf+=( $@ ) |
129 |
+ mkdir "${confdir}" && cd "${confdir}" |
130 |
+ # for debugging |
131 |
+ echo ${myconf[@]} > myconf.out |
132 |
+ "${S}"/configure ${myconf[@]} || die "configure in ${confdir} failed" |
133 |
+ } |
134 |
+ |
135 |
+ atlas_configure shared "-Fa alg -fPIC" ${EXTRA_ECONF} |
136 |
+ use static-libs && atlas_configure static ${EXTRA_ECONF} |
137 |
+} |
138 |
+ |
139 |
+src_compile() { |
140 |
+ atlas_compile() { |
141 |
+ pushd "${S}_${1}" > /dev/null |
142 |
+ # atlas does its own parallel builds |
143 |
+ emake -j1 build |
144 |
+ cd lib |
145 |
+ emake libclapack.a |
146 |
+ [[ -e libptcblas.a ]] && emake libptclapack.a |
147 |
+ popd > /dev/null |
148 |
+ } |
149 |
+ |
150 |
+ atlas_compile shared |
151 |
+ use static-libs && atlas_compile static |
152 |
+} |
153 |
+ |
154 |
+src_test() { |
155 |
+ cd "${S}_shared" |
156 |
+ emake -j1 check time |
157 |
+} |
158 |
+ |
159 |
+# transform a static archive into a shared library and install them |
160 |
+# atlas_install_libs <mylib.a> [extra link flags] |
161 |
+atlas_install_libs() { |
162 |
+ local libname=$(basename ${1%.*}) |
163 |
+ einfo "Installing ${libname}" |
164 |
+ local soname=${libname}.so.$(get_major_version) |
165 |
+ shift |
166 |
+ pushd "${S}_shared"/lib > /dev/null |
167 |
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} -shared -Wl,-soname=${soname} \ |
168 |
+ -Wl,--whole-archive ${libname}.a -Wl,--no-whole-archive \ |
169 |
+ "$@" -o ${soname} || die "Creating ${soname} failed" |
170 |
+ dolib.so ${soname} |
171 |
+ ln -s ${soname} ${soname%.*} |
172 |
+ dosym ${soname} /usr/$(get_libdir)/${soname%.*} |
173 |
+ popd > /dev/null |
174 |
+ use static-libs && dolib.a "${S}_static"/lib/${libname}.a |
175 |
+} |
176 |
+ |
177 |
+# create and install a pkgconfig file |
178 |
+# atlas_install_pc <libname> <pkg name> [extra link flags] |
179 |
+atlas_install_pc() { |
180 |
+ local libname=${1} ; shift |
181 |
+ local pcname=${1} ; shift |
182 |
+ cat <<-EOF > ${pcname}.pc |
183 |
+ prefix=${EPREFIX}/usr |
184 |
+ libdir=\${prefix}/$(get_libdir) |
185 |
+ includedir=\${prefix}/include |
186 |
+ Name: ${pcname} |
187 |
+ Description: ${PN} ${pcname} |
188 |
+ Version: ${PV} |
189 |
+ URL: ${HOMEPAGE} |
190 |
+ Libs: -L\${libdir} -l${libname} $@ |
191 |
+ Libs.private: -L\${libdir} -latlas -lm ${PTLIBS} |
192 |
+ Cflags: -I\${includedir}/${PN} |
193 |
+ ${PCREQ} |
194 |
+ EOF |
195 |
+ insinto /usr/$(get_libdir)/pkgconfig |
196 |
+ doins ${pcname}.pc |
197 |
+} |
198 |
+ |
199 |
+src_install() { |
200 |
+ cd "${S}_shared/lib" |
201 |
+ # rename to avoid collision with other packages |
202 |
+ local l |
203 |
+ for l in {,c}{blas,lapack}; do |
204 |
+ if [[ -e lib${l}.a ]]; then |
205 |
+ mv lib{,atl}${l}.a |
206 |
+ use static-libs && mv "${S}"_static/lib/lib{,atl}${l}.a |
207 |
+ fi |
208 |
+ done |
209 |
+ |
210 |
+ [[ -e libptcblas.a ]] && PTLIBS="-lpthread" |
211 |
+ |
212 |
+ # atlas |
213 |
+ atlas_install_libs libatlas.a -lm ${PTLIBS} |
214 |
+ |
215 |
+ # cblas |
216 |
+ atlas_install_libs libatlcblas.a -lm -L. -latlas |
217 |
+ atlas_install_pc atlcblas atlas-cblas |
218 |
+ alternatives_for cblas atlas 0 \ |
219 |
+ /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas.pc \ |
220 |
+ /usr/include/cblas.h atlas/cblas.h |
221 |
+ |
222 |
+ # cblas threaded |
223 |
+ if [[ -e libptcblas.a ]]; then |
224 |
+ atlas_install_libs libptcblas.a -lm -L. -latlas ${PTLIBS} |
225 |
+ atlas_install_pc ptcblas atlas-cblas-threads |
226 |
+ alternatives_for cblas atlas-threads 0 \ |
227 |
+ /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas-threads.pc \ |
228 |
+ /usr/include/cblas.h atlas/cblas.h |
229 |
+ fi |
230 |
+ |
231 |
+ if use lapack; then |
232 |
+ PCREQ="Requires: cblas" |
233 |
+ # clapack |
234 |
+ atlas_install_libs libatlclapack.a -lm -L. -latlas -latlcblas |
235 |
+ atlas_install_pc atlclapack atlas-clapack |
236 |
+ |
237 |
+ # clapack threaded |
238 |
+ if [[ -e libptclapack.a ]]; then |
239 |
+ atlas_install_libs libptclapack.a -lm -L. -latlas -lptcblas ${PTLIBS} |
240 |
+ atlas_install_pc ptclapack atlas-clapack-threads |
241 |
+ fi |
242 |
+ fi |
243 |
+ |
244 |
+ if use fortran; then |
245 |
+ LINK=$(tc-getF77) PCREQ= |
246 |
+ |
247 |
+ # blas |
248 |
+ atlas_install_libs libf77blas.a -lm -L. -latlas |
249 |
+ atlas_install_pc f77blas atlas-blas |
250 |
+ alternatives_for blas atlas 0 \ |
251 |
+ /usr/$(get_libdir)/pkgconfig/blas.pc atlas-blas.pc |
252 |
+ |
253 |
+ # blas threaded |
254 |
+ if [[ -e libptf77blas.a ]]; then |
255 |
+ atlas_install_libs libptf77blas.a -lm -L. -latlas ${PTLIBS} |
256 |
+ atlas_install_pc ptf77blas atlas-blas-threads |
257 |
+ alternatives_for blas atlas-threads 0 \ |
258 |
+ /usr/$(get_libdir)/pkgconfig/blas.pc atlas-blas-threads.pc |
259 |
+ fi |
260 |
+ |
261 |
+ if use lapack; then |
262 |
+ PCREQ="Requires: blas cblas" |
263 |
+ # lapack |
264 |
+ atlas_install_libs libatllapack.a \ |
265 |
+ -lm -L. -latlas -latlcblas -lf77blas |
266 |
+ atlas_install_pc atllapack atlas-lapack |
267 |
+ alternatives_for lapack atlas 0 \ |
268 |
+ /usr/$(get_libdir)/pkgconfig/lapack.pc atlas-lapack.pc |
269 |
+ # lapack threaded |
270 |
+ if [[ -e libptlapack.a ]]; then |
271 |
+ atlas_install_libs libptlapack.a \ |
272 |
+ -lm -L. -latlas -lptcblas -lptf77blas ${PTLIBS} |
273 |
+ atlas_install_pc ptlapack atlas-lapack-threads |
274 |
+ alternatives_for lapack atlas-threads 0 \ |
275 |
+ /usr/$(get_libdir)/pkgconfig/lapack.pc atlas-lapack-threads.pc |
276 |
+ fi |
277 |
+ fi |
278 |
+ fi |
279 |
+ |
280 |
+ cd "${S}" |
281 |
+ insinto /usr/include/${PN} |
282 |
+ doins include/*.h |
283 |
+ |
284 |
+ cd "${S}/doc" |
285 |
+ dodoc INDEX.txt AtlasCredits.txt ChangeLog |
286 |
+ use doc && dodoc atlas*pdf cblas.pdf cblasqref.pdf |
287 |
+ use doc && use fortran && dodoc f77blas*pdf |
288 |
+ use doc && use fortran && use lapack && dodoc *lapack*pdf |
289 |
+} |