• 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]
46code_dir = root_build_dir + "/third_party/brotli" + "/brotli-1.0.9"
47src_path = "//third_party/brotli"
48brotli_path = root_build_dir + "/third_party/brotli"
49action("installOpenEulerBrotli") {
50  print("brotli install")
51  script = "install.sh"
52
53  args = [
54    rebase_path(src_path, root_build_dir),
55    rebase_path(brotli_path, root_build_dir),
56  ]
57  inputs = [ src_path ]
58  outputs = []
59  foreach(src, brotli_source) {
60    outputs += [ "$code_dir/" + src ]
61  }
62}
63config("brotli_config") {
64  include_dirs = [ "$code_dir" + "/c/include" ]
65  cflags = [
66    "-Wno-deprecated-declarations",
67    "-D_GNU_SOURCE",
68    "-D_HAS_EXCEPTIONS=0",
69    "-DHAVE_CONFIG_H",
70    "-Wno-macro-redefined",
71  ]
72}
73
74ohos_shared_library("brotli_shared") {
75  deps = [ ":installOpenEulerBrotli" ]
76  if (current_os == "ios") {
77    ldflags = [
78      "-Wl",
79      "-install_name",
80      "@rpath/libbrotli_shared.framework/libbrotli_shared",
81    ]
82  }
83  public_configs = [ ":brotli_config" ]
84  sources = []
85  foreach(src, brotli_source) {
86    sources += [ "$code_dir/" + src ]
87  }
88  install_images = [
89    "updater",
90    "system",
91  ]
92  innerapi_tags = [ "chipsetsdk_indirect" ]
93  subsystem_name = "thirdparty"
94  part_name = "brotli"
95}
96
97group("brotli_target") {
98  deps = [ "//third_party/brotli:brotli_shared" ]
99}
100