-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from h-vetinari/rc
numpy v1.26.0 with meson
- Loading branch information
Showing
3 changed files
with
65 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
( | ||
echo [DEFAULT] | ||
echo library_dirs = %LIBRARY_LIB% | ||
echo include_dirs = %LIBRARY_INC% | ||
echo [lapack] | ||
echo libraries = lapack,blas | ||
echo [blas] | ||
echo libraries = cblas,blas | ||
echo [cblas] | ||
echo libraries = cblas,blas | ||
) > site.cfg | ||
@echo on | ||
|
||
set "NPY_LAPACK_ORDER=lapack" | ||
set "NPY_BLAS_ORDER=blas" | ||
mkdir builddir | ||
|
||
%PYTHON% -m pip install --no-deps --ignore-installed -v . | ||
if errorlevel 1 exit 1 | ||
:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check | ||
%PYTHON% -m build -w -n -x ^ | ||
-Cbuilddir=builddir ^ | ||
-Csetup-args=-Dblas=blas ^ | ||
-Csetup-args=-Dlapack=lapack | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
XCOPY %RECIPE_DIR%\f2py.bat %SCRIPTS% /s /e | ||
if errorlevel 1 exit 1 | ||
|
||
del %SCRIPTS%\f2py.exe | ||
if errorlevel 1 exit 1 | ||
:: `pip install dist\numpy*.whl` does not work on windows, | ||
:: so use a loop; there's only one wheel in dist/ anyway | ||
for /f %%f in ('dir /b /S .\dist') do ( | ||
pip install %%f | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,35 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
set -x | ||
# necessary for cross-compilation to point to the right env | ||
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig | ||
|
||
# numpy distutils don't use the env variables. | ||
if [[ ! -f $BUILD_PREFIX/bin/ranlib ]]; then | ||
ln -s $RANLIB $BUILD_PREFIX/bin/ranlib | ||
ln -s $AR $BUILD_PREFIX/bin/ar | ||
fi | ||
mkdir builddir | ||
|
||
cat > site.cfg <<EOF | ||
[DEFAULT] | ||
library_dirs = $PREFIX/lib | ||
include_dirs = $PREFIX/include | ||
# HACK: extend $CONDA_PREFIX/meson_cross_file that's created in | ||
# https://github.com/conda-forge/ctng-compiler-activation-feedstock/blob/main/recipe/activate-gcc.sh | ||
# https://github.com/conda-forge/clang-compiler-activation-feedstock/blob/main/recipe/activate-clang.sh | ||
# to use host python; requires that [binaries] section is last in meson_cross_file | ||
echo "python = '${PREFIX}/bin/python'" >> ${CONDA_PREFIX}/meson_cross_file.txt | ||
|
||
[lapack] | ||
libraries = lapack,blas | ||
if [[ $target_platform == "osx-arm64" ]]; then | ||
# currently cannot properly detect long double format | ||
# on osx-arm64 when cross-compiling in QEMU, see | ||
# https://github.com/numpy/numpy/pull/24414 | ||
echo "[properties]" >> ${CONDA_PREFIX}/meson_cross_file.txt | ||
echo "longdouble_format = 'IEEE_DOUBLE_LE'" >> ${CONDA_PREFIX}/meson_cross_file.txt | ||
fi | ||
|
||
[blas] | ||
libraries = cblas,blas | ||
EOF | ||
# meson-python already sets up a -Dbuildtype=release argument to meson, so | ||
# we need to strip --buildtype out of MESON_ARGS or fail due to redundancy | ||
MESON_ARGS_REDUCED="$(echo $MESON_ARGS | sed 's/--buildtype release //g')" | ||
|
||
export NPY_LAPACK_ORDER=lapack | ||
export NPY_BLAS_ORDER=blas | ||
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check | ||
$PYTHON -m build -w -n -x \ | ||
-Cbuilddir=builddir \ | ||
-Csetup-args=-Dblas=blas \ | ||
-Csetup-args=-Dlapack=lapack \ | ||
-Csetup-args=${MESON_ARGS_REDUCED// / -Csetup-args=} \ | ||
|| (cat builddir/meson-logs/meson-log.txt && exit 1) | ||
|
||
$PYTHON -m pip install --no-deps --ignore-installed -v . | ||
pip install dist/numpy*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters