@@ -268,64 +268,28 @@ jobs:
268268 *) echo "FAIL: unexpected platform"; exit 1 ;;
269269 esac
270270
271- - name : Build mcpp (xmake bootstrap)
271+ - name : Bootstrap mcpp via xlings
272272 run : |
273- # Step 1: Use xmake to produce first mcpp binary from source
274- brew install xmake
275- cat > xmake.lua << 'XMAKE'
276- add_rules("mode.release")
277- set_languages("c++23")
278- package("cmdline")
279- set_homepage("https://github.com/mcpplibs/cmdline")
280- add_urls("https://github.com/mcpplibs/cmdline/archive/refs/tags/$(version).tar.gz")
281- add_versions("0.0.1", "3fb2f5495c1a144485b3cbb2e43e27059151633460f702af0f3851cbff387ef0")
282- on_install(function (package)
283- import("package.tools.xmake").install(package)
284- end)
285- package_end()
286- add_requires("cmdline 0.0.1")
287- target("mcpp")
288- set_kind("binary")
289- add_files("src/main.cpp")
290- add_files("src/**.cppm")
291- add_packages("cmdline")
292- add_includedirs("src/libs/json")
293- set_policy("build.c++.modules", true)
294- XMAKE
295- xmake f -y -m release --toolchain=llvm --sdk="$LLVM_ROOT"
296- xmake build -y mcpp
297- rm -f xmake.lua
298- MCPP_V1=$(find "$PWD/build" -name mcpp -type f -perm +111 | head -1)
299- test -x "$MCPP_V1"
300- "$MCPP_V1" --version
301- echo ":: Step 1 PASS: xmake produced mcpp"
302- echo "MCPP_V1=$MCPP_V1" >> "$GITHUB_ENV"
303-
304- - name : Self-host (mcpp builds mcpp)
273+ # Same pattern as Linux CI: xlings install mcpp
274+ xlings install mcpp -y
275+ MCPP="$HOME/.xlings/subos/default/bin/mcpp"
276+ test -x "$MCPP"
277+ "$MCPP" --version
278+ echo "MCPP=$MCPP" >> "$GITHUB_ENV"
279+ echo "XLINGS_BIN=$HOME/.xlings/subos/default/bin/xlings" >> "$GITHUB_ENV"
280+
281+ - name : Build mcpp from source (self-host)
305282 run : |
306- # Step 2: Use the xmake-built mcpp to build itself
307- # mcpp must be on PATH — build.ninja calls `mcpp dyndep`
308- MCPP_DIR=$(dirname "$MCPP_V1")
309- export PATH="$MCPP_DIR:$PATH"
310- which mcpp
311- mcpp build
312- MCPP_V2=$(find target -path "*/bin/mcpp" | head -1)
313- test -x "$MCPP_V2"
314- "$MCPP_V2" --version
315- echo ":: Step 2 PASS: mcpp self-hosted"
316- echo "MCPP_V2=$(realpath "$MCPP_V2")" >> "$GITHUB_ENV"
317-
318- - name : Self-host again (v2 builds itself)
283+ export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
284+ "$MCPP" build
285+
286+ - name : Self-host smoke (freshly-built mcpp builds itself again)
319287 run : |
320- # Step 3: The self-hosted mcpp builds itself again (stability proof)
321- # Save v2 before clearing target/
322- cp "$MCPP_V2" /tmp/mcpp_v2
323- rm -rf target
324- export PATH="/tmp:$PATH"
325- mv /tmp/mcpp_v2 /tmp/mcpp
326- which mcpp
327- mcpp build
328- MCPP_V3=$(find target -path "*/bin/mcpp" | head -1)
329- test -x "$MCPP_V3"
330- "$MCPP_V3" --version
331- echo ":: Step 3 PASS: mcpp self-host stable (v2 → v3)"
288+ MCPP=$(find target -path "*/bin/mcpp" | head -1)
289+ MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP")
290+ test -x "$MCPP"
291+ "$MCPP" --version
292+ export PATH="$(dirname "$MCPP"):$PATH"
293+ "$MCPP" build
294+ "$MCPP" --version
295+ echo ":: Self-host smoke PASS"
0 commit comments