1 |
commit: 248cdac8246c9b43b970bca62e4ea70808c47cb1 |
2 |
Author: Gergely Nagy <ngg <AT> tresorit <DOT> com> |
3 |
AuthorDate: Mon Jun 26 10:49:26 2017 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 27 09:49:39 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=248cdac8 |
7 |
|
8 |
sci-libs/atlas: version bump to 3.11.39 |
9 |
|
10 |
Patch from upstream is required to build the shared library: |
11 |
https://sourceforge.net/p/math-atlas/bugs/260/ |
12 |
Closes: https://github.com/gentoo/sci/pull/794 |
13 |
|
14 |
sci-libs/atlas/atlas-3.11.39.ebuild | 285 +++++++++++++++++++++ |
15 |
.../atlas/files/atlas-3.11.39-dolastcomp.patch | 13 + |
16 |
2 files changed, 298 insertions(+) |
17 |
|
18 |
diff --git a/sci-libs/atlas/atlas-3.11.39.ebuild b/sci-libs/atlas/atlas-3.11.39.ebuild |
19 |
new file mode 100644 |
20 |
index 000000000..f4b65140c |
21 |
--- /dev/null |
22 |
+++ b/sci-libs/atlas/atlas-3.11.39.ebuild |
23 |
@@ -0,0 +1,285 @@ |
24 |
+# Copyright 1999-2017 Gentoo Foundation |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=6 |
28 |
+ |
29 |
+FORTRAN_NEEDED=fortran |
30 |
+ |
31 |
+inherit alternatives-2 eutils fortran-2 linux-info multilib numeric toolchain-funcs versionator |
32 |
+ |
33 |
+LAPACKP=lapack-3.7.0.tgz |
34 |
+ |
35 |
+DESCRIPTION="Automatically Tuned Linear Algebra Software" |
36 |
+HOMEPAGE="http://math-atlas.sourceforge.net/" |
37 |
+SRC_URI="mirror://sourceforge/math-atlas/${PN}${PV}.tar.bz2 |
38 |
+ fortran? ( lapack? ( http://www.netlib.org/lapack/${LAPACKP} ) )" |
39 |
+ |
40 |
+LICENSE="BSD" |
41 |
+SLOT="0" |
42 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
43 |
+IUSE="+deprecated doc +fortran generic ifko +lapack static-libs threads" |
44 |
+ |
45 |
+REQUIRED_USE=" |
46 |
+ deprecated? ( lapack ) |
47 |
+ lapack? ( fortran )" |
48 |
+ |
49 |
+S="${WORKDIR}/ATLAS" |
50 |
+ |
51 |
+PATCHES=( |
52 |
+ "${FILESDIR}"/${P}-dolastcomp.patch |
53 |
+) |
54 |
+ |
55 |
+pkg_setup() { |
56 |
+ local _cpufreq |
57 |
+ for _cpufreq in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do |
58 |
+ if [ -f ${_cpufreq} ]; then |
59 |
+ if ! grep -q performance ${_cpufreq}; then |
60 |
+ echo 2> /dev/null performance > ${_cpufreq} || \ |
61 |
+ die "${PN} needs all cpu set to performance" |
62 |
+ fi |
63 |
+ fi |
64 |
+ done |
65 |
+ [[ -e /sys/devices/system/cpu/intel_pstate ]] \ |
66 |
+ && die "Intel P-State driver detected. Please reboot with 'intel_pstate=disable' in your cmdline" |
67 |
+ use fortran && fortran-2_pkg_setup |
68 |
+ CONFIG_CHECK=" |
69 |
+ !~X86_P4_CLOCKMOD |
70 |
+ !~X86_INTEL_PSTATE |
71 |
+ " |
72 |
+ ERROR_KERNEL_X86_P4_CLOCKMOD="P4 Clockmod frequency scaling influences tuning and needs to be disabled at compile time." |
73 |
+ ERROR_KERNEL_X86_INTEL_PSTATE="Intel Pstate frequency scaling influences tuning and needs to be disabled at compile time." |
74 |
+ linux-info_pkg_setup |
75 |
+} |
76 |
+ |
77 |
+src_configure() { |
78 |
+ # hack needed to trick the flaky gcc detection |
79 |
+ local mycc="$(type -P $(tc-getCC))" |
80 |
+ [[ ${mycc} == *gcc* ]] && mycc=gcc |
81 |
+ atlas_configure() { |
82 |
+ local myconf=( |
83 |
+ --prefix="${ED}/usr" |
84 |
+ --libdir="${ED}/usr/$(get_libdir)" |
85 |
+ --incdir="${ED}/usr/include" |
86 |
+ --cc="$(tc-getCC)" |
87 |
+ "-D c -DWALL" |
88 |
+ "-C acg '${mycc}'" |
89 |
+ "-F acg '${CFLAGS}'" |
90 |
+ "-Ss pmake '\$(MAKE) ${MAKEOPTS}'" |
91 |
+ ) |
92 |
+ |
93 |
+ # OpenMP shown to decreased performance over POSIX threads |
94 |
+ # (at least in 3.9.x, see atlas-dev mailing list) |
95 |
+ if use threads; then |
96 |
+ if use generic; then # 2 threads is most generic |
97 |
+ myconf+=( "-t 2" "-Si omp 0" ) |
98 |
+ else |
99 |
+ myconf+=( "-t -1" "-Si omp 0" ) |
100 |
+ fi |
101 |
+ else |
102 |
+ myconf+=( "-t 0" "-Si omp 0" ) |
103 |
+ fi |
104 |
+ |
105 |
+ if use amd64 || use ppc64 || use sparc; then |
106 |
+ if [ ${ABI} = amd64 ] || [ ${ABI} = ppc64 ] || [ ${ABI} = sparc64 ] ; then |
107 |
+ myconf+=( "-b 64" ) |
108 |
+ elif [ ${ABI} = x86 ] || [ ${ABI} = ppc ] || [ ${ABI} = sparc32 ] ; then |
109 |
+ myconf+=( "-b 32" ) |
110 |
+ elif [ ${ABI} = x32 ] ; then |
111 |
+ myconf+=( "-b 48" ) |
112 |
+ else |
113 |
+ myconf+=( "-b 64" ) |
114 |
+ fi |
115 |
+ elif use ppc || use x86; then |
116 |
+ myconf+=( "-b 32" ) |
117 |
+ elif use ia64; then |
118 |
+ myconf+=( "-b 64" ) |
119 |
+ fi |
120 |
+ if use fortran; then |
121 |
+ myconf+=( |
122 |
+ "-C if '$(type -P $(tc-getFC))'" |
123 |
+ "-F if '${FFLAGS}'" |
124 |
+ ) |
125 |
+ if use lapack; then |
126 |
+ myconf+=( |
127 |
+ "-Si latune 1" |
128 |
+ "--with-netlib-lapack-tarfile=${DISTDIR}/${LAPACKP}" |
129 |
+ ) |
130 |
+ else |
131 |
+ myconf+=( "-Si latune 0" ) |
132 |
+ fi |
133 |
+ else |
134 |
+ myconf+=( "-Si latune 0" "--nof77" ) |
135 |
+ fi |
136 |
+ # generic stuff found by make make xprint_enums in atlas build dir |
137 |
+ # basically assuming sse2+sse1 and 2 threads max |
138 |
+ use generic && use x86 && myconf+=( "-V 384 -A 13") |
139 |
+ use generic && use amd64 && myconf+=( "-V 384 -A 24") |
140 |
+ |
141 |
+ local confdir="${S}_${1}"; shift |
142 |
+ myconf+=( $(usex ifko "--use-ifko" "") ) |
143 |
+ myconf+=( $@ ) |
144 |
+ mkdir "${confdir}" && cd "${confdir}" || die |
145 |
+ # for debugging |
146 |
+ echo ${myconf[@]} > myconf.out |
147 |
+ "${S}"/configure ${myconf[@]} || die "configure in ${confdir} failed" |
148 |
+ |
149 |
+ if use deprecated; then |
150 |
+ echo "BUILD_DEPRECATED=1" >> src/lapack/reference/make.inc.example || die |
151 |
+ fi |
152 |
+ } |
153 |
+ |
154 |
+ atlas_configure shared "-Fa alg -fPIC" ${EXTRA_ECONF} |
155 |
+ use static-libs && atlas_configure static ${EXTRA_ECONF} |
156 |
+} |
157 |
+ |
158 |
+src_compile() { |
159 |
+ atlas_compile() { |
160 |
+ pushd "${S}_${1}" > /dev/null || die |
161 |
+ # atlas does its own parallel builds |
162 |
+ emake -j1 build |
163 |
+ cd lib || die |
164 |
+ emake libclapack.a |
165 |
+ [[ -e libptcblas.a ]] && emake libptclapack.a |
166 |
+ popd > /dev/null || die |
167 |
+ } |
168 |
+ |
169 |
+ atlas_compile shared |
170 |
+ use static-libs && atlas_compile static |
171 |
+} |
172 |
+ |
173 |
+src_test() { |
174 |
+ cd "${S}_shared" || die |
175 |
+ emake -j1 check time |
176 |
+} |
177 |
+ |
178 |
+# transform a static archive into a shared library and install them |
179 |
+# atlas_install_libs <mylib.a> [extra link flags] |
180 |
+atlas_install_libs() { |
181 |
+ local libname=$(basename ${1%.*}) |
182 |
+ einfo "Installing ${libname}" |
183 |
+ local soname=${libname}.so.$(get_major_version) |
184 |
+ local _cmd |
185 |
+ shift |
186 |
+ pushd "${S}_shared"/lib > /dev/null |
187 |
+ _cmd="${LINK:-$(tc-getCC)}" |
188 |
+ _cmd+=" ${LDFLAGS} -shared -Wl,--no-undefined -Wl,-soname=${soname}" |
189 |
+ _cmd+=" -Wl,--whole-archive ${libname}.a -Wl,--no-whole-archive" |
190 |
+ _cmd+=" $@ -o ${soname}" |
191 |
+ einfo "${_cmd}" |
192 |
+ ${_cmd} || die "Creating ${soname} failed" |
193 |
+ dolib.so ${soname} |
194 |
+ dosym ${soname} /usr/$(get_libdir)/${soname%.*} |
195 |
+ popd > /dev/null || die |
196 |
+ use static-libs && dolib.a "${S}_static"/lib/${libname}.a |
197 |
+} |
198 |
+ |
199 |
+# create and install a pkgconfig file |
200 |
+# atlas_install_pc <libname> <pkg name> [extra link flags] |
201 |
+atlas_install_pc() { |
202 |
+ local libname=${1} ; shift |
203 |
+ local pcname=${1} ; shift |
204 |
+ local extra=() |
205 |
+ [[ ${PCREQ} ]] && extra+=( --requires "${PCREQ}" ) |
206 |
+ create_pkgconfig \ |
207 |
+ --name "${pcname}" \ |
208 |
+ --description "${PN} ${pcname}" \ |
209 |
+ --libs "-L\${libdir} -l${libname} $@" \ |
210 |
+ --libs-private "-L\${libdir} -latlas -lm ${PTLIBS}" \ |
211 |
+ --cflags "-I\${includedir}/${PN}" \ |
212 |
+ "${extra[@]}" \ |
213 |
+ ${pcname} |
214 |
+} |
215 |
+ |
216 |
+src_install() { |
217 |
+ cd "${S}_shared/lib" || die |
218 |
+ # rename to avoid collision with other packages |
219 |
+ local l |
220 |
+ for l in {,c}{blas,lapack}; do |
221 |
+ if [[ -e lib${l}.a ]]; then |
222 |
+ mv lib{,atl}${l}.a || die |
223 |
+ if use static-libs; then |
224 |
+ mv "${S}"_static/lib/lib{,atl}${l}.a || die |
225 |
+ fi |
226 |
+ fi |
227 |
+ done |
228 |
+ |
229 |
+ [[ -e libptcblas.a ]] && PTLIBS="-lpthread" |
230 |
+ |
231 |
+ # atlas |
232 |
+ atlas_install_libs libatlas.a -lm ${PTLIBS} |
233 |
+ |
234 |
+ # cblas |
235 |
+ atlas_install_libs libatlcblas.a -L. -latlas -lm |
236 |
+ atlas_install_pc atlcblas atlas-cblas |
237 |
+ alternatives_for cblas atlas 0 \ |
238 |
+ /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas.pc \ |
239 |
+ /usr/include/cblas.h atlas/cblas.h |
240 |
+ |
241 |
+ # cblas threaded |
242 |
+ if [[ -e libptcblas.a ]]; then |
243 |
+ atlas_install_libs libptcblas.a -L. -latlas -lm ${PTLIBS} |
244 |
+ atlas_install_pc ptcblas atlas-cblas-threads |
245 |
+ alternatives_for cblas atlas-threads 0 \ |
246 |
+ /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas-threads.pc \ |
247 |
+ /usr/include/cblas.h atlas/cblas.h |
248 |
+ fi |
249 |
+ |
250 |
+ if use lapack; then |
251 |
+ PCREQ="cblas" |
252 |
+ # clapack |
253 |
+ atlas_install_libs libatlclapack.a -L. -latlcblas -latlas -lm |
254 |
+ atlas_install_pc atlclapack atlas-clapack |
255 |
+ |
256 |
+ # clapack threaded |
257 |
+ if [[ -e libptclapack.a ]]; then |
258 |
+ atlas_install_libs libptclapack.a -L. -lptcblas -latlas -lm ${PTLIBS} |
259 |
+ atlas_install_pc ptclapack atlas-clapack-threads |
260 |
+ fi |
261 |
+ fi |
262 |
+ |
263 |
+ if use fortran; then |
264 |
+ LINK=$(tc-getF77) PCREQ= |
265 |
+ |
266 |
+ # blas |
267 |
+ atlas_install_libs libf77blas.a -L. -latlas -lm |
268 |
+ atlas_install_pc f77blas atlas-blas |
269 |
+ alternatives_for blas atlas 0 \ |
270 |
+ /usr/$(get_libdir)/pkgconfig/blas.pc atlas-blas.pc |
271 |
+ |
272 |
+ # blas threaded |
273 |
+ if [[ -e libptf77blas.a ]]; then |
274 |
+ atlas_install_libs libptf77blas.a -L. -latlas -lm ${PTLIBS} |
275 |
+ atlas_install_pc ptf77blas atlas-blas-threads |
276 |
+ alternatives_for blas atlas-threads 0 \ |
277 |
+ /usr/$(get_libdir)/pkgconfig/blas.pc atlas-blas-threads.pc |
278 |
+ fi |
279 |
+ |
280 |
+ if use lapack; then |
281 |
+ PCREQ="blas cblas" |
282 |
+ # lapack |
283 |
+ atlas_install_libs libatllapack.a \ |
284 |
+ -L. -latlcblas -lf77blas -latlas -lm |
285 |
+ atlas_install_pc atllapack atlas-lapack |
286 |
+ alternatives_for lapack atlas 0 \ |
287 |
+ /usr/$(get_libdir)/pkgconfig/lapack.pc atlas-lapack.pc |
288 |
+ # lapack threaded |
289 |
+ if [[ -e libptlapack.a ]]; then |
290 |
+ atlas_install_libs libptlapack.a \ |
291 |
+ -L. -lptcblas -lptf77blas -latlas -lm ${PTLIBS} |
292 |
+ atlas_install_pc ptlapack atlas-lapack-threads |
293 |
+ alternatives_for lapack atlas-threads 0 \ |
294 |
+ /usr/$(get_libdir)/pkgconfig/lapack.pc atlas-lapack-threads.pc |
295 |
+ fi |
296 |
+ fi |
297 |
+ fi |
298 |
+ |
299 |
+ cd "${S}" || die |
300 |
+ insinto /usr/include/${PN} |
301 |
+ doins include/*.h |
302 |
+ |
303 |
+ cd "${S}/doc" || die |
304 |
+ dodoc INDEX.txt AtlasCredits.txt ChangeLog |
305 |
+ use doc && dodoc atlas*pdf cblas.pdf cblasqref.pdf |
306 |
+ use doc && use fortran && dodoc f77blas*pdf |
307 |
+ use doc && use fortran && use lapack && dodoc *lapack*pdf |
308 |
+} |
309 |
|
310 |
diff --git a/sci-libs/atlas/files/atlas-3.11.39-dolastcomp.patch b/sci-libs/atlas/files/atlas-3.11.39-dolastcomp.patch |
311 |
new file mode 100644 |
312 |
index 000000000..3cd554cf4 |
313 |
--- /dev/null |
314 |
+++ b/sci-libs/atlas/files/atlas-3.11.39-dolastcomp.patch |
315 |
@@ -0,0 +1,13 @@ |
316 |
+diff --git a/src/threads/blas/level3/ATL_tammm_G.c b/src/threads/blas/level3/ATL_tammm_G.c |
317 |
+index a43a08b..77c78f4 100644 |
318 |
+--- a/src/threads/blas/level3/ATL_tammm_G.c |
319 |
++++ b/src/threads/blas/level3/ATL_tammm_G.c |
320 |
+@@ -479,7 +479,7 @@ static void DoCompNoCopy(ATL_tamm_gOOO_t *pd, ATL_UINT rank, TYPE *wC) |
321 |
+ #ifndef TCPLX |
322 |
+ #undef rC |
323 |
+ #endif |
324 |
+-void DoLastComp(ATL_tamm_gOOO_t *pd, ATL_UINT rank, TYPE *wC) |
325 |
++static void DoLastComp(ATL_tamm_gOOO_t *pd, ATL_UINT rank, TYPE *wC) |
326 |
+ { |
327 |
+ ipinfo_t *ip=pd->ip; |
328 |
+ TYPE *wA=pd->wA, *wB=pd->wB, *C=pd->C; |