Codebase list gyp / 707fd07
Imported Upstream version 0.1~svn1729 Jérémy Lal 10 years ago
45 changed file(s) with 598 addition(s) and 128 deletion(s). Raw diff Collapse all Expand all
+0
-19
MANIFEST less more
0 setup.py
1 gyp
2 LICENSE
3 AUTHORS
4 pylib/gyp/MSVSNew.py
5 pylib/gyp/MSVSProject.py
6 pylib/gyp/MSVSToolFile.py
7 pylib/gyp/MSVSUserFile.py
8 pylib/gyp/MSVSVersion.py
9 pylib/gyp/__init__.py
10 pylib/gyp/common.py
11 pylib/gyp/input.py
12 pylib/gyp/xcodeproj_file.py
13 pylib/gyp/generator/__init__.py
14 pylib/gyp/generator/gypd.py
15 pylib/gyp/generator/gypsh.py
16 pylib/gyp/generator/make.py
17 pylib/gyp/generator/msvs.py
18 pylib/gyp/generator/xcode.py
1414 import gyp
1515
1616 if __name__ == '__main__':
17 sys.exit(gyp.main(sys.argv[1:]))
17 sys.exit(gyp.script_main())
8282 # vcvars32, which it can only find if VS??COMNTOOLS is set, which it
8383 # isn't always.
8484 if target_arch == 'x86':
85 if self.short_name == '2013' and (
86 os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or
87 os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'):
88 # VS2013 non-Express has a x64-x86 cross that we want to prefer.
89 return [os.path.normpath(
90 os.path.join(self.path, 'VC/vcvarsall.bat')), 'amd64_x86']
91 # Otherwise, the standard x86 compiler.
8592 return [os.path.normpath(
8693 os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))]
8794 else:
541541 sys.stderr.write("gyp: %s\n" % e)
542542 return 1
543543
544 # NOTE: setuptools generated console_scripts calls function with no arguments
545 def script_main():
546 return main(sys.argv[1:])
547
544548 if __name__ == '__main__':
545 sys.exit(main(sys.argv[1:]))
549 sys.exit(script_main())
165165 quiet_cmd_link = LINK($(TOOLSET)) $@
166166 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
167167
168 # TODO(thakis): Find out and document the difference between shared_library and
169 # loadable_module on mac.
170168 quiet_cmd_solink = SOLINK($(TOOLSET)) $@
171169 cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
172170
173 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass
174 # -bundle -single_module here (for osmesa.so).
175171 quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
176 cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
172 cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
177173 """
178174
179175 LINK_COMMANDS_ANDROID = """\
248244 all_deps :=
249245
250246 %(make_global_settings)s
247
248 CC.target ?= %(CC.target)s
249 CFLAGS.target ?= $(CFLAGS)
250 CXX.target ?= %(CXX.target)s
251 CXXFLAGS.target ?= $(CXXFLAGS)
252 LINK.target ?= %(LINK.target)s
253 LDFLAGS.target ?= $(LDFLAGS)
254 AR.target ?= $(AR)
251255
252256 # C++ apps need to be linked with g++.
253257 #
259263 #
260264 # This will allow make to invoke N linker processes as specified in -jN.
261265 LINK ?= %(flock)s $(builddir)/linker.lock $(CXX.target)
262
263 CC.target ?= %(CC.target)s
264 CFLAGS.target ?= $(CFLAGS)
265 CXX.target ?= %(CXX.target)s
266 CXXFLAGS.target ?= $(CXXFLAGS)
267 LINK.target ?= %(LINK.target)s
268 LDFLAGS.target ?= $(LDFLAGS)
269 AR.target ?= $(AR)
270266
271267 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need
272268 # to replicate this environment fallback in make as well.
20031999 'CC.target': GetEnvironFallback(('CC_target', 'CC'), '$(CC)'),
20042000 'AR.target': GetEnvironFallback(('AR_target', 'AR'), '$(AR)'),
20052001 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'),
2006 'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'),
2002 'LINK.target': GetEnvironFallback(('LINK_target', 'LINK'), '$(LINK)'),
20072003 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'),
20082004 'AR.host': GetEnvironFallback(('AR_host',), 'ar'),
20092005 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'),
2010 'LINK.host': GetEnvironFallback(('LD_host',), 'g++'),
2006 'LINK.host': GetEnvironFallback(('LINK_host',), '$(CXX.host)'),
20112007 })
20122008
20132009 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
1414 import gyp.msvs_emulation
1515 import gyp.MSVSUtil as MSVSUtil
1616 import gyp.xcode_emulation
17 from cStringIO import StringIO
1718
1819 from gyp.common import GetEnvironFallback
1920 import gyp.ninja_syntax as ninja_syntax
209210 class NinjaWriter:
210211 def __init__(self, qualified_target, target_outputs, base_dir, build_dir,
211212 output_file, toplevel_build, output_file_name, flavor,
212 toplevel_dir=None):
213 deps_file=None, toplevel_dir=None):
213214 """
214215 base_dir: path from source root to directory containing this gyp file,
215216 by gyp semantics, all input paths are relative to this
243244 # Relative path from base dir to build dir.
244245 base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir)
245246 self.base_to_build = os.path.join(base_to_top, build_dir)
247 self.link_deps_file = deps_file
246248
247249 def ExpandSpecial(self, path, product_dir=None):
248250 """Expand specials like $!PRODUCT_DIR in |path|.
372374 self.target = Target(spec['type'])
373375 self.is_standalone_static_library = bool(
374376 spec.get('standalone_static_library', 0))
377 # Track if this target contains any C++ files, to decide if gcc or g++
378 # should be used for linking.
379 self.uses_cpp = False
375380
376381 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)
377382 self.xcode_settings = self.msvs_settings = None
390395 if len(self.archs) > 1:
391396 self.arch_subninjas = dict(
392397 (arch, ninja_syntax.Writer(
393 open(os.path.join(self.toplevel_build,
394 self._SubninjaNameForArch(arch)),
395 'w')))
398 OpenOutput(os.path.join(self.toplevel_build,
399 self._SubninjaNameForArch(arch)),
400 'w')))
396401 for arch in self.archs)
397402
398403 # Compute predepends for all rules.
472477
473478 # Write out a link step, if needed.
474479 output = None
475 is_empty_bundle = True
480 is_empty_bundle = not link_deps and not mac_bundle_depends
476481 if link_deps or self.target.actions_stamp or actions_depends:
477482 output = self.WriteTarget(spec, config_name, config, link_deps,
478483 self.target.actions_stamp or actions_depends)
479484 if self.is_mac_bundle:
480 is_empty_bundle = not link_deps and not mac_bundle_depends
481485 mac_bundle_depends.append(output)
482486
483487 # Bundle all of the above together, if needed.
529533 """Write out the Actions, Rules, and Copies steps. Return a path
530534 representing the outputs of these steps."""
531535 outputs = []
536 if self.is_mac_bundle:
537 mac_bundle_resources = spec.get('mac_bundle_resources', [])[:]
538 else:
539 mac_bundle_resources = []
532540 extra_mac_bundle_resources = []
533541
534542 if 'actions' in spec:
536544 extra_mac_bundle_resources)
537545 if 'rules' in spec:
538546 outputs += self.WriteRules(spec['rules'], extra_sources, prebuild,
547 mac_bundle_resources,
539548 extra_mac_bundle_resources)
540549 if 'copies' in spec:
541550 outputs += self.WriteCopies(spec['copies'], prebuild, mac_bundle_depends)
546555 stamp = self.WriteCollapsedDependencies('actions_rules_copies', outputs)
547556
548557 if self.is_mac_bundle:
549 mac_bundle_resources = spec.get('mac_bundle_resources', []) + \
550 extra_mac_bundle_resources
551 self.WriteMacBundleResources(mac_bundle_resources, mac_bundle_depends)
558 self.WriteMacBundleResources(
559 mac_bundle_resources + extra_mac_bundle_resources, mac_bundle_depends)
552560 self.WriteMacInfoPlist(mac_bundle_depends)
553561
554562 return stamp
605613 return all_outputs
606614
607615 def WriteRules(self, rules, extra_sources, prebuild,
608 extra_mac_bundle_resources):
616 mac_bundle_resources, extra_mac_bundle_resources):
609617 env = self.GetSortedXcodeEnv()
610618 all_outputs = []
611619 for rule in rules:
659667
660668 if int(rule.get('process_outputs_as_sources', False)):
661669 extra_sources += outputs
662 if int(rule.get('process_outputs_as_mac_bundle_resources', False)):
670
671 was_mac_bundle_resource = source in mac_bundle_resources
672 if was_mac_bundle_resource or \
673 int(rule.get('process_outputs_as_mac_bundle_resources', False)):
663674 extra_mac_bundle_resources += outputs
675 # Note: This is n_resources * n_outputs_in_rule. Put to-be-removed
676 # items in a set and remove them all in a single pass if this becomes
677 # a performance issue.
678 if was_mac_bundle_resource:
679 mac_bundle_resources.remove(source)
664680
665681 extra_bindings = []
666682 for var in needed_variables:
764780 self.ninja.variable('cc', '$cc_host')
765781 self.ninja.variable('cxx', '$cxx_host')
766782 self.ninja.variable('ld', '$ld_host')
783 self.ninja.variable('ldxx', '$ldxx_host')
767784
768785 if self.flavor != 'mac' or len(self.archs) == 1:
769786 return self.WriteSourcesForArch(
861878 obj_ext = self.obj_ext
862879 if ext in ('cc', 'cpp', 'cxx'):
863880 command = 'cxx'
881 self.uses_cpp = True
864882 elif ext == 'c' or (ext == 'S' and self.flavor != 'win'):
865883 command = 'cc'
866884 elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files.
877895 command = 'objc'
878896 elif self.flavor == 'mac' and ext == 'mm':
879897 command = 'objcxx'
898 self.uses_cpp = True
880899 elif self.flavor == 'win' and ext == 'rc':
881900 command = 'rc'
882901 obj_ext = '.res'
962981 continue
963982 linkable = target.Linkable()
964983 if linkable:
984 if self.link_deps_file:
985 # Save the mapping of link deps.
986 self.link_deps_file.write(self.qualified_target)
987 self.link_deps_file.write(' ')
988 self.link_deps_file.write(target.binary)
989 self.link_deps_file.write('\n')
990
965991 if (self.flavor == 'win' and
966992 target.component_objs and
967993 self.msvs_settings.IsUseLibraryDependencyInputs(config_name)):
9811007 link_deps.extend(list(extra_link_deps))
9821008
9831009 extra_bindings = []
1010 if self.uses_cpp and self.flavor != 'win':
1011 extra_bindings.append(('ld', '$ldxx'))
1012
9841013 output = self.ComputeOutput(spec, arch)
9851014 if arch is None and not self.is_mac_bundle:
9861015 self.AppendPostbuildVariable(extra_bindings, spec, output, output)
14831512 stat.dwLength = ctypes.sizeof(stat)
14841513 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
14851514
1486 return max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB
1515 mem_limit = max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB
1516 hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32)))
1517 return min(mem_limit, hard_cap)
14871518 elif sys.platform.startswith('linux'):
14881519 with open("/proc/meminfo") as meminfo:
14891520 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB')
16291660 else:
16301661 cc = 'gcc'
16311662 cxx = 'g++'
1632 ld = '$cxx'
1633 ld_host = '$cxx_host'
1663 ld = '$cc'
1664 ldxx = '$cxx'
1665 ld_host = '$cc_host'
1666 ldxx_host = '$cxx_host'
16341667
16351668 cc_host = None
16361669 cxx_host = None
16471680 cc = os.path.join(build_to_root, value)
16481681 if key == 'CXX':
16491682 cxx = os.path.join(build_to_root, value)
1650 if key == 'LD':
1651 ld = os.path.join(build_to_root, value)
16521683 if key == 'CC.host':
16531684 cc_host = os.path.join(build_to_root, value)
16541685 cc_host_global_setting = value
16551686 if key == 'CXX.host':
16561687 cxx_host = os.path.join(build_to_root, value)
16571688 cxx_host_global_setting = value
1658 if key == 'LD.host':
1659 ld_host = os.path.join(build_to_root, value)
16601689 if key.endswith('_wrapper'):
16611690 wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value)
16621691
16791708 master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc))
16801709 cxx = GetEnvironFallback(['CXX_target', 'CXX'], cxx)
16811710 master_ninja.variable('cxx', CommandWithWrapper('CXX', wrappers, cxx))
1682 ld = GetEnvironFallback(['LD_target', 'LD'], ld)
16831711
16841712 if flavor == 'win':
16851713 master_ninja.variable('ld', ld)
16901718 master_ninja.variable('mt', 'mt.exe')
16911719 else:
16921720 master_ninja.variable('ld', CommandWithWrapper('LINK', wrappers, ld))
1721 master_ninja.variable('ldxx', CommandWithWrapper('LINK', wrappers, ldxx))
16931722 master_ninja.variable('ar', GetEnvironFallback(['AR_target', 'AR'], 'ar'))
16941723
16951724 if generator_supports_multiple_toolsets:
17011730 master_ninja.variable('ar_host', GetEnvironFallback(['AR_host'], 'ar'))
17021731 cc_host = GetEnvironFallback(['CC_host'], cc_host)
17031732 cxx_host = GetEnvironFallback(['CXX_host'], cxx_host)
1704 ld_host = GetEnvironFallback(['LD_host'], ld_host)
17051733
17061734 # The environment variable could be used in 'make_global_settings', like
17071735 # ['CC.host', '$(CC)'] or ['CXX.host', '$(CXX)'], transform them here.
17181746 else:
17191747 master_ninja.variable('ld_host', CommandWithWrapper(
17201748 'LINK', wrappers, ld_host))
1749 master_ninja.variable('ldxx_host', CommandWithWrapper(
1750 'LINK', wrappers, ldxx_host))
17211751
17221752 master_ninja.newline()
17231753
18821912
18831913 # Record the public interface of $lib in $lib.TOC. See the corresponding
18841914 # comment in the posix section above for details.
1885 solink_base = '$ld -shared $ldflags -o $lib %(suffix)s'
1915 solink_base = '$ld %(type)s $ldflags -o $lib %(suffix)s'
18861916 mtime_preserving_solink_base = (
18871917 'if [ ! -e $lib -o ! -e ${lib}.TOC ] || '
18881918 # Always force dependent targets to relink if this library
19011931 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; '
19021932 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'})
19031933
1904 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass
1905 # -bundle -single_module here (for osmesa.so).
19061934 solink_suffix = '$in $solibs $libs$postbuilds'
19071935 master_ninja.rule(
19081936 'solink',
19091937 description='SOLINK $lib, POSTBUILDS',
19101938 restat=True,
1911 command=mtime_preserving_solink_base % {'suffix':solink_suffix},
1939 command=mtime_preserving_solink_base % {'suffix': solink_suffix,
1940 'type': '-shared'},
19121941 pool='link_pool')
19131942 master_ninja.rule(
19141943 'solink_notoc',
19151944 description='SOLINK $lib, POSTBUILDS',
19161945 restat=True,
1917 command=solink_base % {'suffix':solink_suffix},
1946 command=solink_base % {'suffix':solink_suffix, 'type': '-shared'},
19181947 pool='link_pool')
19191948
19201949 solink_module_suffix = '$in $solibs $libs$postbuilds'
19221951 'solink_module',
19231952 description='SOLINK(module) $lib, POSTBUILDS',
19241953 restat=True,
1925 command=mtime_preserving_solink_base % {'suffix':solink_module_suffix},
1954 command=mtime_preserving_solink_base % {'suffix': solink_module_suffix,
1955 'type': '-bundle'},
19261956 pool='link_pool')
19271957 master_ninja.rule(
19281958 'solink_module_notoc',
19291959 description='SOLINK(module) $lib, POSTBUILDS',
19301960 restat=True,
1931 command=solink_base % {'suffix':solink_module_suffix},
1961 command=solink_base % {'suffix': solink_module_suffix, 'type': '-bundle'},
19321962 pool='link_pool')
19331963
19341964 master_ninja.rule(
19842014 # target_short_names is a map from target short name to a list of Target
19852015 # objects.
19862016 target_short_names = {}
2017
2018 # Extract the optional link deps file name.
2019 LINK_DEPS_FILE = 'link_deps_file'
2020 if LINK_DEPS_FILE in generator_flags:
2021 link_deps_file = open(generator_flags.get(LINK_DEPS_FILE), 'wb')
2022 else:
2023 link_deps_file = None
2024
19872025 for qualified_target in target_list:
19882026 # qualified_target is like: third_party/icu/icu.gyp:icui18n#target
19892027 build_file, name, toolset = \
20052043 obj += '.' + toolset
20062044 output_file = os.path.join(obj, base_path, name + '.ninja')
20072045
2046 ninja_output = StringIO()
20082047 writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir,
2009 OpenOutput(os.path.join(toplevel_build, output_file)),
2048 ninja_output,
20102049 toplevel_build, output_file,
2011 flavor, toplevel_dir=options.toplevel_dir)
2012 master_ninja.subninja(output_file)
2050 flavor, link_deps_file,
2051 toplevel_dir=options.toplevel_dir)
20132052
20142053 target = writer.WriteSpec(spec, config_name, generator_flags)
2054
2055 if ninja_output.tell() > 0:
2056 # Only create files for ninja files that actually have contents.
2057 with OpenOutput(os.path.join(toplevel_build, output_file)) as ninja_file:
2058 ninja_file.write(ninja_output.getvalue())
2059 ninja_output.close()
2060 master_ninja.subninja(output_file)
2061
20152062 if target:
20162063 if name != target.FinalOutput() and spec['toolset'] == 'target':
20172064 target_short_names.setdefault(name, []).append(target)
6868 'default_configuration',
6969 'dependencies',
7070 'dependencies_original',
71 'link_languages',
7271 'libraries',
7372 'postbuilds',
7473 'product_dir',
15831582
15841583 return dependencies
15851584
1586 def LinkDependencies(self, targets, dependencies=None, initial=True):
1585 def _LinkDependenciesInternal(self, targets, include_shared_libraries,
1586 dependencies=None, initial=True):
15871587 """Returns a list of dependency targets that are linked into this target.
15881588
15891589 This function has a split personality, depending on the setting of
15931593 When adding a target to the list of dependencies, this function will
15941594 recurse into itself with |initial| set to False, to collect dependencies
15951595 that are linked into the linkable target for which the list is being built.
1596
1597 If |include_shared_libraries| is False, the resulting dependencies will not
1598 include shared_library targets that are linked into this target.
15961599 """
15971600 if dependencies == None:
15981601 dependencies = []
16351638 # dependencies in the sense that a dependent target might run an
16361639 # executable or load the loadable_module.
16371640 if not initial and target_type in ('executable', 'loadable_module'):
1641 return dependencies
1642
1643 # Shared libraries are already fully linked. They should only be included
1644 # in |dependencies| when adjusting static library dependencies (in order to
1645 # link against the shared_library's import lib), but should not be included
1646 # in |dependencies| when propagating link_settings.
1647 # The |include_shared_libraries| flag controls which of these two cases we
1648 # are handling.
1649 if (not initial and target_type == 'shared_library' and
1650 not include_shared_libraries):
16381651 return dependencies
16391652
16401653 # The target is linkable, add it to the list of link dependencies.
16461659 # this target linkable. Always look at dependencies of the initial
16471660 # target, and always look at dependencies of non-linkables.
16481661 for dependency in self.dependencies:
1649 dependency.LinkDependencies(targets, dependencies, False)
1662 dependency._LinkDependenciesInternal(targets,
1663 include_shared_libraries,
1664 dependencies, False)
16501665
16511666 return dependencies
1667
1668 def DependenciesForLinkSettings(self, targets):
1669 """
1670 Returns a list of dependency targets whose link_settings should be merged
1671 into this target.
1672 """
1673
1674 # TODO(sbaig) Currently, chrome depends on the bug that shared libraries'
1675 # link_settings are propagated. So for now, we will allow it, unless the
1676 # 'allow_sharedlib_linksettings_propagation' flag is explicitly set to
1677 # False. Once chrome is fixed, we can remove this flag.
1678 include_shared_libraries = \
1679 targets[self.ref].get('allow_sharedlib_linksettings_propagation', True)
1680 return self._LinkDependenciesInternal(targets, include_shared_libraries)
1681
1682 def DependenciesToLinkAgainst(self, targets):
1683 """
1684 Returns a list of dependency targets that are linked into this target.
1685 """
1686 return self._LinkDependenciesInternal(targets, True)
16521687
16531688
16541689 def BuildDependencyList(targets):
17661801 dependencies = \
17671802 dependency_nodes[target].DirectAndImportedDependencies(targets)
17681803 elif key == 'link_settings':
1769 dependencies = dependency_nodes[target].LinkDependencies(targets)
1804 dependencies = \
1805 dependency_nodes[target].DependenciesForLinkSettings(targets)
17701806 else:
17711807 raise GypError("DoDependentSettings doesn't know how to determine "
17721808 'dependencies for ' + key)
18391875 # target. Add them to the dependencies list if they're not already
18401876 # present.
18411877
1842 link_dependencies = dependency_nodes[target].LinkDependencies(targets)
1878 link_dependencies = \
1879 dependency_nodes[target].DependenciesToLinkAgainst(targets)
18431880 for dependency in link_dependencies:
18441881 if dependency == target:
18451882 continue
107107 return None
108108 fp.close()
109109 if header.startswith("\xFE\xFF"):
110 return "UTF-16BE"
110 return "UTF-16"
111111 elif header.startswith("\xFF\xFE"):
112 return "UTF-16LE"
112 return "UTF-16"
113113 elif header.startswith("\xEF\xBB\xBF"):
114114 return "UTF-8"
115115 else:
360360 cl('AdditionalOptions', prefix='')
361361 cflags.extend(['/FI' + f for f in self._Setting(
362362 ('VCCLCompilerTool', 'ForcedIncludeFiles'), config, default=[])])
363 if self.vs_version.short_name == '2013' or self.vs_version == '2013e':
364 # New flag required in 2013 to maintain previous PDB behavior.
365 cflags.append('/FS')
363366 # ninja handles parallelism by itself, don't have the compiler do it too.
364367 cflags = filter(lambda x: not x.startswith('/MP'), cflags)
365368 return cflags
608608 ldflags.append('-L' + product_dir)
609609
610610 install_name = self.GetInstallName()
611 if install_name:
611 if install_name and self.spec['type'] != 'loadable_module':
612612 ldflags.append('-install_name ' + install_name.replace(' ', r'\ '))
613613
614614 for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []):
168168
169169 # This pattern should match any character that needs to be escaped by
170170 # XCObject._EncodeString. See that function.
171 _escaped = re.compile('[\\\\"]|[^ -~]')
171 _escaped = re.compile('[\\\\"]|[\x00-\x1f]')
172172
173173
174174 # Used by SourceTreeAndPathFromPath
556556 # 10 ^J NL is encoded as "\n"
557557 # 13 ^M CR is encoded as "\n" rendering it indistinguishable from
558558 # 10 ^J NL
559 # All other nonprintable characters within the ASCII range (0 through 127
560 # inclusive) are encoded as "\U001f" referring to the Unicode code point in
561 # hexadecimal. For example, character 14 (^N SO) is encoded as "\U000e".
559 # All other characters within the ASCII control character range (0 through
560 # 31 inclusive) are encoded as "\U001f" referring to the Unicode code point
561 # in hexadecimal. For example, character 14 (^N SO) is encoded as "\U000e".
562562 # Characters above the ASCII range are passed through to the output encoded
563563 # as UTF-8 without any escaping. These mappings are contained in the
564564 # class' _encode_transforms list.
33 # Use of this source code is governed by a BSD-style license that can be
44 # found in the LICENSE file.
55
6 from distutils.core import setup
7 from distutils.command.install import install
8 from distutils.command.install_lib import install_lib
9 from distutils.command.install_scripts import install_scripts
6 from ez_setup import use_setuptools
7 use_setuptools()
8 from setuptools import setup
109
1110 setup(
1211 name='gyp',
1716 url='http://code.google.com/p/gyp',
1817 package_dir = {'': 'pylib'},
1918 packages=['gyp', 'gyp.generator'],
20
21 scripts = ['gyp'],
22 cmdclass = {'install': install,
23 'install_lib': install_lib,
24 'install_scripts': install_scripts},
19 entry_points = {'console_scripts': ['gyp=gyp:script_main'] }
2520 )
1919 sys.exit(0)
2020
2121 # Clear any existing compiler related env vars.
22 for key in 'CC', 'CXX', 'LD', 'CC_host', 'CXX_host', 'LD_host':
22 for key in ['CC', 'CXX', 'LINK', 'CC_host', 'CXX_host', 'LINK_host']:
2323 if key in os.environ:
2424 del os.environ[key]
2525
3737 test = TestGyp.TestGyp(formats=['ninja', 'make'])
3838
3939 def TestTargetOveride():
40 expected = ['my_cc.py', 'my_cxx.py', 'FOO' ]
41 if test.format != 'ninja': # ninja just uses $CC / $CXX as linker.
42 expected.append('FOO_LINK')
43
4044 # Check that CC, CXX and LD set target compiler
4145 oldenv = os.environ.copy()
4246 try:
4347 os.environ['CC'] = 'python %s/my_cc.py FOO' % here
4448 os.environ['CXX'] = 'python %s/my_cxx.py FOO' % here
45 os.environ['LD'] = 'python %s/my_ld.py FOO_LINK' % here
49 os.environ['LINK'] = 'python %s/my_ld.py FOO_LINK' % here
4650
47 CheckCompiler(test, 'compiler.gyp',
48 ['my_cc.py', 'my_cxx.py', 'FOO', 'FOO_LINK'],
51 CheckCompiler(test, 'compiler.gyp', expected,
4952 True)
5053 finally:
5154 os.environ.clear()
5457 # Run the same tests once the eviron has been restored. The
5558 # generated should have embedded all the settings in the
5659 # project files so the results should be the same.
57 CheckCompiler(test, 'compiler.gyp',
58 ['my_cc.py', 'my_cxx.py', 'FOO', 'FOO_LINK'],
60 CheckCompiler(test, 'compiler.gyp', expected,
5961 False)
6062
6163 def TestTargetOverideCompilerOnly():
8183
8284
8385 def TestHostOveride():
86 expected = ['my_cc.py', 'my_cxx.py', 'HOST' ]
87 if test.format != 'ninja': # ninja just uses $CC / $CXX as linker.
88 expected.append('HOST_LINK')
89
8490 # Check that CC_host sets host compilee
8591 oldenv = os.environ.copy()
8692 try:
8793 os.environ['CC_host'] = 'python %s/my_cc.py HOST' % here
8894 os.environ['CXX_host'] = 'python %s/my_cxx.py HOST' % here
89 os.environ['LD_host'] = 'python %s/my_ld.py HOST_LINK' % here
90 CheckCompiler(test, 'compiler-host.gyp',
91 ['my_cc.py', 'my_cxx.py', 'HOST', 'HOST_LINK'],
92 True)
95 os.environ['LINK_host'] = 'python %s/my_ld.py HOST_LINK' % here
96 CheckCompiler(test, 'compiler-host.gyp', expected, True)
9397 finally:
9498 os.environ.clear()
9599 os.environ.update(oldenv)
97101 # Run the same tests once the eviron has been restored. The
98102 # generated should have embedded all the settings in the
99103 # project files so the results should be the same.
100 CheckCompiler(test, 'compiler-host.gyp',
101 ['my_cc.py', 'my_cxx.py', 'HOST', 'HOST_LINK'],
102 False)
104 CheckCompiler(test, 'compiler-host.gyp', expected, False)
103105
104106
105107 TestTargetOveride()
0 #!/usr/bin/env python
1
2 # Copyright (c) 2013 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """
7 Verify that link_settings in a shared_library are not propagated to targets
8 that depend on the shared_library, but are used in the shared_library itself.
9 """
10
11 import TestGyp
12 import sys
13
14 CHDIR='sharedlib-linksettings'
15
16 test = TestGyp.TestGyp()
17 test.run_gyp('test.gyp', chdir=CHDIR)
18 test.build('test.gyp', test.ALL, chdir=CHDIR)
19 test.run_built_executable('program', stdout="1\n2\n", chdir=CHDIR)
20 test.pass_test()
0 /*
1 * Copyright (c) 2013 Google Inc. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 #include <stdio.h>
7
8 /*
9 * This will fail to compile if TEST_DEFINE was propagated from sharedlib to
10 * program.
11 */
12 #ifdef TEST_DEFINE
13 #error TEST_DEFINE is already defined!
14 #endif
15
16 #define TEST_DEFINE 2
17
18 extern int staticLibFunc();
19
20 int main() {
21 printf("%d\n", staticLibFunc());
22 printf("%d\n", TEST_DEFINE);
23 return 0;
24 }
0 /*
1 * Copyright (c) 2013 Google Inc. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 #ifdef _WIN32
7 __declspec(dllexport)
8 #endif
9 int sharedLibFunc() {
10 /*
11 * This will fail to compile if TEST_DEFINE was not obtained from sharedlib's
12 * link_settings.
13 */
14 return TEST_DEFINE;
15 }
0 /*
1 * Copyright (c) 2013 Google Inc. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 /*
7 * This will fail to compile if TEST_DEFINE was propagated from sharedlib to
8 * staticlib.
9 */
10 #ifdef TEST_DEFINE
11 #error TEST_DEFINE is defined!
12 #endif
13
14 #ifdef _WIN32
15 __declspec(dllimport)
16 #else
17 extern
18 #endif
19 int sharedLibFunc();
20
21 int staticLibFunc() {
22 return sharedLibFunc();
23 }
0 # Copyright (c) 2013 Google Inc. All rights reserved.
1 # Use of this source code is governed by a BSD-style license that can be
2 # found in the LICENSE file.
3
4 {
5 'target_defaults': {
6 'allow_sharedlib_linksettings_propagation': 0,
7 },
8 'targets': [
9 {
10 'target_name': 'sharedlib',
11 'type': 'shared_library',
12 'sources': [ 'sharedlib.c' ],
13 'link_settings': {
14 'defines': [ 'TEST_DEFINE=1' ],
15 },
16 'conditions': [
17 ['OS=="linux"', {
18 # Support 64-bit shared libs (also works fine for 32-bit).
19 'cflags': ['-fPIC'],
20 }],
21 ],
22 },
23 {
24 'target_name': 'staticlib',
25 'type': 'static_library',
26 'sources': [ 'staticlib.c' ],
27 'dependencies': [ 'sharedlib' ],
28 },
29 {
30 'target_name': 'program',
31 'type': 'executable',
32 'sources': [ 'program.c' ],
33 'dependencies': [ 'staticlib' ],
34 },
35 ],
36 }
2222 'TestApp/TestAppAppDelegate.m',
2323 ],
2424 'mac_bundle_resources': [
25 'TestApp/English.lproj/InfoPlist.strings',
25 'TestApp/English.lproj/InfoPlist.strings', # UTF-8
26 'TestApp/English.lproj/utf-16be.strings',
27 'TestApp/English.lproj/utf-16le.strings',
2628 'TestApp/English.lproj/MainMenu.xib',
2729 ],
2830 'link_settings': {
0 #!/bin/bash
1
2 tr a-z A-Z < "${1}" > "${2}"
0 # Copyright (c) 2013 Google Inc. All rights reserved.
1 # Use of this source code is governed by a BSD-style license that can be
2 # found in the LICENSE file.
3 {
4 'targets': [
5 {
6 'target_name': 'resource',
7 'type': 'executable',
8 'mac_bundle': 1,
9 'mac_bundle_resources': [
10 'secret.txt',
11 ],
12 },
13 # A rule with process_outputs_as_mac_bundle_resources should copy files
14 # into the Resources folder.
15 {
16 'target_name': 'source_rule',
17 'type': 'executable',
18 'mac_bundle': 1,
19 'sources': [
20 'secret.txt',
21 ],
22 'rules': [
23 {
24 'rule_name': 'bundlerule',
25 'extension': 'txt',
26 'outputs': [
27 '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).txt',
28 ],
29 'action': ['./change.sh', '<(RULE_INPUT_PATH)', '<@(_outputs)'],
30 'message': 'Running rule on <(RULE_INPUT_PATH)',
31 'process_outputs_as_mac_bundle_resources': 1,
32 },
33 ],
34 },
35 # So should an ordinary rule acting on mac_bundle_resources.
36 {
37 'target_name': 'resource_rule',
38 'type': 'executable',
39 'mac_bundle': 1,
40 'mac_bundle_resources': [
41 'secret.txt',
42 ],
43 'rules': [
44 {
45 'rule_name': 'bundlerule',
46 'extension': 'txt',
47 'outputs': [
48 '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).txt',
49 ],
50 'action': ['./change.sh', '<(RULE_INPUT_PATH)', '<@(_outputs)'],
51 'message': 'Running rule on <(RULE_INPUT_PATH)',
52 },
53 ],
54 },
55 ],
56 }
57
4141 test.must_not_contain(info_plist, '${MACOSX_DEPLOYMENT_TARGET}');
4242
4343 # Resources
44 strings = test.built_file_path(
45 'Test App Gyp.app/Contents/Resources/English.lproj/InfoPlist.strings',
46 chdir='app-bundle')
47 test.must_exist(strings)
48 # Xcodes writes UTF-16LE with BOM.
49 test.must_contain(strings, '\xff\xfe' + '/* Localized'.encode('utf-16le'))
44 strings_files = ['InfoPlist.strings', 'utf-16be.strings', 'utf-16le.strings']
45 for f in strings_files:
46 strings = test.built_file_path(
47 os.path.join('Test App Gyp.app/Contents/Resources/English.lproj', f),
48 chdir='app-bundle')
49 test.must_exist(strings)
50 # Xcodes writes UTF-16LE with BOM.
51 contents = open(strings, 'rb').read()
52 if not contents.startswith('\xff\xfe' + '/* Localized'.encode('utf-16le')):
53 test.fail_test()
5054
5155 test.built_file_must_exist(
5256 'Test App Gyp.app/Contents/Resources/English.lproj/MainMenu.nib',
6266 if set(ls(test.built_file_path('Test App Gyp.app', chdir='app-bundle'))) != \
6367 set(['Contents/MacOS/Test App Gyp',
6468 'Contents/Info.plist',
65 'Contents/Resources/English.lproj/InfoPlist.strings',
6669 'Contents/Resources/English.lproj/MainMenu.nib',
6770 'Contents/PkgInfo',
68 ]):
71 ] +
72 [os.path.join('Contents/Resources/English.lproj', f)
73 for f in strings_files]):
6974 test.fail_test()
7075
7176 test.pass_test()
0 #!/usr/bin/env python
1
2 # Copyright (c) 2013 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """
7 Verifies things related to bundle resources.
8 """
9
10 import TestGyp
11
12 import sys
13
14 if sys.platform == 'darwin':
15 # set |match| to ignore build stderr output.
16 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
17
18 CHDIR = 'bundle-resources'
19 test.run_gyp('test.gyp', chdir=CHDIR)
20
21 test.build('test.gyp', test.ALL, chdir=CHDIR)
22
23 test.built_file_must_match('resource.app/Contents/Resources/secret.txt',
24 'abc\n', chdir=CHDIR)
25 test.built_file_must_match('source_rule.app/Contents/Resources/secret.txt',
26 'ABC\n', chdir=CHDIR)
27
28 # TODO(thakis): This currently fails with make.
29 if test.format != 'make':
30 test.built_file_must_match(
31 'resource_rule.app/Contents/Resources/secret.txt', 'ABC\n', chdir=CHDIR)
32
33 test.pass_test()
1010 import TestGyp
1111
1212 import os
13 import struct
1314 import sys
1415
1516 if sys.platform == 'darwin':
1617 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
1718
18 test.run_gyp('test.gyp', chdir='loadable-module')
19 test.build('test.gyp', test.ALL, chdir='loadable-module')
19 CHDIR = 'loadable-module'
20 test.run_gyp('test.gyp', chdir=CHDIR)
21 test.build('test.gyp', test.ALL, chdir=CHDIR)
2022
2123 # Binary.
22 test.built_file_must_exist(
24 binary = test.built_file_path(
2325 'test_loadable_module.plugin/Contents/MacOS/test_loadable_module',
24 chdir='loadable-module')
26 chdir=CHDIR)
27 test.must_exist(binary)
28 MH_BUNDLE = 8
29 if struct.unpack('4I', open(binary, 'rb').read(16))[3] != MH_BUNDLE:
30 test.fail_test()
2531
2632 # Info.plist.
2733 info_plist = test.built_file_path(
28 'test_loadable_module.plugin/Contents/Info.plist',
29 chdir='loadable-module')
34 'test_loadable_module.plugin/Contents/Info.plist', chdir=CHDIR)
3035 test.must_exist(info_plist)
3136 test.must_contain(info_plist, """
3237 <key>CFBundleExecutable</key>
3540
3641 # PkgInfo.
3742 test.built_file_must_not_exist(
38 'test_loadable_module.plugin/Contents/PkgInfo',
39 chdir='loadable-module')
43 'test_loadable_module.plugin/Contents/PkgInfo', chdir=CHDIR)
4044 test.built_file_must_not_exist(
41 'test_loadable_module.plugin/Contents/Resources',
42 chdir='loadable-module')
45 'test_loadable_module.plugin/Contents/Resources', chdir=CHDIR)
4346
4447 test.pass_test()
3131 'resource_bundle.bundle/Contents/MacOS/resource_bundle',
3232 chdir='sourceless-module')
3333
34 # Build an app containing an actionless bundle.
35 test.build(
36 'test.gyp',
37 'bundle_dependent_on_resource_bundle_no_actions',
38 chdir='sourceless-module')
39
40 test.built_file_must_exist(
41 'bundle_dependent_on_resource_bundle_no_actions.app/Contents/Resources/'
42 'mac_resource_bundle_no_actions.bundle/Contents/Resources/empty.txt',
43 chdir='sourceless-module')
44
3445 # Needs to build and cause the bundle to be built.
3546 test.build(
3647 'test.gyp', 'dependent_on_resource_bundle', chdir='sourceless-module')
0 #!/usr/bin/env python
1
2 # Copyright 2013 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """
7 Verifies that unicode strings in 'xcode_settings' work.
8 Also checks that ASCII control characters are escaped properly.
9 """
10
11 import TestGyp
12
13 import sys
14
15 if sys.platform == 'darwin':
16 test = TestGyp.TestGyp(formats=['xcode'])
17 test.run_gyp('test.gyp', chdir='unicode-settings')
18 test.build('test.gyp', test.ALL, chdir='unicode-settings')
19 test.pass_test()
6868 'resource_framework',
6969 ],
7070 },
71
72 { # No actions, but still have resources.
73 'target_name': 'mac_resource_bundle_no_actions',
74 'product_extension': 'bundle',
75 'type': 'executable',
76 'mac_bundle': 1,
77 'mac_bundle_resources': [
78 'empty.txt',
79 ],
80 },
81 {
82 'target_name': 'bundle_dependent_on_resource_bundle_no_actions',
83 'type': 'executable',
84 'mac_bundle': 1,
85 'sources': [ 'empty.c' ],
86 'dependencies': [
87 'mac_resource_bundle_no_actions',
88 ],
89 'mac_bundle_resources': [
90 '<(PRODUCT_DIR)/mac_resource_bundle_no_actions.bundle',
91 ],
92 },
7193 ],
7294 }
7395
0 # Copyright 2013 Google Inc. All rights reserved.
1 # Use of this source code is governed by a BSD-style license that can be
2 # found in the LICENSE file.
3
4 {
5 'targets': [
6 {
7 'target_name': 'myapp',
8 'type': 'executable',
9 'mac_bundle': 1,
10 'sources': [ 'file.cc', ],
11 'xcode_settings': {
12 'BUNDLE_DISPLAY_NAME': 'α\011',
13 },
14 'postbuilds': [
15 {
16 'postbuild_name': 'envtest',
17 'action': [ './test_bundle_display_name.sh', ],
18 },
19 ],
20 },
21 ],
22 }
0 #!/bin/bash
1
2 # Copyright 2013 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 test "${BUNDLE_DISPLAY_NAME}" = 'α '
2626 """
2727 if sys.platform == 'linux2':
2828 link_expected = """
29 LINK ?= flock $(builddir)/linker.lock $(abspath clang++)
29 LINK ?= flock $(builddir)/linker.lock $(abspath clang)
3030 """
3131 elif sys.platform == 'darwin':
3232 link_expected = """
33 LINK ?= ./gyp-mac-tool flock $(builddir)/linker.lock $(abspath clang++)
33 LINK ?= ./gyp-mac-tool flock $(builddir)/linker.lock $(abspath clang)
3434 """
3535 test.must_contain('Makefile', cc_expected)
3636 test.must_contain('Makefile', link_expected)
3737 if test.format == 'ninja':
3838 cc_expected = 'cc = ' + os.path.join('..', '..', 'clang')
39 ld_expected = 'ld = $cxx'
39 ld_expected = 'ld = $cc'
4040 if sys.platform == 'win32':
4141 ld_expected = 'link.exe'
4242 test.must_contain('out/Default/build.ninja', cc_expected)
44 {
55 'make_global_settings': [
66 ['CC', 'clang'],
7 ['LINK', 'clang++'],
7 ['LINK', 'clang'],
88 ],
99 'targets': [
1010 {
3030 os.path.join('..', '..', 'clang'))
3131 cc_host_expected = ('cc_host = ' + os.path.join('..', '..', 'ccache') + ' ' +
3232 os.path.join('..', '..', 'clang'))
33 ld_expected = 'ld = ../../distlink $cxx'
33 ld_expected = 'ld = ../../distlink $cc'
34 if sys.platform != 'win32':
35 ldxx_expected = 'ldxx = ../../distlink $cxx'
36
3437 if sys.platform == 'win32':
3538 ld_expected = 'link.exe'
3639 test.must_contain('out/Default/build.ninja', cc_expected)
3740 test.must_contain('out/Default/build.ninja', cc_host_expected)
3841 test.must_contain('out/Default/build.ninja', ld_expected)
42 if sys.platform != 'win32':
43 test.must_contain('out/Default/build.ninja', ldxx_expected)
3944
4045 test.pass_test()
44 {
55 'make_global_settings': [
66 ['CC', 'clang'],
7 ['LINK', 'clang++'],
87 ['CC.host', 'clang'],
98 ],
109 'targets': [
3636 os.path.join('..', '..', 'clang'))
3737 cc_host_expected = ('cc_host = ' + os.path.join('..', '..', 'ccache') + ' ' +
3838 os.path.join('..', '..', 'clang'))
39 ld_expected = 'ld = ../../distlink $cxx'
39 ld_expected = 'ld = ../../distlink $cc'
4040 if sys.platform == 'win32':
4141 ld_expected = 'link.exe'
4242 test.must_contain('out/Default/build.ninja', cc_expected)
3535 'type': 'loadable_module',
3636 'product_name': 'lib1',
3737 'product_prefix': '',
38 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''},
3938 'sources': [
4039 'lib1.c',
4140 ],
4544 'product_name': 'lib2',
4645 'product_prefix': '',
4746 'type': 'loadable_module',
48 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''},
4947 'sources': [
5048 'lib2.c',
5149 ],
0 #!/usr/bin/env python
1
2 # Copyright (c) 2012 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """
7 Checks that C-only targets aren't linked against libstdc++.
8 """
9
10 import TestGyp
11
12 import re
13 import subprocess
14 import sys
15
16 # set |match| to ignore build stderr output.
17 test = TestGyp.TestGyp(match = lambda a, b: True)
18 if sys.platform != 'win32' and test.format not in ('make', 'android'):
19 # TODO: This doesn't pass with make.
20 # TODO: Does a test like this make sense with Windows? Android?
21
22 CHDIR = 'src'
23 test.run_gyp('test.gyp', chdir=CHDIR)
24 test.build('test.gyp', 'no_cpp', chdir=CHDIR)
25
26 def LinksLibStdCpp(path):
27 path = test.built_file_path(path, chdir=CHDIR)
28 if sys.platform == 'darwin':
29 proc = subprocess.Popen(['otool', '-L', path], stdout=subprocess.PIPE)
30 else:
31 proc = subprocess.Popen(['ldd', path], stdout=subprocess.PIPE)
32 output = proc.communicate()[0]
33 assert not proc.returncode
34 return 'libstdc++' in output or 'libc++' in output
35
36 if LinksLibStdCpp('no_cpp'):
37 test.fail_test()
38
39 build_error_code = {
40 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`)
41 'make': 2,
42 'ninja': 1,
43 }[test.format]
44
45 test.build('test.gyp', 'no_cpp_dep_on_cc_lib', chdir=CHDIR,
46 status=build_error_code)
47
48 test.pass_test()
0 void* f();
1 int main() { f(); }
0 extern "C" { void* f(); }
1
2 void* f() { return new int; }
0 # Copyright (c) 2013 Google Inc. All rights reserved.
1 # Use of this source code is governed by a BSD-style license that can be
2 # found in the LICENSE file.
3 {
4 'targets': [
5 {
6 'target_name': 'no_cpp',
7 'type': 'executable',
8 'sources': [ 'empty-main.c' ],
9 },
10 # A static_library with a cpp file and a linkable with only .c files
11 # depending on it causes a linker error:
12 {
13 'target_name': 'cpp_lib',
14 'type': 'static_library',
15 'sources': [ 'f.cc' ],
16 },
17 {
18 'target_name': 'no_cpp_dep_on_cc_lib',
19 'type': 'executable',
20 'dependencies': [ 'cpp_lib' ],
21 'sources': [ 'call-f-main.c' ],
22 },
23 ],
24 }