#!/bin/sh
# Build script for meson (pure-Python package, installed via pip3).
#
# meson is a pure-Python wheel/sdist with no C extension to compile, so
# there is nothing for a "build" step to do beyond letting pip3 stage it
# under $PKGDIR with $PREFIX baked in as the install prefix.
#
# NOTE: meson's pyproject.toml declares `requires = ["setuptools>=42"]` /
# `build-backend = "setuptools.build_meta"`. The Hammerhead python port
# (lang/python) ships only pip via ensurepip -- no setuptools/wheel in
# site-packages -- so --no-build-isolation (as originally sketched in the
# brief) fails hard with `ModuleNotFoundError: No module named 'setuptools'`
# (confirmed on alpha9, 2026-07-22). Fix: do NOT pass --no-build-isolation;
# let pip3 build an ephemeral PEP517 build environment (it fetches
# setuptools from PyPI into a throwaway dir for the build only -- alpha9
# has outbound internet). --no-deps is kept: meson's own runtime deps are
# stdlib-only for our purposes (ninja is invoked as a subprocess build_dep,
# never imported).
set -e
cd "$SRCDIR"

pip3 install --no-deps --prefix="$PREFIX" --root="$PKGDIR" .
