feat(build): add checks for miniaudio library compatibility in macOS universal build script

This commit is contained in:
Ivan
2026-05-03 18:48:20 -05:00
parent e6e3a8f112
commit dcfd93cebc
2 changed files with 40 additions and 0 deletions
+31
View File
@@ -32,5 +32,36 @@ python -m poetry check --lock
python -m poetry install --no-interaction --no-ansi
python -m poetry run python scripts/patch_lxst_pyogg_ogg_ctypes.py
# Python 3.14 may install miniaudio from sdist; a mis-linked x86_64-only
# _miniaudio.abi3.so in the arm64 cx_Freeze tree differs from the x64 slice and
# breaks @electron/universal (lipo cannot merge two x86_64-only Mach-O files).
if [[ "$(uname -s)" == "Darwin" && "$(uname -m)" == "arm64" ]]; then
if ! poetry run python -c "
import importlib.util
import pathlib
import subprocess
import sys
spec = importlib.util.find_spec('miniaudio')
if not spec or not spec.origin:
sys.exit(0)
so = pathlib.Path(spec.origin).resolve().parent / '_miniaudio.abi3.so'
if not so.is_file():
sys.exit(0)
out = subprocess.check_output(['file', str(so)], text=True)
if 'x86_64' in out and 'arm64' not in out:
sys.exit(1)
sys.exit(0)
"; then
echo "Rebuilding miniaudio for arm64 (was x86_64-only)." >&2
(
export ARCHFLAGS="-arch arm64"
export CFLAGS="-arch arm64 ${CFLAGS:-}"
export CXXFLAGS="-arch arm64 ${CXXFLAGS:-}"
poetry run python -m pip install --force-reinstall --no-cache-dir --no-binary miniaudio "miniaudio>=1.70,<2"
)
fi
fi
pnpm config set verify-store-integrity true
pnpm install --frozen-lockfile