blob: 8f62a8311210be3c1cc303170e5da49c82294d7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/numpy/numpy-1.0.3.ebuild,v 1.5 2007/06/14 14:06:02 jer Exp $
NEED_PYTHON=2.3
inherit distutils eutils fortran
MY_P=${P/_beta/b}
MY_P=${MY_P/_}
DESCRIPTION="Python array processing for numbers, strings, records, and objects"
SRC_URI="mirror://sourceforge/numpy/${MY_P}.tar.gz"
HOMEPAGE="http://numeric.scipy.org/"
RDEPEND="!dev-python/f2py
lapack? ( || ( >=sci-libs/blas-atlas-3.7.11-r1
>=sci-libs/cblas-reference-20030223-r3 )
virtual/lapack )"
DEPEND="${RDEPEND}
lapack? ( app-admin/eselect-cblas )"
IUSE="lapack"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
LICENSE="BSD"
S="${WORKDIR}/${MY_P}"
FORTRAN="gfortran g77"
numpy_configure() {
local mycblas
if use lapack; then
for d in $(eselect cblas show); do mycblas=${d}; done
if [[ -z "${mycblas/reference/}" ]] && [[ -z "${mycblas/atlas/}" ]]; then
ewarn "You need to set cblas to atlas or reference. Do:"
ewarn " eselect cblas set <impl>"
ewarn "where <impl> is atlas, threaded-atlas or reference"
die "setup failed"
fi
fi
[[ -z "${F77FLAGS}" ]] && F77FLAGS="${CFLAGS}"
[[ -z "${FFLAGS}" ]] && FFLAGS="${F77FLAGS}"
# remove default values
echo "# gentoo config" > site.cfg
export BLAS=None
export LAPACK=None
export ATLAS=None
export PTATLAS=None
export MKL=None
if use lapack; then
echo "[blas_opt]" >> site.cfg
case "${mycblas}" in
reference)
echo "include_dirs = /usr/include/cblas" >> site.cfg
echo "libraries = blas, cblas" >> site.cfg
unset BLAS
;;
atlas|threaded-atlas)
echo "include_dirs = /usr/include/atlas" >> site.cfg
echo "libraries = blas, cblas, atlas" >> site.cfg
unset ATLAS
;;
*)
local msg="Invalid cblas implementation: ${cblas}"
eerror "${msg}"
die "${msg}"
;;
esac
echo "[lapack_opt]" >> site.cfg
echo "libraries = lapack" >> site.cfg
unset LAPACK
fi
# Map compilers to what numpy calls them (same as scipy)
case "${FORTRANC}" in
gfortran)
NUMPY_FC="gnu95"
;;
g77)
NUMPY_FC="gnu"
;;
g95)
NUMPY_FC="g95"
;;
ifc|ifort)
if use ia64; then
NUMPY_FC="intele"
elif use amd64; then
NUMPY_FC="intelem"
else
NUMPY_FC="intel"
fi
;;
*)
local msg="Invalid Fortran compiler \'${FORTRANC}\'"
eerror "${msg}"
die "${msg}"
;;
esac
export NUMPY_FC
# http://projects.scipy.org/scipy/numpy/ticket/182
# Can't set LDFLAGS
unset LDFLAGS
}
src_unpack() {
fortran_src_unpack
cd "${S}"
# fix some paths and docs in f2py
epatch "${FILESDIR}"/${PN}-1.0.1-f2py.patch
# gentoo patch for ATLAS library names
sed -i \
-e "s:'f77blas':'blas':g" \
-e "s:'ptblas':'blas':g" \
-e "s:'ptcblas':'cblas':g" \
-e "s:'lapack_atlas':'lapack':g" \
numpy/distutils/system_info.py \
|| die "sed system_info.py failed"
}
src_compile() {
numpy_configure
distutils_src_compile \
config_fc \
--fcompiler=${NUMPY_FC} \
--opt="${FFLAGS}"
}
src_test() {
# see comment before the distutils_src_install
numpy_configure
${python} setup.py install \
--home="${S}"/test \
--no-compile \
config_fc \
--fcompiler=${NUMPY_FC} \
--opt="${FFLAGS}" || die "install test failed"
pushd "${S}"/test/lib*/python
PYTHONPATH=. "${python}" -c "import numpy; numpy.test(10,3)" 2>&1 \
| tee test.log
grep -q OK test.log || die "test failed"
popd
rm -rf test
}
src_install() {
# we need to do the configuring again, for some reason, the
# variables are not kept within setup.py functions
numpy_configure
distutils_src_install \
config_fc \
--fcompiler=${NUMPY_FC} \
--opt="${FFLAGS}"
docinto numpy
dodoc numpy/doc/*txt
docinto f2py
dodoc numpy/f2py/docs/*txt
doman numpy/f2py/f2py.1
}
|