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

Contents of /sci-libs/blas-atlas/blas-atlas-3.8.1-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20