OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2015 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2015 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Recipes for PNaCl sandboxed translator packages.""" | 6 """Recipes for PNaCl sandboxed translator packages.""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
11 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
12 import pynacl.gsd_storage | 12 import pynacl.gsd_storage |
13 import pynacl.platform | 13 import pynacl.platform |
14 | 14 |
15 import command | 15 import command |
16 | 16 |
17 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 17 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
18 NACL_DIR = os.path.dirname(SCRIPT_DIR) | 18 NACL_DIR = os.path.dirname(SCRIPT_DIR) |
19 | 19 |
20 | 20 |
21 def GSDJoin(*args): | 21 def GSDJoin(*args): |
22 return '_'.join([pynacl.gsd_storage.LegalizeName(arg) for arg in args]) | 22 return '_'.join([pynacl.gsd_storage.LegalizeName(arg) for arg in args]) |
23 | 23 |
24 | 24 |
25 def SandboxedTranslators(arches): | 25 def SandboxedTranslators(arches): |
26 le32_packages = ['newlib_le32', 'libcxx_le32', 'libs_support_le32', | 26 le32_packages = ['newlib_le32', 'libcxx_le32', 'libs_support_le32', |
27 'core_sdk_libs_le32', 'metadata', 'compiler_rt_bc_le32'] | 27 'core_sdk_libs_le32', 'metadata', 'compiler_rt_bc_le32'] |
28 # These are required for building IRT-environment targets, which SCons does | |
29 # as a side effect of building the same targets in the le32 environment. | |
jvoung (off chromium)
2015/03/19 17:36:26
I don't really understand this one...
This is bec
Derek Schuff
2015/03/19 18:36:17
when you give a target of say libnacl_sys_private
| |
30 naclclang_packages = ['newlib_%s' % arch for arch in ['i686', 'x86_64','arm']] | |
28 private_libs = ['libnacl_sys_private', 'libpthread_private', 'libplatform', | 31 private_libs = ['libnacl_sys_private', 'libpthread_private', 'libplatform', |
29 'libimc', 'libimc_syscalls', 'libsrpc', 'libgio'] | 32 'libimc', 'libimc_syscalls', 'libsrpc', 'libgio'] |
30 arch_packages = ['libs_support_translator', 'compiler_rt'] | 33 arch_packages = ['libs_support_translator', 'compiler_rt'] |
31 arch_deps = [GSDJoin(p, arch) | 34 arch_deps = [GSDJoin(p, arch) |
32 for p in arch_packages for arch in arches] | 35 for p in arch_packages for arch in arches] |
33 | 36 |
34 | 37 |
35 def TranslatorLibDir(arch): | 38 def TranslatorLibDir(arch): |
36 return os.path.join('%(output)s', 'translator', | 39 return os.path.join('%(output)s', 'translator', |
37 pynacl.platform.GetArch3264(arch), 'lib') | 40 pynacl.platform.GetArch3264(arch), 'lib') |
38 translators = { | 41 translators = { |
39 # The translator build requires the PNaCl compiler, the le32 target libs, | 42 # The translator build requires the PNaCl compiler, the le32 target libs, |
40 # the le32 core SDK libs, the native translator libs for the target arches | 43 # the le32 core SDK libs, the native translator libs for the target arches |
41 # and the le32 private (non-IRT) libs. All except the last | 44 # and the le32 private (non-IRT) libs. All except the last |
42 # are already built, so we copy those, and build the non-IRT libs here. | 45 # are already built, so we copy those, and build the non-IRT libs here. |
43 'translator_compiler': { | 46 'translator_compiler': { |
44 'type': 'work', | 47 'type': 'work', |
45 'dependencies': ['target_lib_compiler'] + le32_packages + arch_deps, | 48 'dependencies': ['target_lib_compiler'] + ( |
49 le32_packages + arch_deps + naclclang_packages), | |
46 'inputs': { | 50 'inputs': { |
47 'src_untrusted': os.path.join(NACL_DIR, 'src', 'untrusted'), | 51 'src_untrusted': os.path.join(NACL_DIR, 'src', 'untrusted'), |
48 'src_include': os.path.join(NACL_DIR, 'src', 'include'), | 52 'src_include': os.path.join(NACL_DIR, 'src', 'include'), |
49 'scons.py': os.path.join(NACL_DIR, 'scons.py'), | 53 'scons.py': os.path.join(NACL_DIR, 'scons.py'), |
50 'site_scons': os.path.join(NACL_DIR, 'site_scons'), | 54 'site_scons': os.path.join(NACL_DIR, 'site_scons'), |
51 }, | 55 }, |
52 'commands': [ | 56 'commands': [ |
53 # Copy the le32 bitcode libs | 57 # Copy the le32 bitcode libs |
jvoung (off chromium)
2015/03/19 17:36:26
le32 bitcode libs and nacl-clang newlib packages?
Derek Schuff
2015/03/19 18:36:17
Done.
| |
54 command.CopyRecursive('%(' + p + ')s', '%(output)s') | 58 command.CopyRecursive('%(' + p + ')s', '%(output)s') |
55 for p in ['target_lib_compiler'] + le32_packages] + [ | 59 for p in ['target_lib_compiler'] + ( |
60 le32_packages + naclclang_packages)] + [ | |
56 # Build the non-IRT libs | 61 # Build the non-IRT libs |
57 command.Command([sys.executable, '%(scons.py)s', | 62 command.Command([sys.executable, '%(scons.py)s', |
58 '--verbose', 'bitcode=1', 'platform=x86-32', | 63 '--verbose', 'bitcode=1', 'platform=x86-32', |
59 'pnacl_newlib_dir=%(output)s'] + private_libs, | 64 'pnacl_newlib_dir=%(output)s'] + private_libs, |
60 cwd=NACL_DIR)] + [ | 65 cwd=NACL_DIR)] + [ |
61 command.Copy( | 66 command.Copy( |
62 os.path.join(NACL_DIR, 'scons-out', | 67 os.path.join(NACL_DIR, 'scons-out', |
63 'nacl-x86-32-pnacl-pexe-clang', 'lib', lib + '.a'), | 68 'nacl-x86-32-pnacl-pexe-clang', 'lib', lib + '.a'), |
64 os.path.join('%(output)s', 'le32-nacl', 'lib', lib + '.a')) | 69 os.path.join('%(output)s', 'le32-nacl', 'lib', lib + '.a')) |
65 for lib in private_libs] + [ | 70 for lib in private_libs] + [ |
(...skipping 10 matching lines...) Expand all Loading... | |
76 'build': os.path.join(NACL_DIR, 'pnacl', 'build.sh'), | 81 'build': os.path.join(NACL_DIR, 'pnacl', 'build.sh'), |
77 '_': os.path.join(NACL_DIR, 'pnacl', 'scripts', 'common-tools.sh'), | 82 '_': os.path.join(NACL_DIR, 'pnacl', 'scripts', 'common-tools.sh'), |
78 }, | 83 }, |
79 'commands': [ | 84 'commands': [ |
80 command.Command(['%(abs_build)s', 'translator-all']), | 85 command.Command(['%(abs_build)s', 'translator-all']), |
81 command.Command(['%(abs_build)s', 'translator-prune']), | 86 command.Command(['%(abs_build)s', 'translator-prune']), |
82 ], | 87 ], |
83 }, | 88 }, |
84 } | 89 } |
85 return translators | 90 return translators |
OLD | NEW |