Skip to content

Commit 89a968a

Browse files
committed
refactor: macOS CI/release uses xlings mcpp (same pattern as Linux)
Replace xmake bootstrap with `xlings install mcpp` → `mcpp build`, matching the Linux CI pattern exactly: - ci-macos: xlings install mcpp → mcpp build → self-host smoke - release: xlings install mcpp → mcpp build → package No xmake dependency. mcpp auto-installs LLVM toolchain via xlings.
1 parent 3a50d90 commit 89a968a

2 files changed

Lines changed: 39 additions & 75 deletions

File tree

.github/workflows/ci-macos.yml

Lines changed: 22 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -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"

.github/workflows/release.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ jobs:
295295
xlings-macos15-release-
296296
xlings-macos15-arm64-
297297
298-
- name: Bootstrap xlings + LLVM
298+
- name: Bootstrap mcpp via xlings
299299
env:
300300
XLINGS_NON_INTERACTIVE: '1'
301301
XLINGS_VERSION: '0.4.30'
@@ -310,25 +310,25 @@ jobs:
310310
fi
311311
export PATH="$HOME/.xlings/subos/default/bin:$PATH"
312312
xlings --version
313-
# Install LLVM
314-
xlings install llvm -y || xlings install llvm@20.1.7 -y
315-
LLVM_ROOT=$(find "$HOME/.xlings" -path "*/xpkgs/xim-x-llvm/*/bin/clang++" | head -1 | xargs dirname | xargs dirname)
316-
echo "LLVM_ROOT=$LLVM_ROOT" >> "$GITHUB_ENV"
317-
318-
- name: Install mcpp@0.0.16 via xlings
319-
run: |
320-
export PATH="$HOME/.xlings/subos/default/bin:$PATH"
321313
xlings install mcpp -y
322-
mcpp --version
314+
MCPP="$HOME/.xlings/subos/default/bin/mcpp"
315+
test -x "$MCPP"
316+
"$MCPP" --version
317+
echo "MCPP=$MCPP" >> "$GITHUB_ENV"
318+
echo "XLINGS_BIN=$HOME/.xlings/subos/default/bin/xlings" >> "$GITHUB_ENV"
323319
324-
- name: Build mcpp (self-host)
320+
- name: Build mcpp from source (self-host)
325321
run: |
326322
export PATH="$HOME/.xlings/subos/default/bin:$PATH"
327-
mcpp build
328-
SELFHOST=$(find target -path "*/bin/mcpp" | head -1)
329-
test -x "$SELFHOST"
330-
"$SELFHOST" --version
331-
echo "SELFHOST=$SELFHOST" >> "$GITHUB_ENV"
323+
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
324+
"$MCPP" build
325+
MCPP_BIN=$(find target -path "*/bin/mcpp" | head -1)
326+
MCPP_BIN=$(cd "$(dirname "$MCPP_BIN")" && pwd)/$(basename "$MCPP_BIN")
327+
test -x "$MCPP_BIN"
328+
file "$MCPP_BIN"
329+
otool -L "$MCPP_BIN"
330+
"$MCPP_BIN" --version
331+
echo "MCPP_BIN=$MCPP_BIN" >> "$GITHUB_ENV"
332332
333333
- name: Package macOS release
334334
id: stage
@@ -340,7 +340,7 @@ jobs:
340340
# Create release layout
341341
STAGING=$(mktemp -d)
342342
mkdir -p "$STAGING/$WRAPPER/bin"
343-
cp "$SELFHOST" "$STAGING/$WRAPPER/bin/mcpp"
343+
cp "$MCPP_BIN" "$STAGING/$WRAPPER/bin/mcpp"
344344
# Strip (Mach-O)
345345
strip "$STAGING/$WRAPPER/bin/mcpp" 2>/dev/null || true
346346
# Copy metadata

0 commit comments

Comments
 (0)