/[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.2 - (hide annotations) (download)
Sun Aug 3 17:54:18 2008 UTC (12 years, 2 months ago) by markusle
Branch: MAIN
Changes since 1.1: +3 -1 lines
Added patches to fix infinite recursion during bootstrapping and to improve Core2Duo detection (fixes bug #233614).
(Portage version: 2.2_rc5/cvs/Linux 2.6.26-SENTINEL-1 i686)

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

  ViewVC Help
Powered by ViewVC 1.1.20