Skip to content

Commit ab89b47

Browse files
committed
Upgrade gyp to b3cef02.
* adds netbsd support: https://codereview.chromium.org/1421073004 * fixes cp(1) use on openbsd: https://codereview.chromium.org/1483473002 Fixes: #571 Fixes: #803 PR-URL: #831 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent 90078ec commit ab89b47

10 files changed

+304
-103
lines changed

gyp/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Steven Knight <knight@baldmt.com>
99
Ryan Norton <rnorton10@gmail.com>
1010
David J. Sankel <david@sankelsoftware.com>
1111
Eric N. Vander Weele <ericvw@gmail.com>
12+
Tom Freudenberg <th.freudenberg@gmail.com>

gyp/pylib/gyp/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ def GetFlavor(params):
425425
return 'freebsd'
426426
if sys.platform.startswith('openbsd'):
427427
return 'openbsd'
428+
if sys.platform.startswith('netbsd'):
429+
return 'netbsd'
428430
if sys.platform.startswith('aix'):
429431
return 'aix'
430432

gyp/pylib/gyp/generator/analyzer.py

+213-80
Large diffs are not rendered by default.

gyp/pylib/gyp/generator/cmake.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
'CONFIGURATION_NAME': '${configuration}',
5656
}
5757

58-
FULL_PATH_VARS = ('${CMAKE_SOURCE_DIR}', '${builddir}', '${obj}')
58+
FULL_PATH_VARS = ('${CMAKE_CURRENT_LIST_DIR}', '${builddir}', '${obj}')
5959

