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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Jul 23 14:43:51 2008 UTC (11 years, 11 months ago) by markusle
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Version bump.
(Portage version: 2.2_rc1/cvs/Linux 2.6.25-SENTINEL-5 i686)

1 # Copyright 1999-2008 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.0.ebuild,v 1.1 2008/07/21 13:42:28 markusle Exp $
4
5 inherit eutils toolchain-funcs fortran multilib
6
7 PATCH_V="3.9.0"
8
9 DESCRIPTION="Automatically Tuned Linear Algebra Software BLAS implementation"
10 HOMEPAGE="http://math-atlas.sourceforge.net/"
11 MY_PN=${PN/blas-/}
12 SRC_URI="mirror://sourceforge/math-atlas/${MY_PN}${PV}.tar.bz2
13 mirror://gentoo/${MY_PN}-${PATCH_V}-shared-libs.patch.bz2"
14
15 LICENSE="BSD"
16 SLOT="0"
17 KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
18 IUSE="doc"
19
20 RDEPEND="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 # icc won't compile (as of icc-10.0.026)
31 # and will blow out $PORTAGE_TMPDIR
32 if [[ $(tc-getCC) = icc* ]]; then
33 eerror "icc compiler is not supported with sci-libs/blas-atlas"
34 die "blas-atlas won't compile with icc"
35 fi
36
37 FORTRAN="g77 gfortran ifc"
38 fortran_pkg_setup
39 echo
40 ewarn "Please make sure to disable CPU throttling completely"
41 ewarn "during the compile of blas-atlas. Otherwise, all atlas"
42 ewarn "generated timings will be completely random and the"
43 ewarn "performance of the resulting libraries will be degraded"
44 ewarn "considerably."
45 echo
46 ewarn "For users of <=gcc-4.1 only:"
47 ewarn "If you experience failing SANITY tests during"
48 ewarn "atlas' compile please try passing -mfpmath=387; this"
49 ewarn "option might also result in much better performance"
50 ewarn "than using then sse instruction set depending on your"
51 ewarn "CPU."
52 echo
53 epause 10
54 }
55
56 src_unpack() {
57 unpack ${A}
58
59 cd "${S}"
60 epatch "${DISTDIR}"/${MY_PN}-${PATCH_V}-shared-libs.patch.bz2
61 epatch "${FILESDIR}"/${MY_PN}-asm-gentoo.patch
62 epatch "${FILESDIR}"/${MY_PN}-${PATCH_V}-decl-fix.patch
63 epatch "${FILESDIR}"/${MY_PN}-${PV}-upstream-fixes.patch
64
65 BLD_DIR="${S}"/gentoo-build
66 mkdir "${BLD_DIR}" || die "failed to generate build directory"
67 cd "${BLD_DIR}"
68 cp "${FILESDIR}"/war . && chmod a+x war || die "failed to install war"
69
70 local archselect=
71 if use amd64 || use ppc64; then
72 archselect="-b 64"
73 elif use alpha; then
74 archselect=""
75 else
76 archselect="-b 32"
77 fi
78
79 # unfortunately, atlas-3.9.0 chokes when passed
80 # x86_64-pc-linux-gnu-gcc and friends instead of
81 # plain gcc. Hence, we'll have to workaround this
82 # until it is fixed by upstream
83 local c_compiler=$(tc-getCC)
84 if [[ "${c_compiler}" == *gcc* ]]; then
85 c_compiler="gcc"
86 fi
87
88 ../configure \
89 --cc="${c_compiler}" \
90 --cflags="${CFLAGS}" \
91 --prefix="${D}/${DESTTREE}" \
92 --libdir="${D}/${DESTTREE}"/$(get_libdir)/atlas \
93 --incdir="${D}/${DESTTREE}"/include \
94 -C ac "${c_compiler}" -F ac "${CFLAGS}" \
95 -C if ${FORTRANC} -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 [[ ${FORTRANC} == gfortran ]] && extlibs="${extlibs} -lgfortran"
148 [[ ${FORTRANC} == 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