From ba751e079f19586fbf1ca2a4f61962db8d13df63 Mon Sep 17 00:00:00 2001 From: jamylak Date: Thu, 15 Jan 2026 17:43:08 +1100 Subject: [PATCH 1/4] Ignore `scripts/**` folder changes for github workflows --- .github/workflows/linux-docker-ci.yml | 2 ++ .github/workflows/linux-smoke-tests.yml | 2 ++ .github/workflows/macos-ci.yml | 2 ++ .github/workflows/nix-flake-ci.yml | 1 + .github/workflows/windows-build-test.yml | 2 ++ 5 files changed, 9 insertions(+) diff --git a/.github/workflows/linux-docker-ci.yml b/.github/workflows/linux-docker-ci.yml index 91634bb..e631da2 100644 --- a/.github/workflows/linux-docker-ci.yml +++ b/.github/workflows/linux-docker-ci.yml @@ -6,6 +6,7 @@ on: - main - master paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' @@ -14,6 +15,7 @@ on: branches: - main paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' diff --git a/.github/workflows/linux-smoke-tests.yml b/.github/workflows/linux-smoke-tests.yml index 6ee148f..877e165 100644 --- a/.github/workflows/linux-smoke-tests.yml +++ b/.github/workflows/linux-smoke-tests.yml @@ -4,12 +4,14 @@ on: push: branches: [main, master] paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' - '.github/workflows/release.yml' pull_request: paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index 6becc6d..1211867 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -6,6 +6,7 @@ on: - main - master paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' @@ -14,6 +15,7 @@ on: branches: - main paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' diff --git a/.github/workflows/nix-flake-ci.yml b/.github/workflows/nix-flake-ci.yml index 02cb7b1..1bdad01 100644 --- a/.github/workflows/nix-flake-ci.yml +++ b/.github/workflows/nix-flake-ci.yml @@ -4,6 +4,7 @@ on: push: branches: [main, master] paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' diff --git a/.github/workflows/windows-build-test.yml b/.github/workflows/windows-build-test.yml index e73d33b..e35178c 100644 --- a/.github/workflows/windows-build-test.yml +++ b/.github/workflows/windows-build-test.yml @@ -6,6 +6,7 @@ on: - main - master paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' @@ -14,6 +15,7 @@ on: branches: - main paths-ignore: + - 'scripts/**' - '**.md' - 'LICENSE' - '.gitignore' From ad4e6f82de459d33e1b9d5d3c60773baf932fde9 Mon Sep 17 00:00:00 2001 From: jamylak Date: Thu, 15 Jan 2026 17:43:48 +1100 Subject: [PATCH 2/4] macos bundle shell script for local debugging --- scripts/bundle_macos.sh | 152 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100755 scripts/bundle_macos.sh diff --git a/scripts/bundle_macos.sh b/scripts/bundle_macos.sh new file mode 100755 index 0000000..f705c32 --- /dev/null +++ b/scripts/bundle_macos.sh @@ -0,0 +1,152 @@ +#!/bin/bash +set -e + +# macOS bundling script - replicates the GitHub Actions workflow logic +# Usage: ./scripts/bundle_macos.sh [build_dir] [release_dir] + +BUILD_DIR="${1:-build}" +RELEASE_DIR="${2:-release/macos}" + +echo "📦 macOS Binary Bundling Script" +echo "================================" +echo "Build directory: $BUILD_DIR" +echo "Release directory: $RELEASE_DIR" +echo "" + +# Check if binary exists +if [ ! -f "$BUILD_DIR/vsdf" ]; then + echo "❌ Error: $BUILD_DIR/vsdf not found" + echo "Please build the project first with: cmake -B build -DCMAKE_BUILD_TYPE=Release . && cmake --build build" + exit 1 +fi + +# Create libs directory +mkdir -p "$RELEASE_DIR/libs" + +# Copy the binary +cp "$BUILD_DIR/vsdf" "$RELEASE_DIR/" + +echo "📋 Libraries linked BEFORE bundling:" +otool -L "$BUILD_DIR/vsdf" +echo "" + +# Recursively find and copy all non-system dylibs +echo "🔍 Finding and bundling dynamic libraries..." + +# Function to copy a library and its dependencies +copy_lib_recursive() { + local lib="$1" + local libname=$(basename "$lib") + + # Skip if already copied + if [ -f "$RELEASE_DIR/libs/$libname" ]; then + return + fi + + # Skip system libraries + if [[ "$lib" == /System/* ]] || [[ "$lib" == /usr/lib/* ]] || [[ "$lib" == /Library/Apple/* ]]; then + return + fi + + # Copy the library + if [ -f "$lib" ]; then + echo " → Copying $libname" + cp "$lib" "$RELEASE_DIR/libs/" + + # Recursively copy dependencies of this library + otool -L "$lib" | tail -n +2 | awk '{print $1}' | while read -r dep; do + if [ -f "$dep" ]; then + copy_lib_recursive "$dep" + fi + done + fi +} + +# Get initial list of libraries from the binary +otool -L "$BUILD_DIR/vsdf" | tail -n +2 | awk '{print $1}' | while read -r lib; do + if [ -f "$lib" ]; then + copy_lib_recursive "$lib" + fi +done + +BUNDLED_COUNT=$(ls "$RELEASE_DIR/libs"/*.dylib 2>/dev/null | wc -l | xargs) +echo "" +echo "Total libraries bundled: $BUNDLED_COUNT" +echo "" + +# Fix all library paths to use @rpath +echo "🔧 Fixing library paths..." + +# Set rpath on the binary to look in libs/ folder next to the executable +# Only add if it doesn't already exist +if ! otool -l "$RELEASE_DIR/vsdf" | grep -q "@executable_path/libs"; then + echo " Adding @executable_path/libs to rpath" + install_name_tool -add_rpath "@executable_path/libs" "$RELEASE_DIR/vsdf" +else + echo " @executable_path/libs already in rpath" +fi + +# Fix paths in the main binary +for lib in "$RELEASE_DIR/libs"/*.dylib; do + libname=$(basename "$lib") + # Find the original path in the binary + ORIG_PATH=$(otool -L "$RELEASE_DIR/vsdf" | grep "$libname" | awk '{print $1}') + if [ ! -z "$ORIG_PATH" ]; then + echo " Fixing $libname in vsdf: $ORIG_PATH -> @rpath/$libname" + install_name_tool -change "$ORIG_PATH" "@rpath/$libname" "$RELEASE_DIR/vsdf" + fi +done + +# Fix inter-library dependencies +for lib in "$RELEASE_DIR/libs"/*.dylib; do + libname=$(basename "$lib") + + # Fix the library's own id + install_name_tool -id "@rpath/$libname" "$lib" + + # Fix references to other bundled libraries + for otherlib in "$RELEASE_DIR/libs"/*.dylib; do + othername=$(basename "$otherlib") + ORIG_PATH=$(otool -L "$lib" | grep "$othername" | awk '{print $1}') + if [ ! -z "$ORIG_PATH" ] && [ "$ORIG_PATH" != "@rpath/$othername" ]; then + echo " Fixing $othername in $libname: $ORIG_PATH -> @rpath/$othername" + install_name_tool -change "$ORIG_PATH" "@rpath/$othername" "$lib" + fi + done +done + +echo "Ad-hoc signing binary and libraries..." +# Ad-hoc sign all libraries +for lib in release/macos/libs/*.dylib; do + echo "Signing $(basename "$lib")" + codesign --force --sign - "$lib" +done + +# Ad-hoc sign the main binary +echo "Signing vsdf" +codesign --force --sign - release/macos/vsdf + +echo "Verifying signatures..." +codesign -v release/macos/vsdf +for lib in release/macos/libs/*.dylib; do + codesign -v "$lib" +done + +echo "" +echo "✓ Bundling complete" +echo "" +echo "📦 Binary info:" +file "$RELEASE_DIR/vsdf" +ls -lh "$RELEASE_DIR/vsdf" +echo "" +echo "📚 Bundled libraries:" +ls -lh "$RELEASE_DIR/libs/" +echo "" +echo "🔗 Binary dependencies after fixing:" +otool -L "$RELEASE_DIR/vsdf" + +echo "" +echo "🎉 Done! To package the release:" +echo " cp -r shaders $RELEASE_DIR/" +echo " cp README.md LICENSE $RELEASE_DIR/" +echo " cd release && tar -czf vsdf-macos-$(uname -m).tar.gz macos/" From f5bbebf9174092675015f4a0398fae25b75ea148 Mon Sep 17 00:00:00 2001 From: jamylak Date: Thu, 15 Jan 2026 17:43:58 +1100 Subject: [PATCH 3/4] quick test the branch in workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ad4dc6..046d901 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: tags: - 'v*' branches: - - 'release-binaries-04' + - 'mac-binary-02' workflow_dispatch: jobs: From 0b66ee918578ff95db79bedd01acf6b6ea54d28b Mon Sep 17 00:00:00 2001 From: jamylak Date: Thu, 15 Jan 2026 17:44:14 +1100 Subject: [PATCH 4/4] bundle a bunch of stuff for mac --- .github/workflows/release.yml | 100 ++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 046d901..df86fbb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -240,41 +240,65 @@ jobs: # Copy the binary cp build/vsdf release/macos/ - # Find and copy all non-system dylibs - echo "Bundling dynamic libraries..." + echo "📋 Libraries linked BEFORE bundling:" + otool -L build/vsdf + echo "" - # Get list of dynamic libraries (excluding system ones) - DYLIBS=$(otool -L build/vsdf | grep -E "(glslang|spirv-tools|ffmpeg|libav)" | awk '{print $1}') + # Recursively find and copy all non-system dylibs + echo "🔍 Finding and bundling dynamic libraries..." - for lib in $DYLIBS; do + # Function to copy a library and its dependencies + copy_lib_recursive() { + local lib="$1" + local libname=$(basename "$lib") + + # Skip if already copied + if [ -f "release/macos/libs/$libname" ]; then + return + fi + + # Skip system libraries + if [[ "$lib" == /System/* ]] || [[ "$lib" == /usr/lib/* ]] || [[ "$lib" == /Library/Apple/* ]]; then + return + fi + + # Copy the library if [ -f "$lib" ]; then - libname=$(basename "$lib") - if [ -f "release/macos/libs/$libname" ]; then - echo "Already copied $libname" - else - echo "Copying $libname" - cp "$lib" release/macos/libs/ - fi - - # Also copy any dependencies of this library - SUB_DYLIBS=$(otool -L "$lib" | grep -E "(glslang|spirv-tools|ffmpeg|libav)" | awk '{print $1}') - for sublib in $SUB_DYLIBS; do - if [ -f "$sublib" ]; then - sublibname=$(basename "$sublib") - if [ ! -f "release/macos/libs/$sublibname" ]; then - echo "Copying dependency $sublibname" - cp "$sublib" release/macos/libs/ - fi + echo " → Copying $libname" + cp "$lib" release/macos/libs/ + + # Recursively copy dependencies of this library + otool -L "$lib" | tail -n +2 | awk '{print $1}' | while read -r dep; do + if [ -f "$dep" ]; then + copy_lib_recursive "$dep" fi done fi + } + + # Get initial list of libraries from the binary + otool -L build/vsdf | tail -n +2 | awk '{print $1}' | while read -r lib; do + if [ -f "$lib" ]; then + copy_lib_recursive "$lib" + fi done + BUNDLED_COUNT=$(ls release/macos/libs/*.dylib 2>/dev/null | wc -l | xargs) + echo "" + echo "Total libraries bundled: $BUNDLED_COUNT" + echo "" + # Fix all library paths to use @rpath - echo "Fixing library paths..." + echo "🔧 Fixing library paths..." - # Set rpath on the binary to look next to the executable - install_name_tool -add_rpath "@executable_path" release/macos/vsdf + # Set rpath on the binary to look in libs/ folder next to the executable + # Only add if it doesn't already exist + if ! otool -l release/macos/vsdf | grep -q "@executable_path/libs"; then + echo " Adding @executable_path/libs to rpath" + install_name_tool -add_rpath "@executable_path/libs" release/macos/vsdf + else + echo " @executable_path/libs already in rpath" + fi # Fix paths in the main binary for lib in release/macos/libs/*.dylib; do @@ -282,34 +306,40 @@ jobs: # Find the original path in the binary ORIG_PATH=$(otool -L release/macos/vsdf | grep "$libname" | awk '{print $1}') if [ ! -z "$ORIG_PATH" ]; then - echo "Fixing $libname in vsdf" - install_name_tool -change "$ORIG_PATH" "@rpath/libs/$libname" release/macos/vsdf + echo " Fixing $libname in vsdf: $ORIG_PATH -> @rpath/$libname" + install_name_tool -change "$ORIG_PATH" "@rpath/$libname" release/macos/vsdf fi done # Fix inter-library dependencies for lib in release/macos/libs/*.dylib; do libname=$(basename "$lib") - echo "Fixing paths in $libname" # Fix the library's own id - install_name_tool -id "@rpath/libs/$libname" "$lib" + install_name_tool -id "@rpath/$libname" "$lib" # Fix references to other bundled libraries for otherlib in release/macos/libs/*.dylib; do othername=$(basename "$otherlib") ORIG_PATH=$(otool -L "$lib" | grep "$othername" | awk '{print $1}') - if [ ! -z "$ORIG_PATH" ] && [ "$ORIG_PATH" != "@rpath/libs/$othername" ]; then - install_name_tool -change "$ORIG_PATH" "@rpath/libs/$othername" "$lib" + if [ ! -z "$ORIG_PATH" ] && [ "$ORIG_PATH" != "@rpath/$othername" ]; then + echo " Fixing $othername in $libname: $ORIG_PATH -> @rpath/$othername" + install_name_tool -change "$ORIG_PATH" "@rpath/$othername" "$lib" fi done done - echo "Bundle complete!" - echo "Bundled libraries:" + echo "" + echo "✓ Bundling complete" + echo "" + echo "📦 Binary info:" + file release/macos/vsdf + ls -lh release/macos/vsdf + echo "" + echo "📚 Bundled libraries:" ls -lh release/macos/libs/ - - echo "Binary dependencies after fixing:" + echo "" + echo "🔗 Binary dependencies after fixing:" otool -L release/macos/vsdf - name: Code sign binaries