This commit is contained in:
Henry Hiles 2026-08-08 17:29:42 -04:00
commit 29a276ff08
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -1,19 +1,22 @@
#!/bin/sh #!/bin/bash
# Precision shim for lipo to handle read-only frameworks from Nix store.
# See: https://github.com/NixOS/nixpkgs/issues/405066
echo "LIPO SHIM: $@" >&2 # If the upstream issue is fixed and the file is already writable,
# this script will still work gracefully.
for arg in "$@"; do for arg in "$@"; do
case "$arg" in # Check if we are acting on a Flutter binary within a framework
*/*.framework/*) if [[ "$arg" == *"Flutter.framework/Flutter" || "$arg" == *"FlutterMacOS.framework/FlutterMacOS" ]]; then
fw_dir="${arg%.framework/*}.framework" # Identify the framework directory
echo "LIPO SHIM: chmod $fw_dir" >&2 FW_DIR=$(echo "$arg" | sed 's|/Flutter$||; s|/FlutterMacOS$||')
chmod -R u+w "$fw_dir" 2>/dev/null
;; if [ -d "$FW_DIR" ]; then
*.lipo) # Make the framework and its contents writable
echo "LIPO SHIM: chmod $(dirname "$arg")" >&2 chmod -R +w "$FW_DIR" 2>/dev/null
chmod u+w "$(dirname "$arg")" 2>/dev/null fi
;; fi
esac
done done
# Pass through to the real lipo tool
exec /usr/bin/lipo "$@" exec /usr/bin/lipo "$@"