• 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/ohos.gni")
16
17PCRE2_LIB_DIR = "//third_party/pcre2/pcre2"
18
19ohos_shared_library("libpcre2") {
20  md5_check_script = rebase_path("$PCRE2_LIB_DIR/check_md5.sh")
21  _arguments_config = [
22    rebase_path("$PCRE2_LIB_DIR/src/config.h.generic"),
23    rebase_path("$PCRE2_LIB_DIR/src/config.h"),
24  ]
25
26  check_config_result =
27      exec_script(md5_check_script, _arguments_config, "string")
28  if (check_config_result == "") {
29    exec_script("/usr/bin/env",
30                [
31                  "cp",
32                  rebase_path("$PCRE2_LIB_DIR/src/config.h.generic"),
33                  rebase_path("$PCRE2_LIB_DIR/src/config.h"),
34                ])
35  }
36
37  _arguments_pcre2 = [
38    rebase_path("$PCRE2_LIB_DIR/src/pcre2.h.generic"),
39    rebase_path("$PCRE2_LIB_DIR/src/pcre2.h"),
40  ]
41
42  check_pcre2_result = exec_script(md5_check_script, _arguments_pcre2, "string")
43  if (check_pcre2_result == "") {
44    exec_script("/usr/bin/env",
45                [
46                  "cp",
47                  rebase_path("$PCRE2_LIB_DIR/src/pcre2.h.generic"),
48                  rebase_path("$PCRE2_LIB_DIR/src/pcre2.h"),
49                ])
50  }
51
52  _arguments_pcre2_chartables = [
53    rebase_path("$PCRE2_LIB_DIR/src/pcre2_chartables.c.dist"),
54    rebase_path("$PCRE2_LIB_DIR/src/pcre2_chartables.c"),
55  ]
56
57  check_pcre2_chartables_result =
58      exec_script(md5_check_script, _arguments_pcre2_chartables, "string")
59  if (check_pcre2_chartables_result == "") {
60    exec_script("/usr/bin/env",
61                [
62                  "cp",
63                  rebase_path("$PCRE2_LIB_DIR/src/pcre2_chartables.c.dist"),
64                  rebase_path("$PCRE2_LIB_DIR/src/pcre2_chartables.c"),
65                ])
66  }
67
68  output_name = "libpcre2"
69  sources = [
70    "$PCRE2_LIB_DIR/src/pcre2_auto_possess.c",
71    "$PCRE2_LIB_DIR/src/pcre2_chartables.c",
72    "$PCRE2_LIB_DIR/src/pcre2_compile.c",
73    "$PCRE2_LIB_DIR/src/pcre2_config.c",
74    "$PCRE2_LIB_DIR/src/pcre2_context.c",
75    "$PCRE2_LIB_DIR/src/pcre2_convert.c",
76    "$PCRE2_LIB_DIR/src/pcre2_dfa_match.c",
77    "$PCRE2_LIB_DIR/src/pcre2_error.c",
78    "$PCRE2_LIB_DIR/src/pcre2_extuni.c",
79    "$PCRE2_LIB_DIR/src/pcre2_find_bracket.c",
80    "$PCRE2_LIB_DIR/src/pcre2_jit_compile.c",
81    "$PCRE2_LIB_DIR/src/pcre2_maketables.c",
82    "$PCRE2_LIB_DIR/src/pcre2_match.c",
83    "$PCRE2_LIB_DIR/src/pcre2_match_data.c",
84    "$PCRE2_LIB_DIR/src/pcre2_newline.c",
85    "$PCRE2_LIB_DIR/src/pcre2_ord2utf.c",
86    "$PCRE2_LIB_DIR/src/pcre2_pattern_info.c",
87    "$PCRE2_LIB_DIR/src/pcre2_script_run.c",
88    "$PCRE2_LIB_DIR/src/pcre2_serialize.c",
89    "$PCRE2_LIB_DIR/src/pcre2_string_utils.c",
90    "$PCRE2_LIB_DIR/src/pcre2_study.c",
91    "$PCRE2_LIB_DIR/src/pcre2_substitute.c",
92    "$PCRE2_LIB_DIR/src/pcre2_substring.c",
93    "$PCRE2_LIB_DIR/src/pcre2_tables.c",
94    "$PCRE2_LIB_DIR/src/pcre2_ucd.c",
95    "$PCRE2_LIB_DIR/src/pcre2_valid_utf.c",
96    "$PCRE2_LIB_DIR/src/pcre2_xclass.c",
97  ]
98  include_dirs = [ "$PCRE2_LIB_DIR/src" ]
99  cflags = [
100    "-D_GNU_SOURCE",
101    "-DHAVE_CONFIG_H",
102    "-DSUPPORT_PCRE2_8=1",
103    "-DPCRE2_CODE_UNIT_WIDTH=8",
104    "-w",
105  ]
106  install_enable = true
107  install_images = [
108    "system",
109    "ramdisk",
110    "updater",
111  ]
112  license_file = "$PCRE2_LIB_DIR/LICENCE"
113  innerapi_tags = [
114    "platformsdk_indirect",
115    "chipsetsdk_indirect",
116  ]
117  part_name = "pcre2"
118  subsystem_name = "thirdparty"
119}
120