(self, configname, product_dir, gyp_to_build_path, arch=None)
return ldflags
Returns flags that need to be passed to the linker.

    Args:
        configname: The name of the configuration to get ld flags for.
        product_dir: The directory where products such static and dynamic
            libraries are placed. This is added to the library search path.
        gyp_to_build_path: A function that converts paths relative to the
            current gyp file to paths relative to the build direcotry.
Returns flags that need to be passed to the linker.
Returns flags that need to be passed to the linker .
def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None):
    """Returns flags that need to be passed to the linker.

    Args:
        configname: The name of the configuration to get ld flags for.
        product_dir: The directory where products such static and dynamic
            libraries are placed. This is added to the library search path.
        gyp_to_build_path: A function that converts paths relative to the
            current gyp file to paths relative to the build direcotry.
    """
    self.configname = configname
    ldflags = []

    # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS
    # can contain entries that depend on this. Explicitly absolutify these.
    for ldflag in self._Settings().get('OTHER_LDFLAGS', []):
      ldflags.append(self._MapLinkerFlagFilename(ldflag, gyp_to_build_path))

    if self._Test('DEAD_CODE_STRIPPING', 'YES', default='NO'):
      ldflags.append('-Wl,-dead_strip')

    if self._Test('PREBINDING', 'YES', default='NO'):
      ldflags.append('-Wl,-prebind')

    self._Appendf(
        ldflags, 'DYLIB_COMPATIBILITY_VERSION', '-compatibility_version %s')
    self._Appendf(
        ldflags, 'DYLIB_CURRENT_VERSION', '-current_version %s')

    self._AppendPlatformVersionMinFlags(ldflags)

    if 'SDKROOT' in self._Settings() and self._SdkPath():
      ldflags.append('-isysroot ' + self._SdkPath())

    for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []):
      ldflags.append('-L' + gyp_to_build_path(library_path))

    if 'ORDER_FILE' in self._Settings():
      ldflags.append('-Wl,-order_file ' +
                     '-Wl,' + gyp_to_build_path(
                                  self._Settings()['ORDER_FILE']))

    if arch is not None:
      archs = [arch]
    else:
      archs = self._Settings().get('ARCHS', [self._DefaultArch()])
    if len(archs) != 1:
      # TODO: Supporting fat binaries will be annoying.
      self._WarnUnimplemented('ARCHS')
      archs = ['i386']
    ldflags.append('-arch ' + archs[0])

    # Xcode adds the product directory by default.
    ldflags.append('-L' + product_dir)

    install_name = self.GetInstallName()
    if install_name and self.spec['type'] != 'loadable_module':
      ldflags.append('-install_name ' + install_name.replace(' ', r'\ '))

    for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []):
      ldflags.append('-Wl,-rpath,' + rpath)

    sdk_root = self._SdkPath()
    if not sdk_root:
      sdk_root = ''
    config = self.spec['configurations'][self.configname]
    framework_dirs = config.get('mac_framework_dirs', [])
    for directory in framework_dirs:
      ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))

    self.configname = None
    return ldflags
def GetLdflags ( self , configname , product_dir , gyp_to_build_path , arch = None ) : self . configname = configname ldflags = [ ] # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS # can contain entries that depend on this. Explicitly absolutify these. for ldflag in self . _Settings ( ) . get ( 'OTHER_LDFLAGS' , [ ] ) : ldflags . append ( self . _MapLinkerFlagFilename ( ldflag , gyp_to_build_path ) ) if self . _Test ( 'DEAD_CODE_STRIPPING' , 'YES' , default = 'NO' ) : ldflags . append ( '-Wl,-dead_strip' ) if self . _Test ( 'PREBINDING' , 'YES' , default = 'NO' ) : ldflags . append ( '-Wl,-prebind' ) self . _Appendf ( ldflags , 'DYLIB_COMPATIBILITY_VERSION' , '-compatibility_version %s' ) self . _Appendf ( ldflags , 'DYLIB_CURRENT_VERSION' , '-current_version %s' ) self . _AppendPlatformVersionMinFlags ( ldflags ) if 'SDKROOT' in self . _Settings ( ) and self . _SdkPath ( ) : ldflags . append ( '-isysroot ' + self . _SdkPath ( ) ) for library_path in self . _Settings ( ) . get ( 'LIBRARY_SEARCH_PATHS' , [ ] ) : ldflags . append ( '-L' + gyp_to_build_path ( library_path ) ) if 'ORDER_FILE' in self . _Settings ( ) : ldflags . append ( '-Wl,-order_file ' + '-Wl,' + gyp_to_build_path ( self . _Settings ( ) [ 'ORDER_FILE' ] ) ) if arch is not None : archs = [ arch ] else : archs = self . _Settings ( ) . get ( 'ARCHS' , [ self . _DefaultArch ( ) ] ) if len ( archs ) != 1 : # TODO: Supporting fat binaries will be annoying. self . _WarnUnimplemented ( 'ARCHS' ) archs = [ 'i386' ] ldflags . append ( '-arch ' + archs [ 0 ] ) # Xcode adds the product directory by default. ldflags . append ( '-L' + product_dir ) install_name = self . GetInstallName ( ) if install_name and self . spec [ 'type' ] != 'loadable_module' : ldflags . append ( '-install_name ' + install_name . replace ( ' ' , r'\ ' ) ) for rpath in self . _Settings ( ) . get ( 'LD_RUNPATH_SEARCH_PATHS' , [ ] ) : ldflags . append ( '-Wl,-rpath,' + rpath ) sdk_root = self . _SdkPath ( ) if not sdk_root : sdk_root = '' config = self . spec [ 'configurations' ] [ self . configname ] framework_dirs = config . get ( 'mac_framework_dirs' , [ ] ) for directory in framework_dirs : ldflags . append ( '-F' + directory . replace ( '$(SDKROOT)' , sdk_root ) ) self . configname = None return ldflags