Skip to content

Commit d37bbc3

Browse files
committed
refactor: use v0.0.16 mcpp to self-host macOS builds (drop xmake)
Since v0.0.16 macOS binary is available, both release and CI can now self-host: download v0.0.16 → mcpp build → produce new binary. No xmake needed.
1 parent 398d144 commit d37bbc3

2 files changed

Lines changed: 32 additions & 48 deletions

File tree

.github/workflows/ci-macos.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,21 @@ jobs:
268268
*) echo "FAIL: unexpected platform"; exit 1 ;;
269269
esac
270270
271-
- name: Install xmake (for bootstrap)
271+
- name: Self-host test (v0.0.16 builds current)
272272
run: |
273-
brew install xmake
274-
xmake --version
275-
276-
- name: Bootstrap mcpp from source (xmake)
277-
run: |
278-
export LLVM_ROOT="$LLVM_ROOT"
279-
bash scripts/bootstrap-macos.sh "$LLVM_ROOT"
280-
./target/bootstrap/bin/mcpp --version
273+
# Download v0.0.16 macOS mcpp to bootstrap
274+
WORK=$(mktemp -d)
275+
curl -fsSL -o "$WORK/mcpp.tar.gz" \
276+
"https://github.com/mcpp-community/mcpp/releases/download/v0.0.16/mcpp-0.0.16-macosx-arm64.tar.gz"
277+
tar -xzf "$WORK/mcpp.tar.gz" -C "$WORK"
278+
BOOTSTRAP="$WORK/mcpp-0.0.16-macosx-arm64/bin/mcpp"
279+
test -x "$BOOTSTRAP"
280+
"$BOOTSTRAP" --version
281+
# Build current source with bootstrap mcpp
282+
export PATH="$(dirname "$BOOTSTRAP"):$PATH"
283+
mcpp build
284+
# Verify the newly built binary
285+
SELFHOST=$(find target -path "*/bin/mcpp" | head -1)
286+
test -x "$SELFHOST"
287+
"$SELFHOST" --version
288+
echo ":: Self-host successful!"

.github/workflows/release.yml

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -315,47 +315,23 @@ jobs:
315315
LLVM_ROOT=$(find "$HOME/.xlings" -path "*/xpkgs/xim-x-llvm/*/bin/clang++" | head -1 | xargs dirname | xargs dirname)
316316
echo "LLVM_ROOT=$LLVM_ROOT" >> "$GITHUB_ENV"
317317
318-
- name: Install xmake
318+
- name: Bootstrap mcpp from v0.0.16 release
319319
run: |
320-
brew install xmake
321-
xmake --version
322-
323-
- name: Build mcpp with xmake + LLVM
320+
# Download the v0.0.16 macOS binary to bootstrap this build
321+
WORK=$(mktemp -d)
322+
curl -fsSL -o "$WORK/mcpp.tar.gz" \
323+
"https://github.com/mcpp-community/mcpp/releases/download/v0.0.16/mcpp-0.0.16-macosx-arm64.tar.gz"
324+
tar -xzf "$WORK/mcpp.tar.gz" -C "$WORK"
325+
BOOTSTRAP="$WORK/mcpp-0.0.16-macosx-arm64/bin/mcpp"
326+
test -x "$BOOTSTRAP"
327+
"$BOOTSTRAP" --version
328+
export PATH="$(dirname "$BOOTSTRAP"):$PATH"
329+
echo "PATH=$(dirname "$BOOTSTRAP"):$PATH" >> "$GITHUB_ENV"
330+
331+
- name: Build mcpp (self-host via v0.0.16)
324332
run: |
325-
# Generate xmake.lua if not present
326-
if [ ! -f xmake.lua ]; then
327-
cat > xmake.lua << 'EOF'
328-
add_rules("mode.release")
329-
set_languages("c++23")
330-
331-
package("cmdline")
332-
set_homepage("https://github.com/mcpplibs/cmdline")
333-
set_description("Modern C++ command-line parsing library")
334-
set_license("Apache-2.0")
335-
add_urls("https://github.com/mcpplibs/cmdline/archive/refs/tags/$(version).tar.gz")
336-
add_versions("0.0.1", "3fb2f5495c1a144485b3cbb2e43e27059151633460f702af0f3851cbff387ef0")
337-
on_install(function (package)
338-
import("package.tools.xmake").install(package)
339-
end)
340-
package_end()
341-
342-
add_requires("cmdline 0.0.1")
343-
344-
target("mcpp")
345-
set_kind("binary")
346-
add_files("src/main.cpp")
347-
add_files("src/**.cppm")
348-
add_packages("cmdline")
349-
add_includedirs("src/libs/json")
350-
set_policy("build.c++.modules", true)
351-
EOF
352-
fi
353-
354-
xmake f -y -m release --toolchain=llvm --sdk="$LLVM_ROOT"
355-
xmake build -y mcpp
356-
357-
# Locate and verify built binary
358-
MCPP_BIN=$(find build -name mcpp -type f -perm +111 | head -1)
333+
mcpp build
334+
MCPP_BIN=$(find target -path "*/bin/mcpp" | head -1)
359335
test -x "$MCPP_BIN"
360336
file "$MCPP_BIN"
361337
"$MCPP_BIN" --version

0 commit comments

Comments
 (0)