[nss] Fix cross-compilation from macOS (e.g. arm64-android) (#49775)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
逐雁南飛 2026-02-04 08:06:47 +08:00 committed by GitHub
parent 610f8a9b9f
commit 59bcbef0b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,34 @@
--- 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

View File

@ -21,6 +21,7 @@ vcpkg_extract_source_archive(
"02-gen-debug-info-for-release.patch"
"03-use-debug-crt-for-debug.patch" # See https://learn.microsoft.com/dotnet/api/microsoft.visualstudio.vcprojectengine.runtimelibraryoption
include-dirs.diff
macos-cross-compile.patch
)
file(GLOB devendor "${SOURCE_PATH}/nss/lib/sqlite/*.?" "${SOURCE_PATH}/nss/lib/zlib/*.?")
file(REMOVE ${devendor})

View File

@ -1,6 +1,7 @@
{
"name": "nss",
"version": "3.113.1",
"port-version": 1,
"description": "Network Security Services from Mozilla",
"homepage": "https://ftp.mozilla.org/pub/security/nss/releases/",
"license": "MPL-2.0",

View File

@ -6990,7 +6990,7 @@
},
"nss": {
"baseline": "3.113.1",
"port-version": 0
"port-version": 1
},
"nsync": {
"baseline": "1.30.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1cdf7d0e3caf9b7910f89c5b0ab9d8b41adaad46",
"version": "3.113.1",
"port-version": 1
},
{
"git-tree": "9ebeab29c2c5137eafaafbd20bde91f40a2faba1",
"version": "3.113.1",