Gentoo Archives: gentoo-commits

From: Andrea Arteaga <andyspiros@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/atlas/
Date: Tue, 06 Sep 2011 09:35:47
Message-Id: 6e6a77098abc7010371b288e67b17373264a8bf6.spiros@gentoo
1 commit: 6e6a77098abc7010371b288e67b17373264a8bf6
2 Author: Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
3 AuthorDate: Tue Sep 6 09:33:42 2011 +0000
4 Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
5 CommitDate: Tue Sep 6 09:33:42 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=6e6a7709
7
8 Version bump.
9
10 ---
11 sci-libs/atlas/ChangeLog | 5 +
12 sci-libs/atlas/atlas-3.9.49.ebuild | 267 ++++++++++++++++++++++++++++++++++++
13 2 files changed, 272 insertions(+), 0 deletions(-)
14
15 diff --git a/sci-libs/atlas/ChangeLog b/sci-libs/atlas/ChangeLog
16 index 88c9d4c..34bee8c 100644
17 --- a/sci-libs/atlas/ChangeLog
18 +++ b/sci-libs/atlas/ChangeLog
19 @@ -2,6 +2,11 @@
20 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
21 # $Header: $
22
23 +*atlas-3.9.49 (06 Sep 2001)
24 +
25 + 06 Sep 2011; Andrea Arteaga <andyspiros@×××××.com> +atlas-3.9.49.ebuild:
26 + Version bump
27 +
28 *atlas-3.8.4 (06 Aug 2011)
29
30 06 Aug 2011; Andrea Arteaga <andyspiros@×××××.com> +atlas-3.8.4.ebuild:
31
32 diff --git a/sci-libs/atlas/atlas-3.9.49.ebuild b/sci-libs/atlas/atlas-3.9.49.ebuild
33 new file mode 100644
34 index 0000000..86157c9
35 --- /dev/null
36 +++ b/sci-libs/atlas/atlas-3.9.49.ebuild
37 @@ -0,0 +1,267 @@
38 +# Copyright 1999-2011 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +# $Header: $
41 +
42 +EAPI=4
43 +inherit eutils toolchain-funcs versionator alternatives-2
44 +
45 +LAPACKP=lapack-3.3.1
46 +
47 +DESCRIPTION="Automatically Tuned Linear Algebra Software"
48 +HOMEPAGE="http://math-atlas.sourceforge.net/"
49 +SRC_URI="mirror://sourceforge/math-atlas/${PN}${PV}.tar.bz2
50 + fortran? ( lapack? ( http://www.netlib.org/lapack/${LAPACKP}.tgz ) )"
51 +
52 +LICENSE="BSD"
53 +SLOT="0"
54 +KEYWORDS="~amd64 ~x86 ~amd64-linux"
55 +IUSE="fortran doc lapack static-libs threads"
56 +
57 +RDEPEND="fortran? ( virtual/fortran )"
58 +DEPEND="${RDEPEND}
59 + !prefix? ( sys-power/cpufrequtils )"
60 +
61 +S="${WORKDIR}/ATLAS"
62 +
63 +atlas_configure() {
64 + local mycc="$(tc-getCC)"
65 + # http://sourceforge.net/tracker/?func=detail&aid=3301697&group_id=23725&atid=379483
66 + [[ ${mycc} == *gcc* ]] && mycc=gcc
67 + local myconf=(
68 + "--prefix=${ED}/usr"
69 + "--libdir=${ED}/usr/$(get_libdir)"
70 + "--incdir=${ED}/usr/include"
71 + "--cc=${mycc}"
72 + "-C ac ${mycc}"
73 + "-D c -DWALL"
74 + "-F ac '${CFLAGS}'"
75 + "-Ss pmake '\$(MAKE) ${MAKEOPTS}'"
76 + )
77 +
78 + # OpenMP shown to decreased performance over POSIX threads
79 + # (at least in 3.9.39, see atlas-dev mailing list)
80 + if use threads; then
81 + myconf+=( "-t -1" "-Si omp 0" )
82 + else
83 + myconf+=( "-t 0" "-Si omp 0" )
84 + fi
85 +
86 + if use amd64 || use ppc64 || use sparc; then
87 + if [ ${ABI} = amd64 ] || [ ${ABI} = ppc64 ] || [ ${ABI} = sparc64 ] ; then
88 + myconf+=( "-b 64" )
89 + elif [ ${ABI} = x86 ] || [ ${ABI} = ppc ] || [ ${ABI} = sparc32 ] ; then
90 + myconf+=( "-b 32" )
91 + else
92 + myconf+=( "-b 64" )
93 + fi
94 + elif use ppc || use x86; then
95 + myconf+=( "-b 32" )
96 + elif use ia64; then
97 + myconf+=( "-b 64" )
98 + else #hppa alpha ...
99 + myconf+=( "" )
100 + fi
101 + if use fortran; then
102 + myconf+=(
103 + "-C if $(tc-getFC)"
104 + "-F if '${FFLAGS}'"
105 + )
106 + if use lapack; then
107 + myconf+=(
108 + "-Si latune 1"
109 + "--with-netlib-lapack-tarfile=${DISTDIR}/${LAPACKP}.tgz"
110 + )
111 + else
112 + myconf+=( "-Si latune 0" )
113 + fi
114 + else
115 + myconf+=( "-Si latune 0" "--nof77" )
116 + fi
117 + local confdir="${S}_${1}"; shift
118 + myconf+=( $@ )
119 + mkdir "${confdir}" && cd "${confdir}"
120 + "${S}"/configure ${myconf[@]} || die "configure in ${confdir} failed"
121 +}
122 +
123 +atlas_compile() {
124 + pushd "${S}_${1}" > /dev/null
125 + # atlas does its own parallel builds
126 + emake -j1 build
127 + cd lib
128 + emake libclapack.a
129 + [[ -e libptcblas.a ]] && emake libptclapack.a
130 + popd > /dev/null
131 +}
132 +
133 +# transform a static archive into a shared library and install them
134 +# atlas_install_libs <mylib.a> [extra link flags]
135 +atlas_install_libs() {
136 + local libname=$(basename ${1%.*})
137 + einfo "Installing ${libname}"
138 + local soname=${libname}.so.$(get_major_version)
139 + shift
140 + pushd "${S}_shared"/lib > /dev/null
141 + ${LINK:-$(tc-getCC)} ${LDFLAGS} -shared -Wl,-soname=${soname} \
142 + -Wl,--whole-archive ${libname}.a -Wl,--no-whole-archive \
143 + "$@" -o ${soname} || die "Creating ${soname} failed"
144 + dolib.so ${soname}
145 + ln -s ${soname} ${soname%.*}
146 + dosym ${soname} /usr/$(get_libdir)/${soname%.*}
147 + popd > /dev/null
148 + use static-libs && dolib.a "${S}_static"/lib/${libname}.a
149 +}
150 +
151 +# create and install a pkgconfig file
152 +# atlas_install_pc <libname> <pkg name> [extra link flags]
153 +atlas_install_pc() {
154 + local libname=${1} ; shift
155 + local pcname=${1} ; shift
156 + cat <<-EOF > ${pcname}.pc
157 + prefix=${EPREFIX}/usr
158 + libdir=\${prefix}/$(get_libdir)
159 + includedir=\${prefix}/include
160 + Name: ${pcname}
161 + Description: ${PN} ${pcname}
162 + Version: ${PV}
163 + URL: ${HOMEPAGE}
164 + Libs: -L\${libdir} -l${libname} $@
165 + Cflags: -I\${includedir}/${PN}
166 + ${PCREQ}
167 + EOF
168 + insinto /usr/$(get_libdir)/pkgconfig
169 + doins ${pcname}.pc
170 +}
171 +
172 +pkg_setup() {
173 + if [[ -n $(type -P cpufreq-info) ]]; then
174 + [[ -z $(cpufreq-info -d) ]] && return
175 + local ncpu=$(LANG=C cpufreq-info | grep -c "analyzing CPU")
176 + local cpu=0
177 + while [[ ${cpu} -lt ${ncpu} ]]; do
178 + if ! $(LANG=C cpufreq-info -p -c ${cpu} | grep -q performance); then
179 + ewarn "CPU $cpu is not set to performance"
180 + ewarn "Run cpufreq-set -r -g performance as root"
181 + die "${PN} needs all cpu set to performance"
182 + fi
183 + cpu=$(( cpu + 1 ))
184 + done
185 + else
186 + ewarn "Please make sure to disable CPU throttling completely"
187 + ewarn "during the compile of ${PN}. Otherwise, all ${PN}"
188 + ewarn "generated timings will be completely random and the"
189 + ewarn "performance of the resulting libraries will be degraded"
190 + ewarn "considerably."
191 + fi
192 +}
193 +
194 +src_prepare() {
195 + epatch "${FILESDIR}"/3.9.39-bfr-overflow.patch
196 +}
197 +
198 +src_configure() {
199 + atlas_configure shared "-Fa alg -fPIC"
200 + use static-libs && atlas_configure static
201 +}
202 +
203 +src_compile() {
204 + atlas_compile shared
205 + use static-libs && atlas_compile static
206 +}
207 +
208 +src_test() {
209 + cd "${S}_shared"
210 + emake -j1 check
211 + emake -j1 time
212 +}
213 +
214 +src_install() {
215 + cd "${S}_shared/lib"
216 + # rename to avoid collision with other packages
217 + local l
218 + for l in {,c}{blas,lapack}; do
219 + if [[ -e lib${l}.a ]]; then
220 + mv lib{,atl}${l}.a
221 + use static-libs && mv "${S}"_static/lib/lib{,atl}${l}.a
222 + fi
223 + done
224 +
225 + [[ -e libptcblas.a ]] && PTLIBS="-lpthread"
226 +
227 + # atlas
228 + atlas_install_libs libatlas.a -lm ${PTLIBS}
229 +
230 + # cblas
231 + atlas_install_libs libatlcblas.a -lm -L. -latlas
232 + atlas_install_pc atlcblas atlas-cblas -lm -latlas
233 + alternatives_for cblas atlas 0 \
234 + /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas.pc \
235 + /usr/include/cblas.h atlas/cblas.h
236 +
237 + # cblas threaded
238 + if [[ -e libptcblas.a ]]; then
239 + atlas_install_libs libptcblas.a -lm -L. -latlas ${PTLIBS}
240 + atlas_install_pc ptcblas atlas-cblas-threads -lm -latlas ${PTLIBS}
241 + alternatives_for cblas atlas-threads 0 \
242 + /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas-threads.pc \
243 + /usr/include/cblas.h atlas/cblas.h
244 + fi
245 +
246 + if use lapack; then
247 + PCREQ="Requires: cblas"
248 + # clapack
249 + atlas_install_libs libatlclapack.a -lm -L. -latlas -latlcblas
250 + atlas_install_pc atlclapack atlas-clapack -lm -latlas
251 +
252 + # clapack threaded
253 + if [[ -e libptclapack.a ]]; then
254 + atlas_install_libs libptclapack.a -lm -L. -latlas -lptcblas ${PTLIBS}
255 + atlas_install_pc ptclapack atlas-clapack-threads -lm -latlas ${PTLIBS}
256 + fi
257 + fi
258 +
259 + if use fortran; then
260 + LINK=$(tc-getF77) PCREQ=
261 + # blas
262 + atlas_install_libs libf77blas.a -lm -L. -latlas
263 + atlas_install_pc f77blas atlas-blas -lm -latlas
264 + alternatives_for blas atlas 0 \
265 + /usr/$(get_libdir)/pkgconfig/blas.pc atlas-blas.pc
266 +
267 + # blas threaded
268 + if [[ -e libptf77blas.a ]]; then
269 + atlas_install_libs libptf77blas.a -lm -L. -latlas ${PTLIBS}
270 + atlas_install_pc ptf77blas atlas-blas-threads -lm -latlas ${PTLIBS}
271 + alternatives_for blas atlas-threads 0 \
272 + /usr/$(get_libdir)/pkgconfig/blas.pc atlas-blas-threads.pc
273 + fi
274 +
275 + if use lapack; then
276 + PCREQ="Requires: blas cblas"
277 + # lapack
278 + atlas_install_libs libatllapack.a \
279 + -lm -L. -latlas -latlcblas -lf77blas
280 + atlas_install_pc atllapack atlas-lapack -lm -latlas
281 + alternatives_for lapack atlas 0 \
282 + /usr/$(get_libdir)/pkgconfig/lapack.pc atlas-lapack.pc
283 + # lapack threaded
284 + if [[ -e libptlapack.a ]]; then
285 + atlas_install_libs libptlapack.a \
286 + -lm -L. -latlas -lptcblas -lptf77blas ${PTLIBS}
287 + atlas_install_pc ptlapack atlas-lapack-threads \
288 + -lm -latlas ${PTLIBS}
289 + alternatives_for lapack atlas-threads 0 \
290 + /usr/$(get_libdir)/pkgconfig/lapack.pc atlas-lapack-threads.pc
291 + fi
292 + fi
293 + fi
294 +
295 + cd "${S}"
296 + insinto /usr/include/${PN}
297 + doins include/*.h
298 +
299 + cd "${S}/doc"
300 + dodoc INDEX.txt AtlasCredits.txt ChangeLog
301 + use doc && dodoc atlas*pdf cblas.pdf cblasqref.pdf
302 + use doc && use fortran && dodoc f77blas*pdf
303 + use doc && use fortran && use lapack && dodoc lapack*pdf
304 +}