| OLD | NEW |
| 1 # Copyright 2015 The Native Client Authors. All rights reserved. | 1 # Copyright 2015 The Native Client Authors. 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 import("//build/config/features.gni") | 5 import("//build/config/features.gni") |
| 6 import("//build/config/nacl/config.gni") | 6 import("//build/config/nacl/config.gni") |
| 7 | 7 |
| 8 # Generate a nmf file | 8 # Generate a nmf file |
| 9 # | 9 # |
| 10 # Native Client Manifest (nmf) is a JSON file that tells the browser where to | 10 # Native Client Manifest (nmf) is a JSON file that tells the browser where to |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 rebase_path(stage_dependencies, root_build_dir) ] | 64 rebase_path(stage_dependencies, root_build_dir) ] |
| 65 lib_path = stage_dependencies | 65 lib_path = stage_dependencies |
| 66 } else { | 66 } else { |
| 67 lib_path = root_build_dir | 67 lib_path = root_build_dir |
| 68 } | 68 } |
| 69 if (defined(lib_prefix)) { | 69 if (defined(lib_prefix)) { |
| 70 nmfflags += [ "--lib-prefix=" + lib_prefix ] | 70 nmfflags += [ "--lib-prefix=" + lib_prefix ] |
| 71 lib_path += "/${lib_prefix}" | 71 lib_path += "/${lib_prefix}" |
| 72 } | 72 } |
| 73 | 73 |
| 74 # NOTE: There is no explicit dependency for the lib32 | 74 # Starts empty so the code below can use += everywhere. |
| 75 # and lib64 directories created in the product directory. | 75 data = [] |
| 76 |
| 77 nmfflags += [ "--library-path=" + rebase_path(root_out_dir) ] |
| 78 |
| 79 # NOTE: There is no explicit dependency for the lib directory |
| 80 # (lib32 and lib64 for x86/x64) created in the product directory. |
| 76 # They are created as a side-effect of nmf creation. | 81 # They are created as a side-effect of nmf creation. |
| 77 nmfflags += [ "--library-path=" + rebase_path(root_out_dir) ] | 82 if (current_cpu != "x86" && current_cpu != "x64") { |
| 78 if (current_cpu == "x86") { | |
| 79 nmfflags += [ "--library-path=" + | |
| 80 rebase_path("${nacl_toolchain_tooldir}/lib32") ] | |
| 81 data = [ | |
| 82 "${lib_path}/lib32/", | |
| 83 ] | |
| 84 } else if (current_cpu == "x64") { | |
| 85 nmfflags += | 83 nmfflags += |
| 86 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ] | 84 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ] |
| 87 data = [ | 85 data += [ "${lib_path}/lib/" ] |
| 88 "${lib_path}/lib64/", | |
| 89 ] | |
| 90 } else { | 86 } else { |
| 91 nmfflags += | 87 # For x86-32, the lib/ directory is called lib32/ instead. |
| 92 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ] | 88 if (current_cpu == "x86") { |
| 93 data = [ | 89 nmfflags += [ "--library-path=" + |
| 94 "${lib_path}/lib/", | 90 rebase_path("${nacl_toolchain_tooldir}/lib32") ] |
| 95 ] | 91 data += [ "${lib_path}/lib32/" ] |
| 92 } |
| 93 |
| 94 # x86-32 Windows needs to build both x86-32 and x86-64 NaCl |
| 95 # binaries into the same nmf covering both architectures. That |
| 96 # gets handled at a higher level (see the nacl_test_data template), |
| 97 # so a single generate_nmf invocation gets both x86-32 and x86-64 |
| 98 # nexes listed in executables. |
| 99 if (current_cpu == "x64" || target_os == "win") { |
| 100 # For x86-64, the lib/ directory is called lib64/ instead |
| 101 # when copied by create_nmf.py. |
| 102 glibc_tc = "//build/toolchain/nacl:glibc" |
| 103 assert(current_toolchain == "${glibc_tc}_${current_cpu}") |
| 104 if (current_cpu == "x64") { |
| 105 x64_out_dir = root_out_dir |
| 106 } else { |
| 107 x64_out_dir = get_label_info(":${target_name}(${glibc_tc}_x64)", |
| 108 "root_out_dir") |
| 109 } |
| 110 nmfflags += [ |
| 111 "--library-path=" + rebase_path(x64_out_dir), |
| 112 "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib"), |
| 113 ] |
| 114 data += [ "${lib_path}/lib64/" ] |
| 115 } |
| 96 } | 116 } |
| 97 } | 117 } |
| 98 args = [ | 118 args = [ |
| 99 "--no-default-libpath", | 119 "--no-default-libpath", |
| 100 "--objdump=" + objdump, | 120 "--objdump=" + objdump, |
| 101 "--output=" + rebase_path(nmf, root_build_dir), | 121 "--output=" + rebase_path(nmf, root_build_dir), |
| 102 ] + nmfflags + rebase_path(sources, root_build_dir) | 122 ] + nmfflags + rebase_path(sources, root_build_dir) |
| 103 if (is_nacl_glibc && current_cpu == "arm") { | 123 if (is_nacl_glibc && current_cpu == "arm") { |
| 104 deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ] | 124 deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ] |
| 105 } | 125 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 args = [ | 172 args = [ |
| 153 "--program=" + rebase_path(executable, root_build_dir), | 173 "--program=" + rebase_path(executable, root_build_dir), |
| 154 "--arch=${arch}", | 174 "--arch=${arch}", |
| 155 "--output=" + rebase_path(nmf, root_build_dir), | 175 "--output=" + rebase_path(nmf, root_build_dir), |
| 156 ] | 176 ] |
| 157 if (defined(invoker.nmfflags)) { | 177 if (defined(invoker.nmfflags)) { |
| 158 args += invoker.nmfflags | 178 args += invoker.nmfflags |
| 159 } | 179 } |
| 160 } | 180 } |
| 161 } | 181 } |
| OLD | NEW |