diff --git a/recipes/recipes_emscripten/numpy-openblas/build.sh b/recipes/recipes_emscripten/numpy-openblas/build.sh new file mode 100644 index 00000000000..6acdcb31041 --- /dev/null +++ b/recipes/recipes_emscripten/numpy-openblas/build.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -ex + +echo "PYTHON" + +rm -r -f branding + +# Prefer the relocatable openblas.pc shipped by the openblas package. +export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" + +# NumPy tries dependency('scipy-openblas', method: 'pkg-config') before +# dependency('openblas'). That name is not registered in Meson's BLAS +# factory, so it avoids wasm-ld-breaking void dgemm_() symbol probes. +# OpenBLAS only ships openblas.pc; provide a build-local alias derived +# from it (rewrite prefix to $PREFIX — pcfiledir would be wrong here). +PKGCONFIG_DIR="${SRC_DIR}/.emscripten-pkgconfig" +mkdir -p "${PKGCONFIG_DIR}" +sed -e "s|^prefix=.*|prefix=${PREFIX}|" \ + -e 's/^Name: .*/Name: scipy-openblas/' \ + "${PREFIX}/lib/pkgconfig/openblas.pc" \ + > "${PKGCONFIG_DIR}/scipy-openblas.pc" +export PKG_CONFIG_PATH="${PKGCONFIG_DIR}:${PKG_CONFIG_PATH}" + +# Fail early if OpenBLAS is not usable from pkg-config. +pkg-config --exists --print-errors openblas +pkg-config --exists --print-errors scipy-openblas +pkg-config --cflags --libs openblas +test -f "${PREFIX}/include/cblas.h" +test -f "${PREFIX}/lib/libopenblas.so" + +# Cross builds do not always inherit PKG_CONFIG_PATH; tell Meson where to look. +cp "${RECIPE_DIR}/emscripten.meson.cross" "${SRC_DIR}/emscripten.meson.cross" +cat >> "${SRC_DIR}/emscripten.meson.cross" <