build: update to zig-0.13 and update zig wrapper from flow
This commit is contained in:
parent
15e8cad161
commit
4e83920d46
2 changed files with 40 additions and 14 deletions
|
|
@ -1 +1 @@
|
||||||
0.13.0-dev.363+7fc3fb955
|
0.13.0
|
||||||
|
|
|
||||||
36
zig
36
zig
|
|
@ -6,7 +6,25 @@ ARCH=$(uname -m)
|
||||||
BASEDIR="$(cd "$(dirname "$0")" && pwd)"
|
BASEDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
ZIGDIR=$BASEDIR/.cache/zig
|
ZIGDIR=$BASEDIR/.cache/zig
|
||||||
VERSION=$(<build.zig.version)
|
VERSION=$(<build.zig.version)
|
||||||
ZIGVER="zig-linux-$ARCH-$VERSION"
|
|
||||||
|
OS=$(uname)
|
||||||
|
|
||||||
|
if [ "$OS" == "Linux" ]; then
|
||||||
|
OS=linux
|
||||||
|
elif [ "$OS" == "Darwin" ]; then
|
||||||
|
OS=macos
|
||||||
|
elif [ "$OS" == "FreeBSD" ]; then
|
||||||
|
OS=freebsd
|
||||||
|
if [ "$ARCH" == "amd64" ]; then
|
||||||
|
ARCH=x86_64
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ARCH" == "arm64" ]; then
|
||||||
|
ARCH=aarch64
|
||||||
|
fi
|
||||||
|
|
||||||
|
ZIGVER="zig-$OS-$ARCH-$VERSION"
|
||||||
ZIG=$ZIGDIR/$ZIGVER/zig
|
ZIG=$ZIGDIR/$ZIGVER/zig
|
||||||
|
|
||||||
if [ "$1" == "update" ]; then
|
if [ "$1" == "update" ]; then
|
||||||
|
|
@ -14,10 +32,12 @@ if [ "$1" == "update" ] ; then
|
||||||
NEWVERSION=$(<build.zig.version)
|
NEWVERSION=$(<build.zig.version)
|
||||||
|
|
||||||
if [ "$VERSION" != "$NEWVERSION" ]; then
|
if [ "$VERSION" != "$NEWVERSION" ]; then
|
||||||
|
echo "zig version updated from $VERSION to $NEWVERSION"
|
||||||
|
echo "rebuilding to update cdb..."
|
||||||
$0 cdb
|
$0 cdb
|
||||||
exec $0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo zig version $VERSION is up-to-date
|
echo "zig version $VERSION is up-to-date"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -26,6 +46,9 @@ get_zig() {
|
||||||
mkdir -p "$ZIGDIR"
|
mkdir -p "$ZIGDIR"
|
||||||
cd "$ZIGDIR"
|
cd "$ZIGDIR"
|
||||||
TARBALL="https://ziglang.org/builds/$ZIGVER.tar.xz"
|
TARBALL="https://ziglang.org/builds/$ZIGVER.tar.xz"
|
||||||
|
if [ "$OS" == "freebsd" ]; then
|
||||||
|
TARBALL="https://ziglang.org/download/$VERSION/$ZIGVER.tar.xz"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d "$ZIGVER" ]; then
|
if [ ! -d "$ZIGVER" ]; then
|
||||||
curl "$TARBALL" | tar -xJ
|
curl "$TARBALL" | tar -xJ
|
||||||
|
|
@ -36,12 +59,15 @@ get_zig
|
||||||
|
|
||||||
if [ "$1" == "cdb" ]; then
|
if [ "$1" == "cdb" ]; then
|
||||||
rm -rf zig-cache
|
rm -rf zig-cache
|
||||||
rm -rf zig-bin
|
|
||||||
rm -rf .cache/cdb
|
rm -rf .cache/cdb
|
||||||
|
|
||||||
$ZIG build
|
$ZIG build
|
||||||
|
|
||||||
(echo \[ ; cat .cache/cdb/* ; echo {}\]) | perl -0777 -pe 's/,\n\{\}//igs' | jq . | grep -v 'no-default-config' > compile_commands.json
|
(
|
||||||
|
echo \[
|
||||||
|
cat .cache/cdb/*
|
||||||
|
echo {}\]
|
||||||
|
) | perl -0777 -pe 's/,\n\{\}//igs' | jq . | grep -v 'no-default-config' >compile_commands.json
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue