From 7b0c9b121c65e61340fdb005fc8653caf9bc1a3d Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Sat, 3 Jul 2021 23:58:53 +0800 Subject: [PATCH] Preliminary support for M1 builds NOTE: I don't have an M1 box right now, so I can only test with a non-`/usr/local` _Intel_ Homebrew install. This takes care of the "`cc` shim forbids `/usr/local` paths unless `HOMEBREW_PREFIX` is the same", but there may be other M1-specific issues. --- lib/fuse-pkg-config | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 lib/fuse-pkg-config diff --git a/lib/fuse-pkg-config b/lib/fuse-pkg-config new file mode 100755 index 0000000..4f5bb66 --- /dev/null +++ b/lib/fuse-pkg-config @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +fuse_root=%FUSE_ROOT% + +# Collect args +pkgs=() +flags=() + +for a in "$@"; do + [[ $a == -* ]] && flags+=("$a") || pkgs+=("$a") +done + +if [[ ${#pkgs[@]} -eq 0 ]]; then + pkg-config "${flags[@]}" +else + for p in "${pkgs[@]}"; do + if [[ $p == fuse ]]; then + pkg-config "${flags[@]}" "$p" | sed "s@/usr/local@${fuse_root}@g" + else + pkg-config "${flags[@]}" "$p" + fi + done +fi