| OLD | NEW |
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 This module contains classes that help to emulate xcodebuild behavior on top of | 6 This module contains classes that help to emulate xcodebuild behavior on top of |
| 7 other build systems, such as make and ninja. | 7 other build systems, such as make and ninja. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import gyp.common | 10 import gyp.common |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 if self._Test('GCC_TREAT_WARNINGS_AS_ERRORS', 'YES', default='NO'): | 271 if self._Test('GCC_TREAT_WARNINGS_AS_ERRORS', 'YES', default='NO'): |
| 272 cflags.append('-Werror') | 272 cflags.append('-Werror') |
| 273 | 273 |
| 274 if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'): | 274 if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'): |
| 275 cflags.append('-Wnewline-eof') | 275 cflags.append('-Wnewline-eof') |
| 276 | 276 |
| 277 self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') | 277 self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') |
| 278 | 278 |
| 279 # TODO: | 279 # TODO: |
| 280 self._WarnUnimplemented('ARCHS') | |
| 281 if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'): | 280 if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'): |
| 282 self._WarnUnimplemented('COPY_PHASE_STRIP') | 281 self._WarnUnimplemented('COPY_PHASE_STRIP') |
| 283 self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') | 282 self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') |
| 284 self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') | 283 self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') |
| 285 self._WarnUnimplemented('GCC_ENABLE_OBJC_GC') | 284 self._WarnUnimplemented('GCC_ENABLE_OBJC_GC') |
| 286 | 285 |
| 287 # TODO: This is exported correctly, but assigning to it is not supported. | 286 # TODO: This is exported correctly, but assigning to it is not supported. |
| 288 self._WarnUnimplemented('MACH_O_TYPE') | 287 self._WarnUnimplemented('MACH_O_TYPE') |
| 289 self._WarnUnimplemented('PRODUCT_TYPE') | 288 self._WarnUnimplemented('PRODUCT_TYPE') |
| 290 | 289 |
| 291 # TODO: Do not hardcode arch. Supporting fat binaries will be annoying. | 290 archs = self._Settings().get('ARCHS', ['i386']) |
| 292 # Even if self._Settings()['ARCHS'] contains only a single arch, dependent | 291 if len(archs) != 1: |
| 293 # targets might have been built with a different single arch. | 292 # TODO: Supporting fat binaries will be annoying. |
| 294 cflags.append('-arch i386') | 293 self._WarnUnimplemented('ARCHS') |
| 294 archs = ['i386'] |
| 295 cflags.append('-arch ' + archs[0]) |
| 295 | 296 |
| 296 cflags += self._Settings().get('OTHER_CFLAGS', []) | 297 cflags += self._Settings().get('OTHER_CFLAGS', []) |
| 297 cflags += self._Settings().get('WARNING_CFLAGS', []) | 298 cflags += self._Settings().get('WARNING_CFLAGS', []) |
| 298 | 299 |
| 299 config = self.spec['configurations'][self.configname] | 300 config = self.spec['configurations'][self.configname] |
| 300 framework_dirs = config.get('mac_framework_dirs', []) | 301 framework_dirs = config.get('mac_framework_dirs', []) |
| 301 for directory in framework_dirs: | 302 for directory in framework_dirs: |
| 302 cflags.append('-F ' + directory.replace('$(SDKROOT)', sdk_root)) | 303 cflags.append('-F ' + directory.replace('$(SDKROOT)', sdk_root)) |
| 303 | 304 |
| 304 self.configname = None | 305 self.configname = None |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 ldflags.append('-isysroot ' + self._SdkPath()) | 387 ldflags.append('-isysroot ' + self._SdkPath()) |
| 387 | 388 |
| 388 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): | 389 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): |
| 389 ldflags.append('-L' + gyp_to_build_path(library_path)) | 390 ldflags.append('-L' + gyp_to_build_path(library_path)) |
| 390 | 391 |
| 391 if 'ORDER_FILE' in self._Settings(): | 392 if 'ORDER_FILE' in self._Settings(): |
| 392 ldflags.append('-Wl,-order_file ' + | 393 ldflags.append('-Wl,-order_file ' + |
| 393 '-Wl,' + gyp_to_build_path( | 394 '-Wl,' + gyp_to_build_path( |
| 394 self._Settings()['ORDER_FILE'])) | 395 self._Settings()['ORDER_FILE'])) |
| 395 | 396 |
| 396 # TODO: Do not hardcode arch. Supporting fat binaries will be annoying. | 397 archs = self._Settings().get('ARCHS', ['i386']) |
| 397 ldflags.append('-arch i386') | 398 if len(archs) != 1: |
| 399 # TODO: Supporting fat binaries will be annoying. |
| 400 self._WarnUnimplemented('ARCHS') |
| 401 archs = ['i386'] |
| 402 ldflags.append('-arch ' + archs[0]) |
| 398 | 403 |
| 399 # Xcode adds the product directory by default. | 404 # Xcode adds the product directory by default. |
| 400 ldflags.append('-L' + product_dir) | 405 ldflags.append('-L' + product_dir) |
| 401 | 406 |
| 402 install_name = self.GetPerTargetSetting('LD_DYLIB_INSTALL_NAME') | 407 install_name = self.GetPerTargetSetting('LD_DYLIB_INSTALL_NAME') |
| 403 install_base = self.GetPerTargetSetting('DYLIB_INSTALL_NAME_BASE') | 408 install_base = self.GetPerTargetSetting('DYLIB_INSTALL_NAME_BASE') |
| 404 default_install_name = \ | 409 default_install_name = \ |
| 405 '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)' | 410 '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)' |
| 406 if not install_name and install_base: | 411 if not install_name and install_base: |
| 407 install_name = default_install_name | 412 install_name = default_install_name |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 # absolutified. Else, it's in the PATH (e.g. install_name_tool, ln). | 952 # absolutified. Else, it's in the PATH (e.g. install_name_tool, ln). |
| 948 if os.path.sep in shell_list[0]: | 953 if os.path.sep in shell_list[0]: |
| 949 shell_list[0] = gyp_path_to_build_path(shell_list[0]) | 954 shell_list[0] = gyp_path_to_build_path(shell_list[0]) |
| 950 | 955 |
| 951 # "script.sh" -> "./script.sh" | 956 # "script.sh" -> "./script.sh" |
| 952 if not os.path.sep in shell_list[0]: | 957 if not os.path.sep in shell_list[0]: |
| 953 shell_list[0] = os.path.join('.', shell_list[0]) | 958 shell_list[0] = os.path.join('.', shell_list[0]) |
| 954 postbuilds.append(gyp.common.EncodePOSIXShellList(shell_list)) | 959 postbuilds.append(gyp.common.EncodePOSIXShellList(shell_list)) |
| 955 | 960 |
| 956 return postbuilds | 961 return postbuilds |
| OLD | NEW |