zig

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

blob 074e80d1 (1670B) - Raw


      1 #!/bin/sh
      2 
      3 set -x
      4 set -e
      5 
      6 ARCH="$(uname -m)"
      7 DEPS_LOCAL="/deps/local"
      8 OLD_ZIG="$DEPS_LOCAL/bin/zig"
      9 TARGET="${ARCH}-linux-musl"
     10 MCPU="baseline"
     11 
     12 export PATH=$DEPS_LOCAL/bin:$PATH
     13 
     14 echo "building stage3-debug with zig version $($OLD_ZIG version)"
     15 
     16 # Override the cache directories so that we don't clobber with the release
     17 # testing script which is running concurrently and in the same directory.
     18 # Normally we want processes to cooperate, but in this case we want them isolated.
     19 export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-cache-local-debug"
     20 export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-cache-global-debug"
     21 
     22 export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
     23 export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
     24 
     25 mkdir build-debug
     26 cd build-debug
     27 cmake .. \
     28   -DCMAKE_INSTALL_PREFIX="$(pwd)/stage3" \
     29   -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
     30   -DCMAKE_BUILD_TYPE=Debug \
     31   -DZIG_STATIC=ON \
     32   -DZIG_USE_LLVM_CONFIG=OFF \
     33   -GNinja
     34 
     35 # Now cmake will use zig as the C/C++ compiler. We reset the environment variables
     36 # so that installation and testing do not get affected by them.
     37 unset CC
     38 unset CXX
     39 
     40 ninja install
     41 
     42 echo "Looking for non-conforming code formatting..."
     43 stage3/bin/zig fmt --check .. \
     44   --exclude ../test/cases/ \
     45   --exclude ../build-debug \
     46   --exclude ../build-release \
     47   --exclude "$ZIG_LOCAL_CACHE_DIR" \
     48   --exclude "$ZIG_GLOBAL_CACHE_DIR"
     49 
     50 # simultaneously test building self-hosted without LLVM and with 32-bit arm
     51 stage3/bin/zig build -Dtarget=arm-linux-musleabihf
     52 
     53 stage3/bin/zig build test \
     54   -fqemu \
     55   -fwasmtime \
     56   -Dstatic-llvm \
     57   -Dtarget=native-native-musl \
     58   --search-prefix "$DEPS_LOCAL"
     59 
     60 # Explicit exit helps show last command duration.
     61 exit