common/build-helper/numpy.sh: only write meson cross-file once
This commit is contained in:
parent
557b4a73cf
commit
174deccefd
1 changed files with 31 additions and 25 deletions
|
@ -11,37 +11,43 @@ if [[ $hostmakedepends != *"python3-numpy"* ]]; then
|
||||||
hostmakedepends+=" python3-numpy"
|
hostmakedepends+=" python3-numpy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CROSS_BUILD" ]; then
|
[ -z "$CROSS_BUILD" ] && return 0
|
||||||
if [[ $makedepends != *"python3-numpy"* ]]; then
|
|
||||||
makedepends+=" python3-numpy"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# python3-setuptools finds numpy libs and headers on the host first;
|
if [[ $makedepends != *"python3-numpy"* ]]; then
|
||||||
# adding search paths up front allows the target to take priority
|
makedepends+=" python3-numpy"
|
||||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/include"
|
fi
|
||||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/lib"
|
|
||||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/random/lib"
|
|
||||||
|
|
||||||
# distutils from python3-numpy looks to environment variables F77 and
|
# python3-setuptools finds numpy libs and headers on the host first;
|
||||||
# F90 rather than the XBPS-set FC
|
# adding search paths up front allows the target to take priority
|
||||||
export F77="${FC}"
|
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/include"
|
||||||
export F90="${FC}"
|
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/lib"
|
||||||
|
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/random/lib"
|
||||||
|
|
||||||
# When compiling and linking FORTRAN, distutils from python3-numpy
|
# distutils from python3-numpy looks to environment variables F77 and
|
||||||
# refuses respect any linker name except "gfortran"; symlink to the
|
# F90 rather than the XBPS-set FC
|
||||||
# cross-compiler to that the right linker and compiler will be used
|
export F77="${FC}"
|
||||||
if _gfortran=$(command -v "${FC}"); then
|
export F90="${FC}"
|
||||||
ln -sf "${_gfortran}" "${XBPS_WRAPPERDIR}/gfortran"
|
|
||||||
fi
|
|
||||||
unset _gfortran
|
|
||||||
|
|
||||||
# Write a secondary meson cross file for numpy configuration
|
# When compiling and linking FORTRAN, distutils from python3-numpy
|
||||||
if [[ "${build_helper}" = *meson* ]]; then
|
# refuses respect any linker name except "gfortran"; symlink to the
|
||||||
|
# cross-compiler to that the right linker and compiler will be used
|
||||||
|
if _gfortran=$(command -v "${FC}"); then
|
||||||
|
ln -sf "${_gfortran}" "${XBPS_WRAPPERDIR}/gfortran"
|
||||||
|
fi
|
||||||
|
unset _gfortran
|
||||||
|
|
||||||
|
# Write a secondary meson cross file for numpy configuration
|
||||||
|
if [[ "${build_helper}" = *meson* ]]; then
|
||||||
|
_npy_meson_cross="${XBPS_WRAPPERDIR}/meson/xbps_numpy.cross"
|
||||||
|
_cross_py_site="${XBPS_CROSS_BASE}/${py3_sitelib}"
|
||||||
|
|
||||||
|
if [ ! -e "${_npy_meson_cross}" ] || [ -n "$XBPS_BUILD_FORCEMODE" ]; then
|
||||||
mkdir -p "${XBPS_WRAPPERDIR}/meson"
|
mkdir -p "${XBPS_WRAPPERDIR}/meson"
|
||||||
cat > "${XBPS_WRAPPERDIR}/meson/xbps_numpy.cross" <<-EOF
|
cat > "${_npy_meson_cross}" <<-EOF
|
||||||
[properties]
|
[properties]
|
||||||
numpy-include-dir = '${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/include'
|
numpy-include-dir = '${_cross_py_site}/numpy/core/include'
|
||||||
pythran-include-dir = '${XBPS_CROSS_BASE}/${py3_sitelib}/pythran'
|
pythran-include-dir = '${_cross_py_site}/pythran'
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
unset _npy_meson_cross _cross_py_site
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue