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
case "$arg" in
*/*.framework/*)
fw_dir="${arg%.framework/*}.framework"
echo "LIPO SHIM: chmod $fw_dir" >&2
chmod -R u+w "$fw_dir" 2>/dev/null
;;
*.lipo)
echo "LIPO SHIM: chmod $(dirname "$arg")" >&2
chmod u+w "$(dirname "$arg")" 2>/dev/null
;;
esac
# Check if we are acting on a Flutter binary within a framework
if [[ "$arg" == *"Flutter.framework/Flutter" || "$arg" == *"FlutterMacOS.framework/FlutterMacOS" ]]; then
# Identify the framework directory
FW_DIR=$(echo "$arg" | sed 's|/Flutter$||; s|/FlutterMacOS$||')
if [ -d "$FW_DIR" ]; then
# Make the framework and its contents writable
chmod -R +w "$FW_DIR" 2>/dev/null
fi
fi
done
# Pass through to the real lipo tool
exec /usr/bin/lipo "$@"