6060
generator_supports_multiple_toolsets = True
6161
generator_wants_static_library_dependencies_adjusted = True
@@ -103,7 +103,7 @@ def NormjoinPathForceCMakeSource(base_path, rel_path):
103103
if any([rel_path.startswith(var) for var in FULL_PATH_VARS]):
104104
return rel_path
105105
# TODO: do we need to check base_path for absolute variables as well?
106-
return os.path.join('${CMAKE_SOURCE_DIR}',
106+
return os.path.join('${CMAKE_CURRENT_LIST_DIR}',
107107
os.path.normpath(os.path.join(base_path, rel_path)))
108108

109109

@@ -293,7 +293,7 @@ def WriteActions(target_name, actions, extra_sources, extra_deps,
293293
WriteVariable(output, inputs_name)
294294
output.write('\n')
295295

296-
output.write(' WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/')
296+
output.write(' WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/')
297297
output.write(path_to_gyp)
298298
output.write('\n')
299299

@@ -398,9 +398,9 @@ def WriteRules(target_name, rules, extra_sources, extra_deps,
398398
output.write(NormjoinPath(path_to_gyp, rule_source))
399399
output.write('\n')
400400

401-
# CMAKE_SOURCE_DIR is where the CMakeLists.txt lives.
401+
# CMAKE_CURRENT_LIST_DIR is where the CMakeLists.txt lives.
402402
# The cwd is the current build directory.
403-
output.write(' WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/')
403+
output.write(' WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/')
404404
output.write(path_to_gyp)
405405
output.write('\n')
406406

@@ -522,7 +522,7 @@ def __init__(self, ext, command):
522522
WriteVariable(output, copy.inputs_name, ' ')
523523
output.write('\n')
524524

525-
output.write('WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/')
525+
output.write('WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/')
526526
output.write(path_to_gyp)
527527
output.write('\n')
528528

@@ -1126,7 +1126,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data,
11261126
if cc:
11271127
SetVariable(output, 'CMAKE_ASM_COMPILER', cc)
11281128

1129-
SetVariable(output, 'builddir', '${CMAKE_BINARY_DIR}')
1129+
SetVariable(output, 'builddir', '${CMAKE_CURRENT_BINARY_DIR}')
11301130
SetVariable(output, 'obj', '${builddir}/obj')
11311131
output.write('\n')
11321132

gyp/pylib/gyp/generator/make.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps,
15791579
for link_dep in link_deps:
15801580
assert ' ' not in link_dep, (
15811581
"Spaces in alink input filenames not supported (%s)" % link_dep)
1582-
if (self.flavor not in ('mac', 'openbsd', 'win') and not
1582+
if (self.flavor not in ('mac', 'openbsd', 'netbsd', 'win') and not
15831583
self.is_standalone_static_library):
15841584
self.WriteDoCmd([self.output_binary], link_deps, 'alink_thin',
15851585
part_of_all, postbuilds=postbuilds)
@@ -2046,6 +2046,11 @@ def CalculateMakefilePath(build_file, base_name):
20462046
header_params.update({
20472047
'flock': 'lockf',
20482048
})
2049+
elif flavor == 'openbsd':
2050+
copy_archive_arguments = '-pPRf'
2051+
header_params.update({
2052+
'copy_archive_args': copy_archive_arguments,
2053+
})
20492054
elif flavor == 'aix':
20502055
copy_archive_arguments = '-pPRf'
20512056
header_params.update({

gyp/pylib/gyp/generator/ninja.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ def __init__(self, type):
139139
self.bundle = None
140140
# On Windows, incremental linking requires linking against all the .objs
141141
# that compose a .lib (rather than the .lib itself). That list is stored
142-
# here.
142+
# here. In this case, we also need to save the compile_deps for the target,
143+
# so that the the target that directly depends on the .objs can also depend
144+
# on those.
143145
self.component_objs = None
146+
self.compile_deps = None
144147
# Windows only. The import .lib is the output of a build step, but
145148
# because dependents only link against the lib (not both the lib and the
146149
# dll) we keep track of the import library here.
@@ -474,16 +477,17 @@ def WriteSpec(self, spec, config_name, generator_flags):
474477
elif self.flavor == 'mac' and len(self.archs) > 1:
475478
link_deps = collections.defaultdict(list)
476479

477-
480+
compile_deps = self.target.actions_stamp or actions_depends
478481
if self.flavor == 'win' and self.target.type == 'static_library':
479482
self.target.component_objs = link_deps
483+
self.target.compile_deps = compile_deps
480484

481485
# Write out a link step, if needed.
482486
output = None
483487
is_empty_bundle = not link_deps and not mac_bundle_depends
484488
if link_deps or self.target.actions_stamp or actions_depends:
485489
output = self.WriteTarget(spec, config_name, config, link_deps,
486-
self.target.actions_stamp or actions_depends)
490+
compile_deps)
487491
if self.is_mac_bundle:
488492
mac_bundle_depends.append(output)
489493

@@ -1093,6 +1097,7 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config,
10931097

10941098
implicit_deps = set()
10951099
solibs = set()
1100+
order_deps = set()
10961101

10971102
if 'dependencies' in spec:
10981103
# Two kinds of dependencies:
@@ -1111,6 +1116,8 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config,
11111116
target.component_objs and
11121117
self.msvs_settings.IsUseLibraryDependencyInputs(config_name)):
11131118
new_deps = target.component_objs
1119+
if target.compile_deps:
1120+
order_deps.add(target.compile_deps)
11141121
elif self.flavor == 'win' and target.import_lib:
11151122
new_deps = [target.import_lib]
11161123
elif target.UsesToc(self.flavor):
@@ -1249,6 +1256,7 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config,
12491256

12501257
ninja_file.build(output, command + command_suffix, link_deps,
12511258
implicit=list(implicit_deps),
1259+
order_only=list(order_deps),
12521260
variables=extra_bindings)
12531261
return linked_binary
12541262

@@ -1263,7 +1271,7 @@ def WriteTarget(self, spec, config_name, config, link_deps, compile_deps):
12631271
self.target.type = 'none'
12641272
elif spec['type'] == 'static_library':
12651273
self.target.binary = self.ComputeOutput(spec)
1266-
if (self.flavor not in ('mac', 'openbsd', 'win') and not
1274+
if (self.flavor not in ('mac', 'openbsd', 'netbsd', 'win') and not
12671275
self.is_standalone_static_library):
12681276
self.ninja.build(self.target.binary, 'alink_thin', link_deps,
12691277
order_only=compile_deps)

gyp/pylib/gyp/generator/xcode.py

+45-3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
'mac_framework_private_headers',
8888
]
8989

90+
generator_filelist_paths = None
91+
9092
# Xcode's standard set of library directories, which don't need to be duplicated
9193
# in LIBRARY_SEARCH_PATHS. This list is not exhaustive, but that's okay.
9294
xcode_standard_library_dirs = frozenset([
@@ -578,6 +580,26 @@ def PerformBuild(data, configurations, params):
578580
subprocess.check_call(arguments)
579581

580582

583+
def CalculateGeneratorInputInfo(params):
584+
toplevel = params['options'].toplevel_dir
585+
if params.get('flavor') == 'ninja':
586+
generator_dir = os.path.relpath(params['options'].generator_output or '.')
587+
output_dir = params.get('generator_flags', {}).get('output_dir', 'out')
588+
output_dir = os.path.normpath(os.path.join(generator_dir, output_dir))
589+
qualified_out_dir = os.path.normpath(os.path.join(
590+
toplevel, output_dir, 'gypfiles-xcode-ninja'))
591+
else:
592+
output_dir = os.path.normpath(os.path.join(toplevel, 'xcodebuild'))
593+
qualified_out_dir = os.path.normpath(os.path.join(
594+
toplevel, output_dir, 'gypfiles'))
595+
596+
global generator_filelist_paths
597+
generator_filelist_paths = {
598+
'toplevel': toplevel,
599+
'qualified_out_dir': qualified_out_dir,
600+
}
601+
602+
581603
def GenerateOutput(target_list, target_dicts, data, params):
582604
# Optionally configure each spec to use ninja as the external builder.
583605
ninja_wrapper = params.get('flavor') == 'ninja'
@@ -590,6 +612,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
590612
parallel_builds = generator_flags.get('xcode_parallel_builds', True)
591613
serialize_all_tests = \
592614
generator_flags.get('xcode_serialize_all_test_runs', True)
615+
upgrade_check_project_version = \
616+
generator_flags.get('xcode_upgrade_check_project_version', None)
617+
618+
# Format upgrade_check_project_version with leading zeros as needed.
619+
if upgrade_check_project_version:
620+
upgrade_check_project_version = str(upgrade_check_project_version)
621+
while len(upgrade_check_project_version) < 4:
622+
upgrade_check_project_version = '0' + upgrade_check_project_version
623+
593624
skip_excluded_files = \
594625
not generator_flags.get('xcode_list_excluded_files', True)
595626
xcode_projects = {}
@@ -604,9 +635,17 @@ def GenerateOutput(target_list, target_dicts, data, params):
604635
xcode_projects[build_file] = xcp
605636
pbxp = xcp.project
606637

638+
# Set project-level attributes from multiple options
639+
project_attributes = {};
607640
if parallel_builds:
608-
pbxp.SetProperty('attributes',
609-
{'BuildIndependentTargetsInParallel': 'YES'})
641+
project_attributes['BuildIndependentTargetsInParallel'] = 'YES'
642+
if upgrade_check_project_version:
643+
project_attributes['LastUpgradeCheck'] = upgrade_check_project_version
644+
project_attributes['LastTestingUpgradeCheck'] = \
645+
upgrade_check_project_version
646+
project_attributes['LastSwiftUpdateCheck'] = \
647+
upgrade_check_project_version
648+
pbxp.SetProperty('attributes', project_attributes)
610649

611650
# Add gyp/gypi files to project
612651
if not generator_flags.get('standalone'):
@@ -648,14 +687,17 @@ def GenerateOutput(target_list, target_dicts, data, params):
648687
'loadable_module': 'com.googlecode.gyp.xcode.bundle',
649688
'shared_library': 'com.apple.product-type.library.dynamic',
650689
'static_library': 'com.apple.product-type.library.static',
690+
'mac_kernel_extension': 'com.apple.product-type.kernel-extension',
651691
'executable+bundle': 'com.apple.product-type.application',
652692
'loadable_module+bundle': 'com.apple.product-type.bundle',
653693
'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test',
654694
'shared_library+bundle': 'com.apple.product-type.framework',
655695
'executable+extension+bundle': 'com.apple.product-type.app-extension',
656696
'executable+watch+extension+bundle':
657697
'com.apple.product-type.watchkit-extension',
658-
'executable+watch+bundle': 'com.apple.product-type.application.watchapp',
698+
'executable+watch+bundle':
699+
'com.apple.product-type.application.watchapp',
700+
'mac_kernel_extension+bundle': 'com.apple.product-type.kernel-extension',
659701
}
660702

661703
target_properties = {

gyp/pylib/gyp/input.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828

2929

3030
# A list of types that are treated as linkable.
31-
linkable_types = ['executable', 'shared_library', 'loadable_module']
31+
linkable_types = [
32+
'executable',
33+
'shared_library',
34+
'loadable_module',
35+
'mac_kernel_extension',
36+
]
3237

3338
# A list of sections that contain links to other targets.
3439
dependency_sections = ['dependencies', 'export_dependent_settings']
@@ -1724,11 +1729,12 @@ def _LinkDependenciesInternal(self, targets, include_shared_libraries,
17241729
dependencies.add(self.ref)
17251730
return dependencies
17261731

1727-
# Executables and loadable modules are already fully and finally linked.
1728-
# Nothing else can be a link dependency of them, there can only be
1729-
# dependencies in the sense that a dependent target might run an
1730-
# executable or load the loadable_module.
1731-
if not initial and target_type in ('executable', 'loadable_module'):
1732+
# Executables, mac kernel extensions and loadable modules are already fully
1733+
# and finally linked. Nothing else can be a link dependency of them, there
1734+
# can only be dependencies in the sense that a dependent target might run
1735+
# an executable or load the loadable_module.
1736+
if not initial and target_type in ('executable', 'loadable_module',
1737+
'mac_kernel_extension'):
17321738
return dependencies
17331739

17341740
# Shared libraries are already fully linked. They should only be included
@@ -2479,7 +2485,7 @@ def ValidateTargetType(target, target_dict):
24792485
"""
24802486
VALID_TARGET_TYPES = ('executable', 'loadable_module',
24812487
'static_library', 'shared_library',
2482-
'none')
2488+
'mac_kernel_extension', 'none')
24832489
target_type = target_dict.get('type', None)
24842490
if target_type not in VALID_TARGET_TYPES:
24852491
raise GypError("Target %s has an invalid target type '%s'. "

gyp/pylib/gyp/xcode_emulation.py

+1
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
14521452

14531453
# These are filled in on a as-needed basis.
14541454
env = {
1455+
'BUILT_FRAMEWORKS_DIR' : built_products_dir,
14551456
'BUILT_PRODUCTS_DIR' : built_products_dir,
14561457
'CONFIGURATION' : configuration,
14571458
'PRODUCT_NAME' : xcode_settings.GetProductName(),

gyp/pylib/gyp/xcodeproj_file.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ def __init__(self, properties=None, id=None, parent=None):
14921492
'icns': 'image.icns',
14931493
'java': 'sourcecode.java',
14941494
'js': 'sourcecode.javascript',
1495+
'kext': 'wrapper.kext',
14951496
'm': 'sourcecode.c.objc',
14961497
'mm': 'sourcecode.cpp.objcpp',
14971498
'nib': 'wrapper.nib',
@@ -1951,14 +1952,14 @@ class PBXCopyFilesBuildPhase(XCBuildPhase):
19511952
# path_tree_to_subfolder maps names of Xcode variables to the associated
19521953
# dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase object.
19531954
path_tree_to_subfolder = {
1955+
'BUILT_FRAMEWORKS_DIR': 10, # Frameworks Directory
19541956
'BUILT_PRODUCTS_DIR': 16, # Products Directory
19551957
# Other types that can be chosen via the Xcode UI.
19561958
# TODO(mark): Map Xcode variable names to these.
19571959
# : 1, # Wrapper
19581960
# : 6, # Executables: 6
19591961
# : 7, # Resources
19601962
# : 15, # Java Resources
1961-
# : 10, # Frameworks
19621963
# : 11, # Shared Frameworks
19631964
# : 12, # Shared Support
19641965
# : 13, # PlugIns
@@ -2262,6 +2263,8 @@ class PBXNativeTarget(XCTarget):
22622263
'', '.xctest'],
22632264
'com.googlecode.gyp.xcode.bundle': ['compiled.mach-o.dylib',
22642265
'', '.so'],
2266+
'com.apple.product-type.kernel-extension': ['wrapper.kext',
2267+
'', '.kext'],
22652268
}
22662269

22672270
def __init__(self, properties=None, id=None, parent=None,

0 commit comments

Comments
 (0)