Compare commits

..

No commits in common. "7da13f44e8462d1ac0cac87c6f00cc4fcb62b0f9" and "6eadc0fe29795f88752f3b6f296dc582b16cb5a1" have entirely different histories.

4 changed files with 76 additions and 18 deletions

1
build.zig.version Normal file
View file

@ -0,0 +1 @@
0.15.1

View file

@ -1,13 +1,12 @@
.{
.name = .thespian,
.version = "0.0.1",
.minimum_zig_version = "0.15.2",
.fingerprint = 0xe9ff00fd8e4e01a3,
.dependencies = .{
.cbor = .{
.url = "git+https://github.com/neurocyte/cbor?ref=master#b6fc137250b7d3f70459652ee78c7b6cd9ad2826",
.hash = "cbor-1.0.0-RcQE_HwwAQAiNkKC9ezLxHUMkWgHeVa3QyTfv4hi3VZR",
.url = "git+https://github.com/neurocyte/cbor?ref=master#7d2eeb68c8a2fb3f4d6baad6cc04c521b92974c0",
.hash = "cbor-1.0.0-RcQE_AswAQAPlqBCZXYQf9DZXn-0Ubt8Mk03ZcJWcsAG",
},
.asio = .{
.url = "git+https://github.com/neurocyte/asio#0f1cbf24e5fb6fabe7078a20b76452f42e24a0df",

15
cdb
View file

@ -1,15 +0,0 @@
#!/bin/bash
set -e
rm -rf .zig-cache
rm -rf .cache/cdb
mkdir -p .cache/cdb
zig build
(
echo \[
cat .cache/cdb/*
echo {}\]
) | perl -0777 -pe 's/,\n\{\}//igs' | jq . | grep -v 'no-default-config' >compile_commands.json
exit 0

73
zig Executable file
View file

@ -0,0 +1,73 @@
#!/bin/bash
set -e
ARCH=$(uname -m)
BASEDIR="$(cd "$(dirname "$0")" && pwd)"
ZIGDIR=$BASEDIR/.cache/zig
VERSION=$(<build.zig.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-$ARCH-$OS-$VERSION"
ZIG=$ZIGDIR/$ZIGVER/zig
if [ "$1" == "update" ]; then
curl -L --silent https://ziglang.org/download/index.json | jq -r '.master | .version' >build.zig.version
NEWVERSION=$(<build.zig.version)
if [ "$VERSION" != "$NEWVERSION" ]; then
echo "zig version updated from $VERSION to $NEWVERSION"
echo "rebuilding to update cdb..."
$0 cdb
exit 0
fi
echo "zig version $VERSION is up-to-date"
exit 0
fi
get_zig() {
(
mkdir -p "$ZIGDIR"
cd "$ZIGDIR"
TARBALL="https://ziglang.org/download/$VERSION/$ZIGVER.tar.xz"
if echo "$VERSION" | grep '\-dev\.' >&/dev/null; then
TARBALL="https://ziglang.org/builds/$ZIGVER.tar.xz"
fi
if [ ! -d "$ZIGVER" ]; then
curl "$TARBALL" | tar -xJ
fi
)
}
get_zig
if [ "$1" == "cdb" ]; then
rm -rf .zig-cache
rm -rf .cache/cdb
$ZIG build
(
echo \[
cat .cache/cdb/*
echo {}\]
) | perl -0777 -pe 's/,\n\{\}//igs' | jq . | grep -v 'no-default-config' >compile_commands.json
exit 0
fi
exec $ZIG "$@"