You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
3.2 KiB

6 years ago
  1. """SCons.Tool.applelink
  2. Tool-specific initialization for the Apple gnu-like linker.
  3. There normally shouldn't be any need to import this module directly.
  4. It will usually be imported through the generic SCons.Tool.Tool()
  5. selection method.
  6. """
  7. #
  8. # Copyright (c) 2001 - 2017 The SCons Foundation
  9. #
  10. # Permission is hereby granted, free of charge, to any person obtaining
  11. # a copy of this software and associated documentation files (the
  12. # "Software"), to deal in the Software without restriction, including
  13. # without limitation the rights to use, copy, modify, merge, publish,
  14. # distribute, sublicense, and/or sell copies of the Software, and to
  15. # permit persons to whom the Software is furnished to do so, subject to
  16. # the following conditions:
  17. #
  18. # The above copyright notice and this permission notice shall be included
  19. # in all copies or substantial portions of the Software.
  20. #
  21. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  22. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  23. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. #
  29. __revision__ = "src/engine/SCons/Tool/applelink.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
  30. import SCons.Util
  31. # Even though the Mac is based on the GNU toolchain, it doesn't understand
  32. # the -rpath option, so we use the "link" tool instead of "gnulink".
  33. from . import link
  34. def generate(env):
  35. """Add Builders and construction variables for applelink to an
  36. Environment."""
  37. link.generate(env)
  38. env['FRAMEWORKPATHPREFIX'] = '-F'
  39. env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}'
  40. env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS, "", __env__)}'
  41. env['LINKCOM'] = env['LINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS'
  42. env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -dynamiclib')
  43. env['SHLINKCOM'] = env['SHLINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS'
  44. # TODO: Work needed to generate versioned shared libraries
  45. # Leaving this commented out, and also going to disable versioned library checking for now
  46. # see: http://docstore.mik.ua/orelly/unix3/mac/ch05_04.htm for proper naming
  47. #link._setup_versioned_lib_variables(env, tool = 'applelink')#, use_soname = use_soname)
  48. #env['LINKCALLBACKS'] = link._versioned_lib_callbacks()
  49. # override the default for loadable modules, which are different
  50. # on OS X than dynamic shared libs. echoing what XCode does for
  51. # pre/suffixes:
  52. env['LDMODULEPREFIX'] = ''
  53. env['LDMODULESUFFIX'] = ''
  54. env['LDMODULEFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -bundle')
  55. env['LDMODULECOM'] = '$LDMODULE -o ${TARGET} $LDMODULEFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS'
  56. def exists(env):
  57. return env['PLATFORM'] == 'darwin'
  58. # Local Variables:
  59. # tab-width:4
  60. # indent-tabs-mode:nil
  61. # End:
  62. # vim: set expandtab tabstop=4 shiftwidth=4: