numpy.sh (1381B)
1# 2# numpy - build-helper for packages that compile against python3-numpy 3# 4# This build-helper makes sure packages can find python3-numpy libraries and 5# headers on the target architecture rather than the host, as well as making 6# sure the gfortran cross compiler is properly identified. 7 8# Even for cross compilation, numpy should be available on the host to ensure 9# that the host interpreter doesn't complain about missing deps 10if [[ $hostmakedepends != *"python3-numpy"* ]]; then 11 hostmakedepends+=" python3-numpy" 12fi 13 14if [ "$CROSS_BUILD" ]; then 15 if [[ $makedepends != *"python3-numpy"* ]]; then 16 makedepends+=" python3-numpy" 17 fi 18 19 # python3-setuptools finds numpy libs and headers on the host first; 20 # addding search paths up front allows the target to take priority 21 CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/include" 22 LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_sitelib}/numpy/core/lib" 23 24 # distutils from python3-numpy looks to environment variables F77 and 25 # F90 rather than the XBPS-set FC 26 export F77="${FC}" 27 export F90="${FC}" 28 29 # When compiling and linking FORTRAN, distutils from python3-numpy 30 # refuses respect any linker name except "gfortran"; symlink to the 31 # cross-compiler to that the right linker and compiler will be used 32 if _gfortran=$(command -v "${FC}"); then 33 ln -sf "${_gfortran}" "${XBPS_WRAPPERDIR}/gfortran" 34 fi 35 unset _gfortran 36fi