diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 69ff25041f3503e82752a6862b5bd227f3142d01..87da7e7005c2f1535d45a0ee8a750b7f834e33d8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,7 @@ jobs: uses: actions/checkout@v3 - name: Run Build Script - run: ./ci/macos/build.sh + run: ./ci/macos/build-x86_64.sh macos-aarch64: runs-on: [self-hosted, macOS, aarch64] env: @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@v3 - name: Run Build Script - run: ./ci/macos/build.sh + run: ./ci/macos/build-aarch64.sh # windows: # runs-on: [self-hosted, Windows, x64] # env: diff --git a/ci/macos/build-aarch64.sh b/ci/macos/build-aarch64.sh new file mode 100755 index 0000000000000000000000000000000000000000..74695c35b42225497ba3910041b4d82bd50ab2e5 --- /dev/null +++ b/ci/macos/build-aarch64.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +set -x +set -e + +echo "Running on Version:" $MACOS_VERSION + +# Script assumes the presence of the following: +# s3cmd + +ZIGDIR="$(pwd)" +TARGET="$ARCH-macos-none" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" +PREFIX="$HOME/$CACHE_BASENAME" +ZIG="$PREFIX/bin/zig" + +cd $ZIGDIR + +# Make the `zig version` number consistent. +# This will affect the cmake command below. +git config core.abbrev 9 +git fetch --unshallow || true +git fetch --tags + +mkdir build +cd build +$HOME/local/bin/cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-release" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ + -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +$HOME/local/bin/ninja install + +stage3-release/bin/zig build test docs \ + --zig-lib-dir "$(pwd)/../lib" \ + -Denable-macos-sdk \ + -Dstatic-llvm \ + -Dskip-non-native \ + --search-prefix "$PREFIX" + +# Produce the experimental std lib documentation. +mkdir -p "stage3-release/doc/std" +stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \ + --zig-lib-dir "$(pwd)/../lib" \ + -femit-docs="$(pwd)/stage3-release/doc/std" \ + -fno-emit-bin diff --git a/ci/macos/build-x86_64.sh b/ci/macos/build-x86_64.sh new file mode 100755 index 0000000000000000000000000000000000000000..f3fe092df334e3fbe415c43716d061a9f45620cd --- /dev/null +++ b/ci/macos/build-x86_64.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +set -x +set -e + +echo "Running on Version:" $MACOS_VERSION + +# Script assumes the presence of the following: +# s3cmd + +ZIGDIR="$(pwd)" +TARGET="$ARCH-macos-none" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" +PREFIX="$HOME/$CACHE_BASENAME" +JOBS="-j2" + +rm -rf $PREFIX +cd $HOME + +curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" +tar xf "$CACHE_BASENAME.tar.xz" + +ZIG="$PREFIX/bin/zig" + +cd $ZIGDIR + +# Make the `zig version` number consistent. +# This will affect the cmake command below. +git config core.abbrev 9 +git fetch --unshallow || true +git fetch --tags + +mkdir build +cd build +$HOME/local/bin/cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-release" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ + -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON + +make $JOBS install + +stage3-release/bin/zig build test docs \ + --zig-lib-dir "$(pwd)/../lib" \ + -Denable-macos-sdk \ + -Dstatic-llvm \ + -Dskip-non-native \ + --search-prefix "$PREFIX" + +# Produce the experimental std lib documentation. +mkdir -p "stage3-release/doc/std" +stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \ + --zig-lib-dir "$(pwd)/../lib" \ + -femit-docs="$(pwd)/stage3-release/doc/std" \ + -fno-emit-bin diff --git a/ci/macos/build.sh b/ci/macos/build.sh deleted file mode 100755 index feda987c0602770148e173341b03604372589a41..0000000000000000000000000000000000000000 --- a/ci/macos/build.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -set -x -set -e - -echo "Running on Version:" $MACOS_VERSION - -# Script assumes the presence of the following: -# s3cmd - -ZIGDIR="$(pwd)" -TARGET="$ARCH-macos-none" -MCPU="baseline" -CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" -PREFIX="$HOME/$CACHE_BASENAME" -JOBS="-j2" - -rm -rf $PREFIX -cd $HOME - -curl -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" -tar xf "$CACHE_BASENAME.tar.xz" - -ZIG="$PREFIX/bin/zig" -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -cd $ZIGDIR - -# Make the `zig version` number consistent. -# This will affect the cmake command below. -git config core.abbrev 9 -git fetch --unshallow || true -git fetch --tags - -mkdir build -cd build -cmake .. \ - -DCMAKE_INSTALL_PREFIX="stage3-release" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON - -# Now cmake will use zig as the C/C++ compiler. We reset the environment variables -# so that installation and testing do not get affected by them. -unset CC -unset CXX - -make $JOBS install - -stage3-release/bin/zig build test docs \ - --zig-lib-dir "$(pwd)/../lib" \ - -Denable-macos-sdk \ - -Dstatic-llvm \ - -Dskip-non-native \ - --search-prefix "$PREFIX" - -# Produce the experimental std lib documentation. -mkdir -p "stage3-release/doc/std" -stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \ - --zig-lib-dir "$(pwd)/../lib" \ - -femit-docs="$(pwd)/stage3-release/doc/std" \ - -fno-emit-bin \ No newline at end of file