OLD | NEW |
1 # Copyright 2015 the V8 project authors. All rights reserved. | 1 # Copyright 2015 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 15 matching lines...) Expand all Loading... |
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 import("//build/config/v8_target_cpu.gni") | 28 import("//build/config/v8_target_cpu.gni") |
29 | 29 |
30 declare_args() { | 30 declare_args() { |
31 # The snapshot needs to be compiled for the host, but compiled with | 31 # The snapshot needs to be compiled for the host, but compiled with |
32 # a toolchain that matches the bit-width of the target. | 32 # a toolchain that matches the bit-width of the target. |
33 v8_snapshot_toolchain = "" | 33 v8_snapshot_toolchain = "" |
34 } | 34 } |
35 | 35 |
36 # TODO(GYP): For now we only support 32-bit little-endian target builds from an | 36 # TODO(GYP): Fill in any missing host/target combinations. |
37 # x64 Linux host. Eventually we need to support all of the host/target | |
38 # configurations v8 runs on. | |
39 if (v8_snapshot_toolchain == "") { | 37 if (v8_snapshot_toolchain == "") { |
40 if (host_cpu == "x64" && host_os == "linux") { | 38 if (v8_current_cpu == v8_target_cpu && current_cpu == target_cpu) { |
| 39 # Args that are specified by the user can end up having the same |
| 40 # effect as args that are specified in a toolchain; for example, |
| 41 # building on linux x64 with v8_target_cpu == "arm64" will use |
| 42 # the //build/toolchain/linux:clang_x64 toolchain, but have the |
| 43 # same effect as if you specified |
| 44 # |
| 45 # custom_toolchain="//build/toolchain/linux:clang_x64_v8_arm64" |
| 46 # |
| 47 # As a result, if we didn't take that into account we could |
| 48 # accidentally end up building two identical copies of v8. |
| 49 v8_snapshot_toolchain = default_toolchain |
| 50 } else if (host_cpu == "x64" && host_os == "linux") { |
41 if (current_cpu == "arm" || current_cpu == "mipsel" || | 51 if (current_cpu == "arm" || current_cpu == "mipsel" || |
42 current_cpu == "x86") { | 52 current_cpu == "x86") { |
43 _snapshot_cpu = "x86" | 53 _snapshot_cpu = "x86" |
44 } else { | 54 } else { |
45 assert(current_cpu == "arm64" || current_cpu == "x64" || | 55 assert(current_cpu == "arm64" || current_cpu == "x64" || |
46 current_cpu == "mipsel64", | 56 current_cpu == "mipsel64", |
47 "Need environment for this arch: $current_cpu") | 57 "Need environment for this arch: $current_cpu") |
48 _snapshot_cpu = "x64" | 58 _snapshot_cpu = "x64" |
49 } | 59 } |
50 | 60 |
51 if (v8_current_cpu != _snapshot_cpu) { | 61 if (v8_current_cpu != _snapshot_cpu) { |
52 _cpus = "${_snapshot_cpu}_v8_${v8_current_cpu}" | 62 _cpus = "${_snapshot_cpu}_v8_${v8_current_cpu}" |
53 } else { | 63 } else { |
54 _cpus = _snapshot_cpu | 64 _cpus = _snapshot_cpu |
55 } | 65 } |
56 | 66 |
57 if ((host_os == "linux" && current_os == "android") || is_clang) { | 67 if ((host_os == "linux" && current_os == "android") || is_clang) { |
58 v8_snapshot_toolchain = "//build/toolchain/linux:clang_${_cpus}" | 68 v8_snapshot_toolchain = "//build/toolchain/linux:clang_${_cpus}" |
59 } else { | 69 } else { |
60 v8_snapshot_toolchain = "//build/toolchain/linux:${_cpus}" | 70 v8_snapshot_toolchain = "//build/toolchain/linux:${_cpus}" |
61 } | 71 } |
62 } else if (host_os == "mac" && current_os == "win") { | 72 } else if (host_os == "mac" && current_os == "win") { |
63 assert(v8_current_cpu == current_cpu, | 73 assert(v8_current_cpu == current_cpu, |
64 "v8 target must match the regular target on this platform") | 74 "v8 target must match the regular target on this platform") |
65 v8_snapshot_toolchain = "//build/toolchain/mac:clang_$current_cpu" | 75 v8_snapshot_toolchain = "//build/toolchain/mac:clang_$current_cpu" |
66 } else { | 76 } else { |
67 v8_snapshot_toolchain = default_toolchain | 77 v8_snapshot_toolchain = default_toolchain |
68 } | 78 } |
69 } | 79 } |
OLD | NEW |