Postinstall script
# Build xxhash-wrapper via Meson/Ninja
WRAPPER_DIR="vendor/xxhash-wrapper"
BUILD_DIR="build"
# Step 1: Initialize and update outer submodule (xxhash-wrapper)
if [ -d .git ]; then
git submodule update --init --recursive "$WRAPPER_DIR" || true
fi
# Step 2: Initialize the NESTED xxHash submodule inside xxhash-wrapper
# xxhash-wrapper has its own vendor/xxHash which contains the actual xxHash source
cd "$WRAPPER_DIR"
git submodule update --init --recursive vendor/xxHash || true
cd - >/dev/null
# Step 3: Build with Meson
cd "$WRAPPER_DIR"
meson setup build --wipe 2>/dev/null || meson setup build
meson compile -C build
# Keep a stable static archive path expected by Crystal link flags
if [ -f "$BUILD_DIR/libxxh3_wrapper_static.a" ] && [ ! -f "$BUILD_DIR/libxxh3_wrapper.a" ]; then
ln -sf libxxh3_wrapper_static.a "$BUILD_DIR/libxxh3_wrapper.a"
fi
cd - >/dev/null
# CLI symlinks
mkdir -p bin
ln -sf xxhsum ./bin/xxh32sum
ln -sf xxhsum ./bin/xxh64sum
ln -sf xxhsum ./bin/xxh128sum
ln -sf xxhsum ./bin/xxh3sum