| 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): Fill in any missing host/target combinations. | 36 # TODO(GYP): For now we only support 32-bit little-endian target builds from an |
| 37 # x64 Linux host. Eventually we need to support all of the host/target |
| 38 # configurations v8 runs on. |
| 37 if (v8_snapshot_toolchain == "") { | 39 if (v8_snapshot_toolchain == "") { |
| 38 if (v8_current_cpu == v8_target_cpu && current_cpu == target_cpu) { | 40 if (host_cpu == "x64" && host_os == "linux") { |
| 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") { | |
| 51 if (current_cpu == "arm" || current_cpu == "mipsel" || | 41 if (current_cpu == "arm" || current_cpu == "mipsel" || |
| 52 current_cpu == "x86") { | 42 current_cpu == "x86") { |
| 53 _snapshot_cpu = "x86" | 43 _snapshot_cpu = "x86" |
| 54 } else { | 44 } else { |
| 55 assert(current_cpu == "arm64" || current_cpu == "x64" || | 45 assert(current_cpu == "arm64" || current_cpu == "x64" || |
| 56 current_cpu == "mipsel64", | 46 current_cpu == "mipsel64", |
| 57 "Need environment for this arch: $current_cpu") | 47 "Need environment for this arch: $current_cpu") |
| 58 _snapshot_cpu = "x64" | 48 _snapshot_cpu = "x64" |
| 59 } | 49 } |
| 60 | 50 |
| 61 if (v8_current_cpu != _snapshot_cpu) { | 51 if (v8_current_cpu != _snapshot_cpu) { |
| 62 _cpus = "${_snapshot_cpu}_v8_${v8_current_cpu}" | 52 _cpus = "${_snapshot_cpu}_v8_${v8_current_cpu}" |
| 63 } else { | 53 } else { |
| 64 _cpus = _snapshot_cpu | 54 _cpus = _snapshot_cpu |
| 65 } | 55 } |
| 66 | 56 |
| 67 if ((host_os == "linux" && current_os == "android") || is_clang) { | 57 if ((host_os == "linux" && current_os == "android") || is_clang) { |
| 68 v8_snapshot_toolchain = "//build/toolchain/linux:clang_${_cpus}" | 58 v8_snapshot_toolchain = "//build/toolchain/linux:clang_${_cpus}" |
| 69 } else { | 59 } else { |
| 70 v8_snapshot_toolchain = "//build/toolchain/linux:${_cpus}" | 60 v8_snapshot_toolchain = "//build/toolchain/linux:${_cpus}" |
| 71 } | 61 } |
| 72 } else if (host_os == "mac" && current_os == "win") { | 62 } else if (host_os == "mac" && current_os == "win") { |
| 73 assert(v8_current_cpu == current_cpu, | 63 assert(v8_current_cpu == current_cpu, |
| 74 "v8 target must match the regular target on this platform") | 64 "v8 target must match the regular target on this platform") |
| 75 v8_snapshot_toolchain = "//build/toolchain/mac:clang_$current_cpu" | 65 v8_snapshot_toolchain = "//build/toolchain/mac:clang_$current_cpu" |
| 76 } else { | 66 } else { |
| 77 v8_snapshot_toolchain = default_toolchain | 67 v8_snapshot_toolchain = default_toolchain |
| 78 } | 68 } |
| 79 } | 69 } |
| OLD | NEW |