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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Jul 23 14:43:51 2008 UTC (12 years, 2 months ago) by markusle
Branch: MAIN
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.8.2.ebuild,v 1.1 2008/06/07 16:42:26 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
64 BLD_DIR="${S}"/gentoo-build
65 mkdir "${BLD_DIR}" || die "failed to generate build directory"
66 cd "${BLD_DIR}"
67 cp "${FILESDIR}"/war . && chmod a+x war || die "failed to install war"
68
69 local archselect=
70 if use amd64 || use ppc64; then
71 archselect="-b 64"
72 elif use alpha; then
73 archselect=""
74 else
75 archselect="-b 32"
76 fi
77
78 # unfortunately, atlas-3.9.0 chokes when passed
79 # x86_64-pc-linux-gnu-gcc and friends instead of
80 # plain gcc. Hence, we'll have to workaround this
81 # until it is fixed by upstream
82 local c_compiler=$(tc-getCC)
83 if [[ "${c_compiler}" == *gcc* ]]; then
84 c_compiler="gcc"
85 fi
86
87 ../configure \
88 --cc="${c_compiler}" \
89 --cflags="${CFLAGS}" \
90 --prefix="${D}/${DESTTREE}" \
91 --libdir="${D}/${DESTTREE}"/$(get_libdir)/atlas \
92 --incdir="${D}/${DESTTREE}"/include \
93 -C ac "${c_compiler}" -F ac "${CFLAGS}" \
94 -C if ${FORTRANC} -F if "${FFLAGS:-'-O2'}" \
95 -Ss pmake "\$(MAKE) ${MAKEOPTS}" \
96 -Si cputhrchk 0 ${archselect} \
97 || die "configure failed"
98 }
99
100 src_compile() {
101 cd "${BLD_DIR}"
102
103 # atlas does its own parallel builds
104 emake -j1 || die "emake failed"
105
106 RPATH="${DESTTREE}"/$(get_libdir)/blas
107 make \
108 LIBDIR=$(get_libdir) \
109 RPATH="${RPATH}"/atlas \
110 shared || die "failed to build shared libraries"
111
112 # build shared libraries of threaded libraries if applicable
113 if [[ -d gentoo/libptcblas.a ]]; then
114 make \
115 LIBDIR=$(get_libdir) \
116 RPATH="${RPATH}"/threaded-atlas \
117 ptshared || die "failed to build threaded shared libraries"
118 fi
119 }
120
121 src_test() {
122 # make check does not work because
123 # we don't build lapack libs
124 for i in F77 C; do
125 einfo "Testing ${i} interface"
126 cd "${BLD_DIR}"/interfaces/blas/${i}/testing
127 make sanity_test || die "emake tests for ${i} failed"
128 if [[ -d "${BLD_DIR}"/gentoo/libptf77blas.a ]]; then
129 make ptsanity_test || die "emake tests threaded for ${i}failed"
130 fi
131 done
132 echo "Timing ATLAS"
133 cd "${BLD_DIR}"
134 emake time || die "emake time failed"
135 }
136
137 src_install () {
138 dodir "${RPATH}"/atlas
139 cd "${BLD_DIR}"/gentoo/libs
140 cp -P libatlas* "${D}/${DESTTREE}"/$(get_libdir) \
141 || die "Failed to install libatlas"
142
143 # pkgconfig files
144 local extlibs="-lm"
145 local threadlibs
146 [[ ${FORTRANC} == gfortran ]] && extlibs="${extlibs} -lgfortran"
147 [[ ${FORTRANC} == g77 ]] && extlibs="${extlibs} -lg2c"
148 cp "${FILESDIR}"/blas.pc.in blas.pc
149 cp "${FILESDIR}"/cblas.pc.in cblas.pc
150 sed -i \
151 -e "s:@LIBDIR@:$(get_libdir):" \
152 -e "s:@PV@:${PV}:" \
153 -e "s:@EXTLIBS@:${extlibs}:g" \
154 -e "s:@THREADLIBS@:${threadlibs}:g" \
155 *blas.pc || die "sed *blas.pc failed"
156
157 cp -P *blas* "${D}/${RPATH}"/atlas \
158 || die "Failed to install blas/cblas"
159
160 ESELECT_PROF=atlas
161 eselect blas add $(get_libdir) "${FILESDIR}"/eselect.blas.atlas ${ESELECT_PROF}
162 eselect cblas add $(get_libdir) "${FILESDIR}"/eselect.cblas.atlas ${ESELECT_PROF}
163
164 if [[ -d "${BLD_DIR}"/gentoo/threaded-libs ]]; then
165 dodir "${RPATH}"/threaded-atlas
166 cd "${BLD_DIR}"/gentoo/threaded-libs
167
168 # pkgconfig files
169 cp "${FILESDIR}"/blas.pc.in blas.pc
170 cp "${FILESDIR}"/cblas.pc.in cblas.pc
171 threadlibs="-lpthread"
172 sed -i \
173 -e "s:@LIBDIR@:$(get_libdir):" \
174 -e "s:@PV@:${PV}:" \
175 -e "s:@EXTLIBS@:${extlibs}:g" \
176 -e "s:@THREADLIBS@:${threadlibs}:g" \
177 *blas.pc || die "sed *blas.pc failed"
178
179 cp -P * "${D}/${RPATH}"/threaded-atlas \
180 || die "Failed to install threaded atlas"
181 ESELECT_PROF=atlas-threads
182
183 eselect blas add $(get_libdir) "${FILESDIR}"/eselect.blas.threaded-atlas ${ESELECT_PROF}
184 eselect cblas add $(get_libdir) "${FILESDIR}"/eselect.cblas.threaded-atlas ${ESELECT_PROF}
185 fi
186
187 insinto "${DESTTREE}"/include/atlas
188 doins \
189 "${S}"/include/cblas.h \
190 "${S}"/include/atlas_misc.h \
191 "${S}"/include/atlas_enum.h \
192 || die "failed to install headers"
193
194 # These headers contain the architecture-specific
195 # optimizations determined by ATLAS. The atlas-lapack build
196 # is much shorter if they are available, so save them:
197 doins "${BLD_DIR}"/include/*.h \
198 || die "failed to install timing headers"
199
200 # some docs
201 cd "${S}"/doc
202 dodoc INDEX.txt AtlasCredits.txt ChangeLog || die "dodoc failed"
203 # atlas specific doc (blas generic docs installed by blas-docs)
204 if use doc; then
205 insinto /usr/share/doc/${PF}
206 doins atlas*pdf cblasqref.pdf || die "doins docs failed"
207 fi
208 }
209
210 pkg_postinst() {
211 for p in blas cblas; do
212 local current_p=$(eselect ${p} show | cut -d' ' -f2)
213 # this snippet works around the eselect bug #189942 and makes
214 # sure that users upgrading from a previous blas-atlas
215 # version pick up the new pkg-config files
216 if [[ ${current_p} == ${ESELECT_PROF} \
217 || ${current_p} == "threaded-atlas" \
218 || -z ${current_p} ]]; then
219 local configfile="${ROOT}"/etc/env.d/${p}/$(get_libdir)/config
220 [[ -e ${configfile} ]] && rm -f ${configfile}
221 eselect ${p} set ${ESELECT_PROF}
222 elog "${p} has been eselected to ${ESELECT_PROF}"
223 else
224 elog "Current eselected ${p} is ${current_p}"
225 elog "To use the ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
226 elog "\t eselect ${p} set ${ESELECT_PROF}"
227 fi
228 done
229 }

  ViewVC Help
Powered by ViewVC 1.1.20