Chromium Code Reviews| Index: pylib/gyp/xcode_emulation.py |
| diff --git a/pylib/gyp/xcode_emulation.py b/pylib/gyp/xcode_emulation.py |
| index 859cd5a93722e9c1efb9f4cb210be180e03e7b11..684e9bd0149158c71ad2ba2438a16697fd0eb719 100644 |
| --- a/pylib/gyp/xcode_emulation.py |
| +++ b/pylib/gyp/xcode_emulation.py |
| @@ -238,6 +238,8 @@ class XcodeSettings(object): |
| return '.' + self.spec.get('product_extension', wrapper_extension) |
| elif self.spec['type'] == 'executable': |
| return '.' + self.spec.get('product_extension', 'app') |
| + elif self.spec['type'] == 'extension': |
| + return '.' + self.spec.get('product_extension', 'appex') |
| else: |
| assert False, "Don't know extension for '%s', target '%s'" % ( |
| self.spec['type'], self.spec['target_name']) |
| @@ -284,7 +286,7 @@ class XcodeSettings(object): |
| """Returns the qualified path to the bundle's plist file. E.g. |
| Chromium.app/Contents/Info.plist. Only valid for bundles.""" |
| assert self._IsBundle() |
| - if self.spec['type'] in ('executable', 'loadable_module'): |
| + if self.spec['type'] in ('executable', 'extension', 'loadable_module'): |
| return os.path.join(self.GetBundleContentsFolderPath(), 'Info.plist') |
| else: |
| return os.path.join(self.GetBundleContentsFolderPath(), |
| @@ -295,12 +297,14 @@ class XcodeSettings(object): |
| if self._IsBundle(): |
| return { |
| 'executable': 'com.apple.product-type.application', |
| + 'extension': 'com.apple.product-type.app-extension', |
| 'loadable_module': 'com.apple.product-type.bundle', |
| 'shared_library': 'com.apple.product-type.framework', |
| }[self.spec['type']] |
| else: |
| return { |
| 'executable': 'com.apple.product-type.tool', |
| + 'extension': 'com.apple.product-type.app-extension', |
| 'loadable_module': 'com.apple.product-type.library.dynamic', |
| 'shared_library': 'com.apple.product-type.library.dynamic', |
| 'static_library': 'com.apple.product-type.library.static', |
| @@ -309,10 +313,12 @@ class XcodeSettings(object): |
| def GetMachOType(self): |
| """Returns the MACH_O_TYPE of this target.""" |
| # Weird, but matches Xcode. |
| - if not self._IsBundle() and self.spec['type'] == 'executable': |
| + if not self._IsBundle() and (self.spec['type'] == 'executable' or |
| + self.spec['type'] == 'extension'): |
|
pkl (ping after 24h if needed)
2014/07/09 08:07:50
self.spec[type] in (...)
olivierrobin
2014/07/09 12:46:27
Done.
olivierrobin
2014/07/09 12:46:27
Done.
|
| return '' |
| return { |
| 'executable': 'mh_execute', |
| + 'extension': 'mh_execute', |
| 'static_library': 'staticlib', |
| 'shared_library': 'mh_dylib', |
| 'loadable_module': 'mh_bundle', |
| @@ -324,7 +330,7 @@ class XcodeSettings(object): |
| assert self._IsBundle() |
| if self.spec['type'] in ('shared_library') or self.isIOS: |
| path = self.GetBundleContentsFolderPath() |
| - elif self.spec['type'] in ('executable', 'loadable_module'): |
| + elif self.spec['type'] in ('executable', 'extension', 'loadable_module'): |
| path = os.path.join(self.GetBundleContentsFolderPath(), 'MacOS') |
| return os.path.join(path, self.GetExecutableName()) |
| @@ -333,6 +339,7 @@ class XcodeSettings(object): |
| return '.' + self.spec['product_extension'] |
| return { |
| 'executable': '', |
| + 'extension': '', |
| 'static_library': '.a', |
| 'shared_library': '.dylib', |
| 'loadable_module': '.so', |
| @@ -341,6 +348,7 @@ class XcodeSettings(object): |
| def _GetStandaloneExecutablePrefix(self): |
| return self.spec.get('product_prefix', { |
| 'executable': '', |
| + 'extension': '', |
| 'static_library': 'lib', |
| 'shared_library': 'lib', |
| # Non-bundled loadable_modules are called foo.so for some reason |
| @@ -352,8 +360,8 @@ class XcodeSettings(object): |
| """Returns the name of the non-bundle binary represented by this target. |
| E.g. hello_world. Only valid for non-bundles.""" |
| assert not self._IsBundle() |
| - assert self.spec['type'] in ( |
| - 'executable', 'shared_library', 'static_library', 'loadable_module'), ( |
| + assert self.spec['type'] in ('executable', 'extension', 'shared_library', |
| + 'static_library', 'loadable_module'), ( |
| 'Unexpected type %s' % self.spec['type']) |
| target = self.spec['target_name'] |
| if self.spec['type'] == 'static_library': |
| @@ -794,6 +802,16 @@ class XcodeSettings(object): |
| for directory in framework_dirs: |
| ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) |
| + if sdk_root and self.spec['type'] == "extension": |
| + # Adds the link flags for extensions. These flags are common for all |
| + # extensions and provide loader and main function. |
| + # These flags reflect the compilation options used by xcode to compile |
| + # extensions. |
| + ldflags.append('-lpkstart ' + sdk_root + |
| + '/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit') |
| + ldflags.append('-fapplication-extension ' + |
| + '-Xlinker -rpath -Xlinker @executable_path/../../Frameworks') |
| + |
| self._Appendf(ldflags, 'CLANG_CXX_LIBRARY', '-stdlib=%s') |
| self.configname = None |
| @@ -870,6 +888,8 @@ class XcodeSettings(object): |
| default_strip_style = 'non-global' |
| elif self.spec['type'] == 'executable': |
| default_strip_style = 'all' |
| + elif self.spec['type'] == 'extension': |
| + default_strip_style = 'all' |
| strip_style = self._Settings().get('STRIP_STYLE', default_strip_style) |
| strip_flags = { |
| @@ -921,7 +941,8 @@ class XcodeSettings(object): |
| """Return a shell command to codesign the iOS output binary so it can |
| be deployed to a device. This should be run as the very last step of the |
| build.""" |
| - if not (self.isIOS and self.spec['type'] == "executable"): |
| + if not (self.isIOS and (self.spec['type'] == "executable" or |
|
pkl (ping after 24h if needed)
2014/07/09 08:07:50
Use single-quote for strings. Also use "in" operat
olivierrobin
2014/07/09 12:46:27
Done.
|
| + self.spec['type'] == "extension")): |
| return [] |
| settings = self.xcode_settings[configname] |
| @@ -1402,7 +1423,11 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, |
| env['SDKROOT'] = '' |
| if spec['type'] in ( |
| - 'executable', 'static_library', 'shared_library', 'loadable_module'): |
| + 'executable', |
| + 'extension', |
| + 'static_library', |
| + 'shared_library', |
| + 'loadable_module'): |
| env['EXECUTABLE_NAME'] = xcode_settings.GetExecutableName() |
| env['EXECUTABLE_PATH'] = xcode_settings.GetExecutablePath() |
| env['FULL_PRODUCT_NAME'] = xcode_settings.GetFullProductName() |