ci: macos: take advantage of zig-bootstrap

master
Andrew Kelley 2020-10-14 02:25:51 -07:00
parent 0f4386875f
commit bf8cc73cf3
1 changed files with 18 additions and 10 deletions

View File

@ -3,26 +3,23 @@
set -x
set -e
brew install s3cmd gcc@10
brew install s3cmd
ZIGDIR="$(pwd)"
LLVMVER="11.0.0"
ARCH="x86_64"
CACHE_BASENAME="llvm+clang+lld-$LLVMVER-$ARCH-macosx-gcc10-release"
CACHE_BASENAME="zig+llvm+lld+clang-$ARCH-macos-gnu-0.6.0+0f4386875f"
PREFIX="$HOME/$CACHE_BASENAME"
JOBS="-j2"
# I tried using the system default compiler (clang), but it couldn't statically link libc++.
# So we use gcc-10 from homebrew.
export CC=gcc-10
export CXX=g++-10
rm -rf $PREFIX
cd $HOME
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
tar xf "$CACHE_BASENAME.tar.xz"
ZIG="$PREFIX/bin/zig"
export CC="$ZIG cc"
export CXX="$ZIG c++"
cd $ZIGDIR
# Make the `zig version` number consistent.
@ -31,7 +28,18 @@ git config core.abbrev 9
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON -DZIG_TARGET_TRIPLE=x86_64-macos.10.15.7-gnu
cmake .. \
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DCMAKE_CROSSCOMPILING=True \
-DCMAKE_SYSTEM_NAME="Darwin" \
-DCMAKE_AR="$PREFIX/bin/llvm-ar" \
-DCMAKE_RANLIB="$PREFIX/bin/llvm-ranlib" \
-DCMAKE_BUILD_TYPE=Release \
-DZIG_TARGET_TRIPLE="$ARCH-macos.10.15.7-gnu" \
-DZIG_TARGET_MCPU="baseline" \
-DZIG_EXECUTABLE="$ZIG"
make $JOBS install
release/bin/zig build test