Add ICU message format support
[chromium-blink-merge.git] / third_party / instrumented_libraries / BUILD.gn
blob8d113ef091b42e3ba946cac9d622efefeb873754
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/sanitizers/sanitizers.gni")
7 prebuilt_available =
8     is_msan && (msan_track_origins == 0 || msan_track_origins == 2)
10 group("deps") {
11   if (use_prebuilt_instrumented_libraries) {
12     assert(prebuilt_available,
13            "Prebuilt instrumented libraries are only available when " +
14                "is_msan = true and msan_track_origins = {0, 2}")
15     deps = [
16       ":prebuilt",
17     ]
18   }
21 if (prebuilt_available) {
22   group("prebuilt") {
23     visibility = [ ":deps" ]
24     public_configs = [ ":prebuilt_link_helper" ]
25     deps = [
26       ":extract_prebuilt_instrumented_libraries",
27     ]
28   }
30   if (is_msan) {
31     sanitizer_type = "msan"
32     if (msan_track_origins == 0) {
33       archive_prefix = "msan-no-origins"
34     } else if (msan_track_origins == 2) {
35       archive_prefix = "msan-chained-origins"
36     }
37   }
39   # TODO(GYP): scripts/download_binaries.py uses GYP_DEFINES to decide whether
40   # to download the archives extracted here.
41   # Note: This requires a clobber whenever Ubuntu version changes.
42   action("extract_prebuilt_instrumented_libraries") {
43     visibility = [ ":prebuilt" ]
44     script = "scripts/unpack_binaries.py"
45     depfile = "$target_out_dir/$archive_prefix.d"
46     args = [
47       archive_prefix,
48       rebase_path("binaries"),
49       rebase_path(root_build_dir + "/instrumented_libraries_prebuilt"),
50       rebase_path(target_out_dir, root_build_dir),
51     ]
52     outputs = [
53       "$target_out_dir/$archive_prefix.txt",
54     ]
55   }
57   config("prebuilt_link_helper") {
58     visibility = [ ":prebuilt" ]
59     ldflags = [
60       # Add a relative RPATH entry to Chromium binaries. This puts instrumented
61       # DSOs before system-installed versions in library search path.
62       "-Wl,-R,\$ORIGIN/instrumented_libraries_prebuilt/$sanitizer_type/lib",
63       "-Wl,-z,origin",
64     ]
65   }
67 # TODO(GYP): Support building instrumented libraries from source.