@@ -315,37 +315,63 @@ 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 (for bootstrap)
319- run : brew install xmake
320-
321- - name : Bootstrap-compile mcpp (xmake + LLVM)
318+ - name : Install xmake
322319 run : |
323- export LLVM_ROOT="$LLVM_ROOT"
324- bash scripts/bootstrap-macos.sh "$LLVM_ROOT"
325- ./target/bootstrap/bin/mcpp --version
320+ brew install xmake
321+ xmake --version
326322
327- - name : Self-host rebuild ( mcpp builds mcpp)
323+ - name : Build mcpp with xmake + LLVM
328324 run : |
329- # Put bootstrapped mcpp on PATH so build.ninja can find it for dyndep
330- export PATH="$PWD/target/bootstrap/bin:$PATH"
331- mcpp build
332- # Find the self-hosted binary
333- SELFHOST=$(find target -path "*/bin/mcpp" -not -path "*/bootstrap/*" -not -path "*/build/*" | head -1)
334- test -x "$SELFHOST"
335- "$SELFHOST" --version
336- echo "SELFHOST=$SELFHOST" >> "$GITHUB_ENV"
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)
359+ test -x "$MCPP_BIN"
360+ file "$MCPP_BIN"
361+ "$MCPP_BIN" --version
362+ echo "MCPP_BIN=$MCPP_BIN" >> "$GITHUB_ENV"
337363
338364 - name : Package macOS release
339365 id : stage
340366 run : |
341367 VERSION="${{ steps.resolve.outputs.version }}"
342- TARBALL_NAME="mcpp-${VERSION}-darwin -arm64.tar.gz"
343- WRAPPER="mcpp-${VERSION}-darwin -arm64"
368+ TARBALL_NAME="mcpp-${VERSION}-macosx -arm64.tar.gz"
369+ WRAPPER="mcpp-${VERSION}-macosx -arm64"
344370
345371 # Create release layout
346372 STAGING=$(mktemp -d)
347373 mkdir -p "$STAGING/$WRAPPER/bin"
348- cp "$SELFHOST " "$STAGING/$WRAPPER/bin/mcpp"
374+ cp "$MCPP_BIN " "$STAGING/$WRAPPER/bin/mcpp"
349375 # Strip (Mach-O)
350376 strip "$STAGING/$WRAPPER/bin/mcpp" 2>/dev/null || true
351377 # Copy metadata
@@ -371,10 +397,10 @@ jobs:
371397 mkdir -p dist
372398 (cd "$STAGING" && tar -czf "$GITHUB_WORKSPACE/dist/${TARBALL_NAME}" "$WRAPPER")
373399 # Versionless alias
374- cp "dist/${TARBALL_NAME}" "dist/mcpp-darwin -arm64.tar.gz"
400+ cp "dist/${TARBALL_NAME}" "dist/mcpp-macosx -arm64.tar.gz"
375401 # SHA256
376402 (cd dist && shasum -a 256 "${TARBALL_NAME}" > "${TARBALL_NAME}.sha256")
377- (cd dist && shasum -a 256 "mcpp-darwin -arm64.tar.gz" > "mcpp-darwin -arm64.tar.gz.sha256")
403+ (cd dist && shasum -a 256 "mcpp-macosx -arm64.tar.gz" > "mcpp-macosx -arm64.tar.gz.sha256")
378404
379405 echo "tarball=${TARBALL_NAME}" >> "$GITHUB_OUTPUT"
380406 ls -la dist/
@@ -394,7 +420,7 @@ jobs:
394420 with :
395421 tag_name : ${{ steps.resolve.outputs.tag }}
396422 files : |
397- dist/mcpp-${{ steps.resolve.outputs.version }}-darwin -arm64.tar.gz
398- dist/mcpp-${{ steps.resolve.outputs.version }}-darwin -arm64.tar.gz.sha256
399- dist/mcpp-darwin -arm64.tar.gz
400- dist/mcpp-darwin -arm64.tar.gz.sha256
423+ dist/mcpp-${{ steps.resolve.outputs.version }}-macosx -arm64.tar.gz
424+ dist/mcpp-${{ steps.resolve.outputs.version }}-macosx -arm64.tar.gz.sha256
425+ dist/mcpp-macosx -arm64.tar.gz
426+ dist/mcpp-macosx -arm64.tar.gz.sha256
0 commit comments