Initial commit.

This commit is contained in:
Signal 2025-12-09 16:32:47 -05:00
commit d99b70eaa1
33 changed files with 2291 additions and 0 deletions

120
tools/update_deps.sh Normal file
View file

@ -0,0 +1,120 @@
#!/usr/bin/env bash
set -e
CMAKE="$HOME/Downloads/cmake-3.28.3-macos-universal/CMake.app/Contents/bin/cmake"
DEPS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../deps" && pwd)"
mkdir -p "$DEPS_DIR"
cd $DEPS_DIR
# GLFW
if [ ! -d "glfw/build" ] || [ ! -f "glfw/build/src/libglfw3.a" ]; then
echo "Building GLFW..."
if [ ! -d "glfw" ]; then
echo " Cloning GLFW 3.4..."
git clone --depth 1 --branch 3.4 https://github.com/glfw/glfw.git glfw
else
echo " Updating GLFW..."
git -C glfw pull
fi
cd glfw
mkdir -p build
cd build
"$CMAKE" .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=OFF \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_DOCS=OFF \
-DGLFW_INSTALL=ON \
-DGLFW_BUILD_COCOA=ON \
-DCMAKE_INSTALL_PREFIX="$DEPS_DIR/glfw/install"
make -j$(sysctl -n hw.logicalcpu)
make install # installs libglfw3.a + headers into $DEPS_DIR/glfw/install
cd ../..
echo "GLFW built and installed to $DEPS_DIR/glfw/install"
else
echo "GLFW already built skipping."
fi
# If you don't use -L, using curl to access 'modern' websites can get very annoying.
if [ ! -d "$DEPS_DIR/webgpu" ]; then
mkdir -p "$DEPS_DIR/webgpu"
curl -L https://github.com/gfx-rs/wgpu-native/releases/download/v27.0.2.0/wgpu-macos-aarch64-debug.zip -o "$DEPS_DIR/webgpu/wgpu-macos-aarch64-debug.zip"
cd webgpu
unzip wgpu-macos-aarch64-debug.zip
rm wgpu-macos-aarch64-debug.zip
cd ..
fi
# glfw3webgpu helper
if [ ! -d "$DEPS_DIR/glfw3webgpu" ]; then
git clone --depth 1 https://github.com/eliemichel/glfw3webgpu.git "$DEPS_DIR/glfw3webgpu"
else
git -C "$DEPS_DIR/glfw3webgpu" pull
fi
# Nuklear (single header)
curl -L https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/master/nuklear.h -o "$DEPS_DIR/nuklear.h"
if [ ! -d "glm" ]; then
git clone --depth 1 https://github.com/g-truc/glm.git glm
else
git -C glm fetch origin
git -C glm reset --hard origin/master
fi
# Cista (serialization)
curl -L https://github.com/felixguendling/cista/releases/download/v0.16/cista.h -o "$DEPS_DIR/cista.h"
# ================================================================
# ngtcp2 + ngtcp2_crypto_openssl (static libraries)
# ================================================================
if [ ! -d "ngtcp2/build" ] || [ ! -f "ngtcp2/build/libngtcp2.a" ]; then
echo "Building ngtcp2 (with OpenSSL crypto backend)..."
if [ ! -d "ngtcp2" ]; then
echo " Cloning ngtcp2..."
git clone --depth 1 --branch v1.9.0 https://github.com/ngtcp2/ngtcp2.git ngtcp2
else
echo " Updating ngtcp2..."
git -C ngtcp2 pull
fi
cd ngtcp2
# Ensure we have the submodules (crypto/openssl)
git submodule update --init --depth 1
mkdir -p build
cd build
# Static-only build, disable examples/tests, enable gnutls backend
$CMAKE .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_STATIC_LIBS=ON \
-DENABLE_EXAMPLES=OFF \
-DENABLE_TEST=OFF \
-DENABLE_OPENSSL=OFF \
-DENABLE_GNUTLS=ON \
-DGNUTLS_LIBRARY=$HOME/homebrew/Cellar/gnutls/3.8.11/lib/libgnutls.dylib \
-DGNUTLS_INCLUDE_DIR=$HOME/homebrew/Cellar/gnutls/3.8.11/include \
-DCMAKE_INSTALL_PREFIX="$DEPS_DIR/ngtcp2/install"
make -j$(sysctl -n hw.logicalcpu)
make install # installs headers + .a files into $DEPS_DIR/ngtcp2/install
cd ../../
echo "ngtcp2 built and installed to $DEPS_DIR/ngtcp2/install"
else
echo "ngtcp2 already built skipping."
fi
echo "All dependencies updated."