1SUMMARY="Array processing for numbers, strings, records, and objects"
2DESCRIPTION="NumPy is a general-purpose array-processing package designed to \
3efficiently manipulate large multi-dimensional arrays of arbitrary records \
4without sacrificing too much speed for small multi-dimensional arrays.
5NumPy is built on the Numeric code base and adds features introduced by \
6numarray as well as an extended C-API and the ability to create arrays of \
7arbitrary type which also makes NumPy suitable for interfacing with \
8general-purpose data-base applications."
9HOMEPAGE="https://www.numpy.org/"
10COPYRIGHT="2005-2021 Travis E. Oliphant et al."
11LICENSE="BSD (3-clause)"
12REVISION="1"
13SOURCE_URI="https://github.com/numpy/numpy/releases/download/v$portVersion/numpy-$portVersion.tar.gz"
14CHECKSUM_SHA256="f93fc78fe8bf15afe2b8d6b6499f1c73953169fad1e9a8dd086cdff3190e7fdf"
15SOURCE_DIR="numpy-$portVersion"
16
17ARCHITECTURES="all !x86_gcc2"
18SECONDARY_ARCHITECTURES="x86"
19
20PROVIDES="
21	$portName = $portVersion
22	"
23REQUIRES="
24	haiku$secondaryArchSuffix
25#	lib:libamd$secondaryArchSuffix
26	lib:libblis$secondaryArchSuffix
27	lib:libexecinfo$secondaryArchSuffix
28#	lib:libfftw3$secondaryArchSuffix
29	lib:liblapack$secondaryArchSuffix
30	lib:libopenblas$secondaryArchSuffix
31#	lib:libumfpack$secondaryArchSuffix
32	"
33
34BUILD_REQUIRES="
35	haiku${secondaryArchSuffix}_devel
36#	devel:cblas$secondaryArchSuffix
37#	devel:libamd$secondaryArchSuffix
38	devel:libblis$secondaryArchSuffix
39	devel:libexecinfo$secondaryArchSuffix
40#	devel:libfftw3$secondaryArchSuffix
41	devel:liblapack$secondaryArchSuffix
42	devel:libopenblas$secondaryArchSuffix
43#	devel:libumfpack$secondaryArchSuffix
44	"
45
46PYTHON_PACKAGES=(python39 python310)
47PYTHON_VERSIONS=(3.9 3.10)
48for i in "${!PYTHON_PACKAGES[@]}"; do
49pythonPackage=${PYTHON_PACKAGES[i]}
50pythonVersion=${PYTHON_VERSIONS[$i]}
51eval "PROVIDES_${pythonPackage}=\"\
52	${portName}_$pythonPackage = $portVersion\n\
53	cmd:f2py${pythonVersion%.*}\n\
54	cmd:f2py$pythonVersion\n\
55	\"; \
56REQUIRES_$pythonPackage=\"\
57	haiku$secondaryArchSuffix\n\
58	numpy$secondaryArchSuffix\n\
59	cmd:cython$pythonVersion\n\
60	cmd:python$pythonVersion\
61	\""
62if [ "$targetArchitecture" = "x86_gcc2" ]; then
63	eval "PROVIDES_${pythonPackage}+=\"\n\
64		numpy_$pythonPackage = $portVersion\
65		\""
66fi
67BUILD_REQUIRES="$BUILD_REQUIRES
68	setuptools_$pythonPackage
69	"
70BUILD_PREREQUIRES="$BUILD_PREREQUIRES
71	cmd:cython$pythonVersion
72	cmd:git
73	cmd:gcc$secondaryArchSuffix
74	cmd:gfortran$secondaryArchSuffix
75	cmd:pkg_config$secondaryArchSuffix
76	cmd:python$pythonVersion
77	"
78done
79
80
81INSTALL()
82{
83# Check at every update in site.cfg.example!
84cat > site.cfg << EOF
85[ALL]
86libraries = execinfo,lapack,openblas
87library_dirs = /system/$relativeDevelopLibDir
88include_dirs = /system/$relativeIncludeDir
89runtime_library_dirs = /system/$relativeLibDir
90[openblas]
91libraries = openblas
92library_dirs = /system/$relativeDevelopLibDir
93include_dirs = /system/$relativeIncludeDir
94runtime_library_dirs = /system/$relativeLibDir
95[blis]
96libraries = blis
97library_dirs = /system/$relativeDevelopLibDir
98include_dirs = /system/$relativeIncludeDir/blis
99runtime_library_dirs = /system/$relativeLibDir
100#[amd]
101#amd_libs = amd
102#[umfpack]
103#umfpack_libs = umfpack
104#[fftw]
105#libraries = fftw3
106EOF
107
108	rm -rf doc/sphinxext/.git
109
110	for i in "${!PYTHON_PACKAGES[@]}"; do
111		pythonPackage=${PYTHON_PACKAGES[i]}
112		pythonVersion=${PYTHON_VERSIONS[$i]}
113
114		python=python$pythonVersion
115		installLocation=$prefix/lib/$python/vendor-packages/
116		export PYTHONPATH=$installLocation:$PYTHONPATH
117		mkdir -p $installLocation
118		rm -rf build
119		$python setup.py build install \
120			--root=/ --prefix=$prefix
121		rm -rf $prefix/bin/f2py
122
123		packageEntries  $pythonPackage \
124			$prefix/lib/python* \
125			$prefix/bin
126	done
127}
128
129TEST()
130{
131	for i in "${!PYTHON_PACKAGES[@]}"; do
132		pythonPackage=${PYTHON_PACKAGES[i]}
133		pythonVersion=${PYTHON_VERSIONS[$i]}
134
135		python=python$pythonVersion
136		$python runtests.py
137	done
138}
139