• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 北京万里红科技有限公司
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("//build/config/components/ets_frontend/ets_frontend_config.gni")
16if (ark_standalone_build) {
17  import("$build_root/ark.gni")
18} else {
19  import("//build/ohos.gni")
20}
21
22PCRE2_LIB_DIR = "//third_party/pcre2/pcre2"
23
24# use action replace exec_script
25action("copy_generic_files") {
26  script = rebase_path("//third_party/pcre2/copy_generic_files.sh")
27  inputs = [
28    "$PCRE2_LIB_DIR/src/config.h.generic",
29    "$PCRE2_LIB_DIR/src/pcre2.h.generic",
30    "$PCRE2_LIB_DIR/src/pcre2_chartables.c",
31  ]
32  outputs = [
33    "${target_gen_dir}/src/pcre2_chartables.c",
34  ]
35  args = [
36    rebase_path("$PCRE2_LIB_DIR"),
37    rebase_path("${target_gen_dir}"),
38  ]
39}
40
41# srcs depended by glib
42ohos_shared_headers("pcre2_generated_headers") {
43  include_dirs = [get_label_info(":copy_generic_files", "target_gen_dir") + "/src"]
44  deps = [":copy_generic_files"]
45  part_name = "pcre2"
46  subsystem_name = "thirdparty"
47}
48
49# include dir depended by glib
50ohos_prebuilt_etc("publish_generic_file") {
51  source = get_label_info(":copy_generic_files", "target_gen_dir") + "/src/pcre2_chartables.c"
52  output = "pcre2_chartables.c"
53  part_name = "pcre2"
54  install_enable = false
55  subsystem_name = "thirdparty"
56  deps = [":copy_generic_files"]
57}
58
59config("third_party_pcre2_config") {
60  include_dirs = [ "$PCRE2_LIB_DIR/src" ]
61  include_dirs += [ "${target_gen_dir}/src" ]
62}
63
64pcre2_sources = [
65  "$PCRE2_LIB_DIR/src/pcre2_auto_possess.c",
66  "$PCRE2_LIB_DIR/src/pcre2_chkdint.c",
67  "$PCRE2_LIB_DIR/src/pcre2_compile.c",
68  "$PCRE2_LIB_DIR/src/pcre2_config.c",
69  "$PCRE2_LIB_DIR/src/pcre2_context.c",
70  "$PCRE2_LIB_DIR/src/pcre2_convert.c",
71  "$PCRE2_LIB_DIR/src/pcre2_dfa_match.c",
72  "$PCRE2_LIB_DIR/src/pcre2_error.c",
73  "$PCRE2_LIB_DIR/src/pcre2_extuni.c",
74  "$PCRE2_LIB_DIR/src/pcre2_find_bracket.c",
75  "$PCRE2_LIB_DIR/src/pcre2_jit_compile.c",
76  "$PCRE2_LIB_DIR/src/pcre2_maketables.c",
77  "$PCRE2_LIB_DIR/src/pcre2_match.c",
78  "$PCRE2_LIB_DIR/src/pcre2_match_data.c",
79  "$PCRE2_LIB_DIR/src/pcre2_newline.c",
80  "$PCRE2_LIB_DIR/src/pcre2_ord2utf.c",
81  "$PCRE2_LIB_DIR/src/pcre2_pattern_info.c",
82  "$PCRE2_LIB_DIR/src/pcre2_script_run.c",
83  "$PCRE2_LIB_DIR/src/pcre2_serialize.c",
84  "$PCRE2_LIB_DIR/src/pcre2_string_utils.c",
85  "$PCRE2_LIB_DIR/src/pcre2_study.c",
86  "$PCRE2_LIB_DIR/src/pcre2_substitute.c",
87  "$PCRE2_LIB_DIR/src/pcre2_substring.c",
88  "$PCRE2_LIB_DIR/src/pcre2_tables.c",
89  "$PCRE2_LIB_DIR/src/pcre2_ucd.c",
90  "$PCRE2_LIB_DIR/src/pcre2_valid_utf.c",
91  "$PCRE2_LIB_DIR/src/pcre2_xclass.c",
92]
93
94ohos_shared_library("libpcre2") {
95  deps = [ ":publish_generic_file" ]
96  branch_protector_ret = "pac_ret"
97  output_name = "libpcre2"
98  sources = pcre2_sources
99  sources += get_target_outputs(":publish_generic_file")
100  public_configs = [ ":third_party_pcre2_config" ]
101  cflags = [
102    "-D_GNU_SOURCE",
103    "-DHAVE_CONFIG_H",
104    "-DSUPPORT_PCRE2_8=1",
105    "-DPCRE2_CODE_UNIT_WIDTH=8",
106    "-w",
107  ]
108  install_enable = true
109  install_images = [
110    "system",
111    "ramdisk",
112    "updater",
113  ]
114  license_file = "$PCRE2_LIB_DIR/LICENCE"
115  innerapi_tags = [
116    "platformsdk_indirect",
117    "chipsetsdk_sp_indirect",
118  ]
119  part_name = "pcre2"
120  subsystem_name = "thirdparty"
121}
122
123ohos_static_library("libpcre2_static") {
124  deps = [ ":publish_generic_file" ]
125  output_name = "libpcre2_static"
126  sources = pcre2_sources
127  sources += get_target_outputs(":publish_generic_file")
128  public_configs = [ ":third_party_pcre2_config" ]
129  cflags = [
130    "-D_GNU_SOURCE",
131    "-DHAVE_CONFIG_H",
132    "-DSUPPORT_PCRE2_8=1",
133    "-DPCRE2_CODE_UNIT_WIDTH=8",
134    "-w",
135  ]
136  license_file = "$PCRE2_LIB_DIR/LICENCE"
137  part_name = "pcre2"
138  subsystem_name = "thirdparty"
139}
140
141ohos_static_library("libpcre2_static_16") {
142  deps = [ ":publish_generic_file" ]
143  output_name = "libpcre2_static_16"
144  sources = pcre2_sources
145  sources -= [ "$PCRE2_LIB_DIR/src/pcre2_chkdint.c" ]
146  sources += get_target_outputs(":publish_generic_file")
147  public_configs = [ ":third_party_pcre2_config" ]
148  cflags = [
149    "-D_GNU_SOURCE",
150    "-DHAVE_CONFIG_H",
151    "-DSUPPORT_PCRE2_16=1",
152    "-DSUPPORT_UNICODE=1",
153    "-DPCRE2_CODE_UNIT_WIDTH=16",
154    "-w",
155  ]
156  license_file = "$PCRE2_LIB_DIR/LICENCE"
157  part_name = "pcre2"
158  subsystem_name = "thirdparty"
159}
160