vcpkg/ports/nss/macos-cross-compile.patch

35 lines
1.2 KiB
Diff

--- a/nss/build.sh
+++ b/nss/build.sh
@@ -66,6 +66,7 @@
sslkeylogfile=1
gyp_params=(--depth="$cwd" --generator-output=".")
+gyp_flavor=
ninja_params=()
# Assume that MSVC is wanted if this is running on windows.
@@ -134,6 +135,7 @@
--mozilla-central) gyp_params+=(-Dmozilla_central=1) ;;
--python) python="$2"; shift ;;
--python=*) python="${1#*=}" ;;
+ -DOS=*) gyp_params+=("$1"); gyp_flavor="${1#-DOS=}" ;;
-D*) gyp_params+=("$1") ;;
*) show_help; exit 2 ;;
esac
@@ -275,7 +277,14 @@
set_nspr_path "$obj_dir/include/nspr:$obj_dir/lib"
fi
- run_verbose run_scanbuild ${GYP} -f ninja "${gyp_params[@]}" "$cwd/nss.gyp"
+ # On macOS, gyp defaults to "mac" flavor which emits Xcode-specific flags
+ # and tools (libtool, -arch, etc.) incompatible with cross-compilation targets.
+ gyp_format=ninja
+ if [ "$(uname -s)" = "Darwin" ] && [ -n "$gyp_flavor" ] && [ "$gyp_flavor" != "mac" ]; then
+ gyp_format="ninja-${gyp_flavor}"
+ export GYP_CROSSCOMPILE=1
+ fi
+ run_verbose run_scanbuild ${GYP} -f "$gyp_format" "${gyp_params[@]}" "$cwd/nss.gyp"
mv -f "$gyp_config.new" "$gyp_config"
fi