• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/config/clang/clang.gni")
15import("//build/ohos.gni")
16import("jsvm.gni")
17
18ohos_prebuilt_etc("app_jit_enable_list") {
19  relative_install_dir = "jsvm"
20  source = "./app_jit_enable_list.conf"
21  part_name = "napi"
22  subsystem_name = "arkui"
23}
24
25ohos_prebuilt_shared_library("libv8") {
26  deps = [ ":copy_v8" ]
27
28  source = "$target_gen_dir/libv8_shared.so"
29  subsystem_name = "arkui"
30  part_name = "napi"
31}
32
33action("copy_v8") {
34  external_deps = []
35  deps = []
36  script = "copy_v8.sh"
37  sources = []
38  outputs = [
39    "$target_gen_dir/libv8_shared.so",
40    "$target_gen_dir/v8-include",
41  ]
42  args = [
43    "--target_gen_dir",
44    rebase_path("$target_gen_dir"),
45  ]
46}
47
48ohos_prebuilt_shared_library("libjsvm") {
49  deps = [
50    ":app_jit_enable_list",
51    ":build_libjsvm",
52    ":libv8",
53  ]
54
55  if (support_hwasan && is_asan && use_hwasan) {
56    source = "$target_gen_dir/asan/libjsvm.so"
57  } else {
58    source = "$target_gen_dir/libjsvm.so"
59  }
60  subsystem_name = "arkui"
61  part_name = "napi"
62  license_file = "v8_OpenSource.txt"
63
64  install_enable = true
65  install_images = [ "system" ]
66  innerapi_tags = [ "ndk" ]
67}
68
69action("build_libjsvm") {
70  external_deps = [
71    "hilog:libhilog",
72    "hitrace:hitrace_meter",
73    "icu:shared_icui18n",
74    "icu:shared_icuuc",
75    "libuv:uv",
76    "node:node_header_notice",
77    "openssl:libcrypto_shared",
78    "openssl:libssl_shared",
79    "resource_schedule_service:ressched_client",
80  ]
81  deps = [ "//third_party/musl:musl_all" ]
82  script = "build_jsvm.sh"
83  sources = []
84  if (support_hwasan && is_asan && use_hwasan) {
85    outputs = [ "$target_gen_dir/asan/libjsvm.so" ]
86  } else {
87    outputs = [ "$target_gen_dir/libjsvm.so" ]
88  }
89  args = [
90    "--target_gen_dir",
91    rebase_path("$target_gen_dir"),
92    "--target_cpu",
93    "$target_cpu",
94    "--target_platform",
95    "$target_platform",
96    "--prefix",
97    rebase_path("$clang_base_path/bin"),
98    "--sysroot",
99    rebase_path("$musl_sysroot"),
100    "--node_path",
101    rebase_path("//third_party/node"),
102    "--is_asan",
103    "$is_asan",
104    "--use_hwasan",
105    "$support_hwasan && $use_hwasan",
106  ]
107  if (use_clang_coverage) {
108    args += [
109      "--target_clang_coverage",
110      "$use_clang_coverage",
111    ]
112  }
113}
114