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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20