• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2020-2024 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.
13import("//build/ohos.gni")
14
15brotli_source = [
16  "c/common/constants.c",
17  "c/common/context.c",
18  "c/common/dictionary.c",
19  "c/common/platform.c",
20  "c/common/transform.c",
21  "c/dec/bit_reader.c",
22  "c/dec/decode.c",
23  "c/dec/huffman.c",
24  "c/dec/state.c",
25  "c/enc/backward_references.c",
26  "c/enc/backward_references_hq.c",
27  "c/enc/bit_cost.c",
28  "c/enc/block_splitter.c",
29  "c/enc/brotli_bit_stream.c",
30  "c/enc/cluster.c",
31  "c/enc/command.c",
32  "c/enc/compress_fragment.c",
33  "c/enc/compress_fragment_two_pass.c",
34  "c/enc/encode.c",
35  "c/enc/encoder_dict.c",
36  "c/enc/entropy_encode.c",
37  "c/enc/literal_cost.c",
38  "c/enc/fast_log.c",
39  "c/enc/memory.c",
40  "c/enc/metablock.c",
41  "c/enc/static_dict.c",
42  "c/enc/utf8_util.c",
43  "c/enc/dictionary_hash.c",
44  "c/enc/histogram.c",
45  "c/tools/brotli.c",
46]
47code_dir = root_build_dir + "/third_party/brotli" + "/brotli-1.0.9"
48src_path = "//third_party/brotli"
49brotli_path = root_build_dir + "/third_party/brotli"
50action("installOpenEulerBrotli") {
51  print("brotli install")
52  script = "install.sh"
53
54  args = [
55    rebase_path(src_path, root_build_dir),
56    rebase_path(brotli_path, root_build_dir),
57  ]
58  inputs = [ src_path ]
59  outputs = []
60  foreach(src, brotli_source) {
61    outputs += [ "$code_dir/" + src ]
62  }
63}
64config("brotli_config") {
65  include_dirs = [ "$code_dir" + "/c/include" ]
66  cflags = [
67    "-Wno-deprecated-declarations",
68    "-D_GNU_SOURCE",
69    "-D_HAS_EXCEPTIONS=0",
70    "-DHAVE_CONFIG_H",
71    "-Wno-macro-redefined",
72  ]
73}
74
75ohos_shared_library("brotli_shared") {
76  deps = [ ":installOpenEulerBrotli" ]
77  if (current_os == "ios") {
78    ldflags = [
79      "-Wl",
80      "-install_name",
81      "@rpath/libbrotli_shared.framework/libbrotli_shared",
82    ]
83  }
84  public_configs = [ ":brotli_config" ]
85  sources = []
86  foreach(src, brotli_source) {
87    sources += [ "$code_dir/" + src ]
88  }
89  install_images = [
90    "updater",
91    "system",
92  ]
93  subsystem_name = "thirdparty"
94  part_name = "brotli"
95}
96
97ohos_static_library("brotli_static") {
98  deps = [ ":installOpenEulerBrotli" ]
99  if (current_os == "ios") {
100    ldflags = [
101      "-Wl",
102      "-install_name",
103      "@rpath/libbrotli_shared.framework/libbrotli_shared",
104    ]
105  }
106  public_configs = [ ":brotli_config" ]
107  sources = []
108  foreach(src, brotli_source) {
109    sources += [ "$code_dir/" + src ]
110  }
111  subsystem_name = "thirdparty"
112  part_name = "brotli"
113}
114group("brotli_target") {
115  deps = [ "//third_party/brotli:brotli_shared" ]
116}
117