Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bug 1315231 - fix gyp build on windows. r=franziskus
--HG--
extra : rebase_source : 89b75fbb446e982ee5e7bd15a8eb2d404075c9a6
  • Loading branch information
luser committed Nov 9, 2016
1 parent 0bc2367 commit 579df04
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 106 deletions.
1 change: 0 additions & 1 deletion build.sh
Expand Up @@ -109,7 +109,6 @@ else
target=Debug
fi
if [ "$build_64" == "1" ]; then
target="${target}_x64"
nspr_opt+=(--enable-64bit)
else
gyp_params+=(-Dtarget_arch=ia32)
Expand Down
10 changes: 7 additions & 3 deletions coreconf/check_cc_clang.py
Expand Up @@ -2,11 +2,15 @@

import os
import subprocess
import sys

def main():
cc = os.environ.get('CC', 'cc')
cc_is_clang = 'clang' in subprocess.check_output([cc, '--version'])
print int(cc_is_clang)
if sys.platform == 'win32':
print 0
else:
cc = os.environ.get('CC', 'cc')
cc_is_clang = 'clang' in subprocess.check_output([cc, '--version'])
print int(cc_is_clang)

if __name__ == '__main__':
main()
108 changes: 51 additions & 57 deletions coreconf/config.gypi
Expand Up @@ -215,7 +215,7 @@
'default_configuration': 'Debug',
'configurations': {
# Common settings for Debug+Release should go here.
'Common_Base': {
'Common': {
'abstract': 1,
'defines': [
'NSS_NO_INIT_SUPPORT',
Expand Down Expand Up @@ -379,7 +379,37 @@
'conditions': [
[ 'disable_werror==0', {
'cflags': ['-WX']
}]
}],
[ 'target_arch=="ia32"', {
'msvs_configuration_platform': 'Win32',
'msvs_settings': {
'VCLinkerTool': {
'MinimumRequiredVersion': '5.01', # XP.
'TargetMachine': '1',
'ImageHasSafeExceptionHandlers': 'false',
},
'VCCLCompilerTool': {
'PreprocessorDefinitions': [
'WIN32',
],
},
},

}],
[ 'target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
'msvs_settings': {
'VCLinkerTool': {
'TargetMachine': '17', # x86-64
},
'VCCLCompilerTool': {
'PreprocessorDefinitions': [
'WIN64',
'_AMD64_',
],
},
},
}],
],
}],
[ 'disable_dbm==1', {
Expand All @@ -394,41 +424,9 @@
}],
],
},
# Common settings for x86 should go here.
'x86_Base': {
'abstract': 1,
'msvs_settings': {
'VCLinkerTool': {
'MinimumRequiredVersion': '5.01', # XP.
'TargetMachine': '1',
},
'VCCLCompilerTool': {
'PreprocessorDefinitions': [
'WIN32',
],
},
},
'msvs_configuration_platform': 'Win32',
},
# Common settings for x86-64 should go here.
'x64_Base': {
'abstract': 1,
'msvs_configuration_platform': 'x64',
'msvs_settings': {
'VCLinkerTool': {
'TargetMachine': '17', # x86-64
},
'VCCLCompilerTool': {
'PreprocessorDefinitions': [
'WIN64',
'_AMD64_',
],
},
},
},
# Common settings for debug should go here.
'Debug_Base': {
'abstract': 1,
'Debug': {
'inherit_from': ['Common'],
'conditions': [
[ 'OS=="linux" or OS=="android"', {
'cflags': [
Expand Down Expand Up @@ -458,9 +456,9 @@
},
},
},
# Common settings for release should go here.n
'Release_Base': {
'abstract': 1,
# Common settings for release should go here.
'Release': {
'inherit_from': ['Common'],
'defines': [
'NDEBUG',
],
Expand All @@ -478,24 +476,20 @@
},
},
},
#
# Concrete configurations
#
# These configurations shouldn't have anything in them, it should
# all be derived from the _Base configurations above.
'Debug': {
'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
},
'Release': {
'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
},
# The gyp ninja backend requires these.
'Debug_x64': {
'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
},
'Release_x64': {
'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
},
'conditions': [
[ 'OS=="win"', {
# The gyp ninja backend requires these.
# TODO: either we should support building both 32/64-bit as
# configurations from the same gyp build, or we should fix
# upstream gyp to not require these.
'Debug_x64': {
'inherit_from': ['Debug'],
},
'Release_x64': {
'inherit_from': ['Release'],
},
}],
],
},
},
'conditions': [
Expand Down
9 changes: 6 additions & 3 deletions coreconf/shlibsign.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -18,10 +18,13 @@ def sign(lib_file):
bin_path = os.path.realpath(os.path.join(ld_lib_path, '../bin'))

env = os.environ.copy()
env['LD_LIBRARY_PATH'] = env['DYLD_LIBRARY_PATH'] = ld_lib_path
if sys.platform == 'win32':
env['PATH'] = os.pathsep.join((env['PATH'], ld_lib_path))
else:
env['LD_LIBRARY_PATH'] = env['DYLD_LIBRARY_PATH'] = ld_lib_path

dev_null = open(os.devnull, 'wb')
subprocess.Popen([os.path.join(bin_path, 'shlibsign'), '-v', '-i', lib_file], env=env, stdout=dev_null, stderr=dev_null).wait()
subprocess.check_call([os.path.join(bin_path, 'shlibsign'), '-v', '-i', lib_file], env=env, stdout=dev_null, stderr=dev_null)

if __name__ == '__main__':
main()
77 changes: 35 additions & 42 deletions lib/freebl/freebl.gyp
Expand Up @@ -289,47 +289,44 @@
'MP_API_COMPATIBLE'
],
'conditions': [
[ 'OS=="win"', {
'configurations': {
'x86_Base': {
'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',
],
},
},
[ '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',
],
},
'x64_Base': {
'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" 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': [
Expand Down Expand Up @@ -392,10 +389,6 @@
}],
],
}],
[ 'OS=="mac"', {
}],
[ 'OS=="win"', {
}],
],
},
'variables': {
Expand Down
1 change: 1 addition & 0 deletions nss.gyp
Expand Up @@ -133,6 +133,7 @@
'actions': [
{
'action_name': 'shlibsign',
'msvs_cygwin_shell': 0,
'inputs': [
'<(nss_dist_obj_dir)/lib/<(dll_prefix)freebl3.<(dll_suffix)',
'<(nss_dist_obj_dir)/lib/<(dll_prefix)freeblpriv3.<(dll_suffix)',
Expand Down

0 comments on commit 579df04

Please sign in to comment.