/src/3rdparty/javascriptcore/JavaScriptCore/wscript

https://bitbucket.org/ultra_iter/qt-vtl · Python · 103 lines · 55 code · 20 blank · 28 comment · 5 complexity · ab935af9abdd590508b79cb4a49af9b9 MD5 · raw file

  1. #! /usr/bin/env python
  2. # Copyright (C) 2009 Kevin Ollivier All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. # 1. Redistributions of source code must retain the above copyright
  8. # notice, this list of conditions and the following disclaimer.
  9. # 2. Redistributions in binary form must reproduce the above copyright
  10. # notice, this list of conditions and the following disclaimer in the
  11. # documentation and/or other materials provided with the distribution.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  14. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  17. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21. # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. #
  25. # JavaScriptCore build script for the waf build system
  26. import commands
  27. from settings import *
  28. jscore_excludes = ['jsc.cpp', 'ucptable.cpp']
  29. jscore_excludes.extend(get_excludes(jscore_dir, ['*CF.cpp', '*Symbian.cpp']))
  30. sources = []
  31. jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp', '*None.cpp']))
  32. if building_on_win32:
  33. jscore_excludes += ['ExecutableAllocatorPosix.cpp', 'MarkStackPosix.cpp']
  34. sources += ['jit/ExecutableAllocatorWin.cpp', 'runtime/MarkStackWin.cpp']
  35. else:
  36. jscore_excludes.append('JSStringRefBSTR.cpp')
  37. def generate_jscore_derived_sources():
  38. # build the derived sources
  39. js_dir = jscore_dir
  40. if building_on_win32:
  41. js_dir = get_output('cygpath --unix "%s"' % js_dir)
  42. derived_sources_dir = os.path.join(jscore_dir, 'DerivedSources')
  43. if not os.path.exists(derived_sources_dir):
  44. os.mkdir(derived_sources_dir)
  45. olddir = os.getcwd()
  46. os.chdir(derived_sources_dir)
  47. command = 'make -f %s/DerivedSources.make JavaScriptCore=%s BUILT_PRODUCTS_DIR=%s all FEATURE_DEFINES="%s"' % (js_dir, js_dir, js_dir, ' '.join(feature_defines))
  48. os.system(command)
  49. os.chdir(olddir)
  50. def set_options(opt):
  51. common_set_options(opt)
  52. def configure(conf):
  53. common_configure(conf)
  54. generate_jscore_derived_sources()
  55. def build(bld):
  56. import Options
  57. full_dirs = get_dirs_for_features(jscore_dir, features=[build_port], dirs=jscore_dirs)
  58. includes = common_includes + full_dirs
  59. # 1. A simple program
  60. jscore = bld.new_task_gen(
  61. features = 'cxx cstaticlib',
  62. includes = '. .. assembler wrec DerivedSources ForwardingHeaders ' + ' '.join(includes),
  63. source = sources,
  64. target = 'jscore',
  65. uselib = 'WX ICU ' + get_config(),
  66. uselib_local = '',
  67. install_path = output_dir)
  68. jscore.find_sources_in_dirs(full_dirs, excludes = jscore_excludes)
  69. obj = bld.new_task_gen(
  70. features = 'cxx cprogram',
  71. includes = '. .. assembler wrec DerivedSources ForwardingHeaders ' + ' '.join(includes),
  72. source = 'jsc.cpp',
  73. target = 'jsc',
  74. uselib = 'WX ICU ' + get_config(),
  75. uselib_local = 'jscore',
  76. install_path = output_dir,
  77. )
  78. # we'll get an error if exceptions are on because of an unwind error when using __try
  79. if building_on_win32:
  80. flags = obj.env.CXXFLAGS
  81. flags.remove('/EHsc')
  82. obj.env.CXXFLAGS = flags
  83. bld.install_files(os.path.join(output_dir, 'JavaScriptCore'), 'API/*.h')