Bug 1356191 - better platform detection for gyp, r=mt
--- a/build.sh
+++ b/build.sh
@@ -44,25 +44,28 @@ clean=0
rebuild_gyp=0
rebuild_nspr=0
target=Debug
verbose=0
fuzz=0
fuzz_tls=0
fuzz_oss=0
no_local_nspr=0
+armhf=0
gyp_params=(--depth="$cwd" --generator-output=".")
nspr_params=()
ninja_params=()
# try to guess sensible defaults
arch=$(python "$cwd"/coreconf/detect_host_arch.py)
if [ "$arch" = "x64" -o "$arch" = "aarch64" ]; then
build_64=1
+elif [ "$arch" = "arm" ]; then
+ armhf=1
fi
# parse command line arguments
while [ $# -gt 0 ]; do
case $1 in
-c) clean=1 ;;
--gyp|-g) rebuild_gyp=1 ;;
--nspr) nspr_clean; rebuild_nspr=1 ;;
@@ -96,17 +99,17 @@ done
if [ "$opt_build" = 1 ]; then
target=Release
else
target=Debug
fi
if [ "$build_64" = 1 ]; then
nspr_params+=(--enable-64bit)
-else
+elif [ ! "$armhf" = 1 ]; then
gyp_params+=(-Dtarget_arch=ia32)
fi
if [ "$fuzz" = 1 ]; then
source "$cwd"/coreconf/fuzz.sh
fi
# set paths
target_dir="$cwd"/out/$target
--- a/coreconf/config.gypi
+++ b/coreconf/config.gypi
@@ -136,16 +136,57 @@
'-lc',
],
}],
[ 'fuzz==1', {
'variables': {
'debug_optimization_level%': '1',
},
}],
+ [ 'target_arch=="ia32" or target_arch=="x64"', {
+ 'defines': [
+ 'NSS_X86_OR_X64',
+ ],
+ # For Windows.
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'PreprocessorDefinitions': [
+ 'NSS_X86_OR_X64',
+ ],
+ },
+ },
+ }],
+ [ 'target_arch=="ia32"', {
+ 'defines': [
+ 'NSS_X86',
+ ],
+ # For Windows.
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'PreprocessorDefinitions': [
+ 'NSS_X86',
+ ],
+ },
+ },
+ }],
+ [ 'target_arch=="x64"', {
+ 'defines': [
+ 'NSS_X64',
+ 'NSS_USE_64',
+ ],
+ # For Windows.
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'PreprocessorDefinitions': [
+ 'NSS_X64',
+ 'NSS_USE_64',
+ ],
+ },
+ },
+ }],
],
'target_conditions': [
# If we want to properly export a static library, and copy it to lib,
# we need to mark it as a 'standalone_static_library'. Otherwise,
# the relative paths in the thin archive will break linking.
[ '_type=="shared_library"', {
'product_dir': '<(nss_dist_obj_dir)/lib'
}, '_type=="executable"', {
--- a/lib/freebl/freebl.gyp
+++ b/lib/freebl/freebl.gyp
@@ -153,18 +153,16 @@
'MP_API_COMPATIBLE'
],
'conditions': [
[ 'OS=="win" and target_arch=="ia32"', {
'msvs_settings': {
'VCCLCompilerTool': {
#TODO: -Ox optimize flags
'PreprocessorDefinitions': [
- 'NSS_X86_OR_X64',
- 'NSS_X86',
'MP_ASSEMBLY_MULTIPLY',
'MP_ASSEMBLY_SQUARE',
'MP_ASSEMBLY_DIV_2DX1D',
'MP_USE_UINT_DIGIT',
'MP_NO_MP_WORD',
'USE_HW_AES',
'INTEL_GCM',
],
@@ -172,50 +170,44 @@
},
}],
[ 'OS=="win" and target_arch=="x64"', {
'msvs_settings': {
'VCCLCompilerTool': {
#TODO: -Ox optimize flags
'PreprocessorDefinitions': [
'NSS_USE_64',
- 'NSS_X86_OR_X64',
- 'NSS_X64',
'MP_IS_LITTLE_ENDIAN',
'NSS_BEVAND_ARCFOUR',
'MPI_AMD64',
'MP_ASSEMBLY_MULTIPLY',
'NSS_USE_COMBA',
'USE_HW_AES',
'INTEL_GCM',
],
},
},
}],
[ 'OS!="win"', {
'conditions': [
[ 'target_arch=="x64"', {
'defines': [
'NSS_USE_64',
- 'NSS_X86_OR_X64',
- 'NSS_X64',
+ ],
+ }],
+ [ 'target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64"', {
+ 'defines': [
# The Makefile does version-tests on GCC, but we're not doing that here.
'HAVE_INT128_SUPPORT',
],
}, {
'sources': [
'ecl/uint128.c',
],
}],
- [ 'target_arch=="ia32"', {
- 'defines': [
- 'NSS_X86_OR_X64',
- 'NSS_X86',
- ],
- }],
],
}],
[ 'OS=="linux"', {
'defines': [
'FREEBL_LOWHASH',
'FREEBL_NO_DEPEND',
],
}],
@@ -246,16 +238,17 @@
],
}],
[ 'target_arch=="arm"', {
'defines': [
'MP_ASSEMBLY_MULTIPLY',
'MP_ASSEMBLY_SQUARE',
'MP_USE_UINT_DIGIT',
'SHA_NO_LONG_LONG',
+ 'ARMHF',
],
}],
[ 'target_arch=="arm64" or target_arch=="aarch64"', {
'defines': [
'NSS_USE_64',
],
}],
],
--- a/lib/jar/jar.gyp
+++ b/lib/jar/jar.gyp
@@ -21,56 +21,13 @@
'<(DEPTH)/exports.gyp:nss_exports'
]
}
],
'target_defaults': {
'defines': [
'MOZILLA_CLIENT=1',
],
- 'conditions': [
- [ 'OS=="win"', {
- 'configurations': {
- 'x86_Base': {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'PreprocessorDefinitions': [
- 'NSS_X86_OR_X64',
- 'NSS_X86',
- ],
- },
- },
- },
- 'x64_Base': {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'PreprocessorDefinitions': [
- 'NSS_USE_64',
- 'NSS_X86_OR_X64',
- 'NSS_X64',
- ],
- },
- },
- },
- },
- }, {
- 'conditions': [
- [ 'target_arch=="x64"', {
- 'defines': [
- 'NSS_USE_64',
- 'NSS_X86_OR_X64',
- 'NSS_X64',
- ],
- }],
- [ 'target_arch=="ia32"', {
- 'defines': [
- 'NSS_X86_OR_X64',
- 'NSS_X86',
- ],
- }],
- ],
- }],
- ],
},
'variables': {
'module': 'nss'
}
}