| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium 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 # This header file defines the "sysroot" variable which is the absolute path | 5 # This header file defines the "sysroot" variable which is the absolute path |
| 6 # of the sysroot. If no sysroot applies, the variable will be an empty string. | 6 # of the sysroot. If no sysroot applies, the variable will be an empty string. |
| 7 | 7 |
| 8 import("//build/config/chrome_build.gni") | 8 import("//build/config/chrome_build.gni") |
| 9 | 9 |
| 10 declare_args() { | 10 declare_args() { |
| 11 # The absolute path of the sysroot that is applied when compiling using | 11 # The absolute path of the sysroot that is applied when compiling using |
| 12 # the target toolchain. | 12 # the target toolchain. |
| 13 target_sysroot = "" | 13 target_sysroot = "" |
| 14 | 14 |
| 15 # The absolute path to directory containing sysroots for linux 32 and 64bit | 15 # The absolute path to directory containing linux sysroot images |
| 16 target_sysroot_dir = "" | 16 target_sysroot_dir = "//build/linux" |
| 17 | 17 |
| 18 use_sysroot = true | 18 use_sysroot = true |
| 19 } | 19 } |
| 20 | 20 |
| 21 if (is_linux && target_sysroot_dir != "") { | 21 if (current_os == target_os && current_cpu == target_cpu && |
| 22 if (current_cpu == "x64") { | |
| 23 sysroot = target_sysroot_dir + "/wheezy-x64" | |
| 24 } else if (current_cpu == "x86") { | |
| 25 sysroot = target_sysroot_dir + "/wheezy-ia32" | |
| 26 } | |
| 27 } else if (current_os == target_os && current_cpu == target_cpu && | |
| 28 target_sysroot != "") { | 22 target_sysroot != "") { |
| 29 sysroot = target_sysroot | 23 sysroot = target_sysroot |
| 30 } else if (is_android) { | 24 } else if (is_android) { |
| 31 import("//build/config/android/config.gni") | 25 import("//build/config/android/config.gni") |
| 32 if (current_cpu == "x86") { | 26 if (current_cpu == "x86") { |
| 33 sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" | 27 sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" |
| 34 } else if (current_cpu == "arm") { | 28 } else if (current_cpu == "arm") { |
| 35 sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" | 29 sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" |
| 36 } else if (current_cpu == "mipsel") { | 30 } else if (current_cpu == "mipsel") { |
| 37 sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" | 31 sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" |
| 38 } else if (current_cpu == "x64") { | 32 } else if (current_cpu == "x64") { |
| 39 sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" | 33 sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" |
| 40 } else if (current_cpu == "arm64") { | 34 } else if (current_cpu == "arm64") { |
| 41 sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" | 35 sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" |
| 42 } else if (current_cpu == "mips64el") { | 36 } else if (current_cpu == "mips64el") { |
| 43 sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" | 37 sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" |
| 44 } else { | 38 } else { |
| 45 sysroot = "" | 39 assert(false, "No android sysroot for cpu: $target_cpu") |
| 46 } | 40 } |
| 47 } else if (is_linux && use_sysroot) { | 41 } else if (is_linux && use_sysroot) { |
| 48 # By default build against a sysroot image downloaded from Cloud Storage | 42 # By default build against a sysroot image downloaded from Cloud Storage |
| 49 # during gclient runhooks. | 43 # during gclient runhooks. |
| 50 if (current_cpu == "x64") { | 44 if (current_cpu == "x64") { |
| 51 sysroot = "//build/linux/debian_jessie_amd64-sysroot" | 45 sysroot = "$target_sysroot_dir/debian_jessie_amd64-sysroot" |
| 52 } else if (current_cpu == "x86") { | 46 } else if (current_cpu == "x86") { |
| 53 sysroot = "//build/linux/debian_jessie_i386-sysroot" | 47 sysroot = "$target_sysroot_dir/debian_jessie_i386-sysroot" |
| 54 } else if (current_cpu == "mipsel") { | 48 } else if (current_cpu == "mipsel") { |
| 55 sysroot = "//build/linux/debian_jessie_mips-sysroot" | 49 sysroot = "$target_sysroot_dir/debian_jessie_mips-sysroot" |
| 56 } else if (current_cpu == "arm") { | 50 } else if (current_cpu == "arm") { |
| 57 sysroot = "//build/linux/debian_jessie_arm-sysroot" | 51 sysroot = "$target_sysroot_dir/debian_jessie_arm-sysroot" |
| 58 } else if (current_cpu == "arm64") { | 52 } else if (current_cpu == "arm64") { |
| 59 sysroot = "//build/linux/debian_jessie_arm64-sysroot" | 53 sysroot = "$target_sysroot_dir/debian_jessie_arm64-sysroot" |
| 60 } else { | 54 } else { |
| 61 # Any other builds don't use a sysroot. | 55 assert(false, "No linux sysroot for cpu: $target_cpu") |
| 62 sysroot = "" | |
| 63 } | 56 } |
| 64 | 57 |
| 65 if (sysroot != "") { | 58 if (sysroot != "") { |
| 66 _script_arch = current_cpu | 59 _script_arch = current_cpu |
| 67 if (_script_arch == "x86") { | 60 if (_script_arch == "x86") { |
| 68 _script_arch = "i386" | 61 _script_arch = "i386" |
| 69 } else if (_script_arch == "x64") { | 62 } else if (_script_arch == "x64") { |
| 70 _script_arch = "amd64" | 63 _script_arch = "amd64" |
| 71 } | 64 } |
| 72 assert( | 65 assert( |
| 73 exec_script("//build/dir_exists.py", | 66 exec_script("//build/dir_exists.py", |
| 74 [ rebase_path(sysroot) ], | 67 [ rebase_path(sysroot) ], |
| 75 "string") == "True", | 68 "string") == "True", |
| 76 "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/in
stall-sysroot.py --arch=$_script_arch") | 69 "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/in
stall-sysroot.py --arch=$_script_arch") |
| 77 } | 70 } |
| 78 } else if (is_mac) { | 71 } else if (is_mac) { |
| 79 import("//build/config/mac/mac_sdk.gni") | 72 import("//build/config/mac/mac_sdk.gni") |
| 80 sysroot = mac_sdk_path | 73 sysroot = mac_sdk_path |
| 81 } else if (is_ios) { | 74 } else if (is_ios) { |
| 82 import("//build/config/ios/ios_sdk.gni") | 75 import("//build/config/ios/ios_sdk.gni") |
| 83 sysroot = ios_sdk_path | 76 sysroot = ios_sdk_path |
| 84 } else { | 77 } else { |
| 85 sysroot = "" | 78 sysroot = "" |
| 86 } | 79 } |
| OLD | NEW |