zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob 2fe38f21 (2014B) - Raw


      1 #!/bin/sh
      2 
      3 set -x
      4 set -e
      5 
      6 # Script assumes the presence of the following:
      7 # s3cmd 
      8 
      9 ZIGDIR="$(pwd)"
     10 TARGET="$ARCH-macos-none"
     11 MCPU="baseline"
     12 CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.534+b0b1cc356-1"
     13 PREFIX="$HOME/$CACHE_BASENAME"
     14 ZIG="$PREFIX/bin/zig"
     15 
     16 cd $ZIGDIR
     17 
     18 # Make the `zig version` number consistent.
     19 # This will affect the cmake command below.
     20 git config core.abbrev 9
     21 git fetch --unshallow || true
     22 git fetch --tags
     23 
     24 mkdir build
     25 cd build
     26 
     27 # Override the cache directories because they won't actually help other CI runs
     28 # which will be testing alternate versions of zig, and ultimately would just
     29 # fill up space on the hard drive for no reason.
     30 export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
     31 export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
     32 
     33 PATH="$HOME/local/bin:$PATH" cmake .. \
     34   -DCMAKE_INSTALL_PREFIX="stage3-release" \
     35   -DCMAKE_PREFIX_PATH="$PREFIX" \
     36   -DCMAKE_BUILD_TYPE=Release \
     37   -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \
     38   -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \
     39   -DZIG_TARGET_TRIPLE="$TARGET" \
     40   -DZIG_TARGET_MCPU="$MCPU" \
     41   -DZIG_STATIC=ON \
     42   -GNinja
     43 
     44 $HOME/local/bin/ninja install
     45 
     46 stage3-release/bin/zig build test docs \
     47   --zig-lib-dir "$(pwd)/../lib" \
     48   -Denable-macos-sdk \
     49   -Dstatic-llvm \
     50   -Dskip-non-native \
     51   --search-prefix "$PREFIX"
     52 
     53 # Produce the experimental std lib documentation.
     54 stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
     55 
     56 # Ensure that stage3 and stage4 are byte-for-byte identical.
     57 stage3-release/bin/zig build \
     58   --prefix stage4-release \
     59   -Denable-llvm \
     60   -Dno-lib \
     61   -Drelease \
     62   -Dstrip \
     63   -Dtarget=$TARGET \
     64   -Duse-zig-libcxx \
     65   -Dversion-string="$(stage3-release/bin/zig version)"
     66 
     67 # diff returns an error code if the files differ.
     68 echo "If the following command fails, it means nondeterminism has been"
     69 echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
     70 diff stage3-release/bin/zig stage4-release/bin/zig