• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
2#
3# Redistribution and use in source and binary forms, with or without modification,
4# are permitted provided that the following conditions are met:
5#
6# 1. Redistributions of source code must retain the above copyright notice, this list of
7#    conditions and the following disclaimer.
8#
9# 2. Redistributions in binary form must reproduce the above copyright notice, this list
10#    of conditions and the following disclaimer in the documentation and/or other materials
11#    provided with the distribution.
12#
13# 3. Neither the name of the copyright holder nor the names of its contributors may be used
14#    to endorse or promote products derived from this software without specific prior written
15#    permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29nghttp2_lib_sources = [
30  "nghttp2_buf.c",
31  "nghttp2_callbacks.c",
32  "nghttp2_debug.c",
33  "nghttp2_frame.c",
34  "nghttp2_hd.c",
35  "nghttp2_hd_huffman.c",
36  "nghttp2_hd_huffman_data.c",
37  "nghttp2_helper.c",
38  "nghttp2_http.c",
39  "nghttp2_ksl.c",
40  "nghttp2_map.c",
41  "nghttp2_mem.c",
42  "nghttp2_npn.c",
43  "nghttp2_option.c",
44  "nghttp2_outbound_item.c",
45  "nghttp2_pq.c",
46  "nghttp2_priority_spec.c",
47  "nghttp2_queue.c",
48  "nghttp2_rcbuf.c",
49  "nghttp2_session.c",
50  "nghttp2_stream.c",
51  "nghttp2_submit.c",
52  "nghttp2_version.c",
53]
54
55config("nghttp2_lib_config") {
56  include_dirs = [
57    ".",
58    "./includes",
59  ]
60  defines = [ "HAVE_ARPA_INET_H=1" ]
61}
62
63if (defined(ohos_lite)) {
64  import("//build/lite/config/component/lite_component.gni")
65  import("//build/lite/ndk/ndk.gni")
66
67  lite_library("nghttp2_lib_static") {
68    target_type = "static_library"
69    sources = nghttp2_lib_sources
70    public_configs = [ ":nghttp2_lib_config" ]
71    output_name = "nghttp2"
72  }
73
74  lite_library("nghttp2_lib_shared") {
75    target_type = "shared_library"
76    sources = nghttp2_lib_sources
77    public_configs = [ ":nghttp2_lib_config" ]
78    output_name = "nghttp2"
79  }
80
81  ndk_lib("nghttp2_lib_ndk") {
82    if (ohos_kernel_type == "liteos_m") {
83      lib_extension = ".a"
84      deps = [ ":nghttp2_lib_static" ]
85    } else {
86      lib_extension = ".so"
87      deps = [ ":nghttp2_lib_shared" ]
88    }
89    head_files = [
90      "//third_party/nghttp2/lib",
91      "//third_party/nghttp2/lib/includes",
92    ]
93  }
94} else {
95  import("//build/ohos.gni")
96
97  ohos_static_library("nghttp2") {
98    include_dirs = [ "includes" ]
99    license_file = "//third_party/nghttp2/COPYING"
100    defines = []
101    if (is_linux || is_mac || is_ohos) {
102      defines += [
103        "HAVE_ARPA_INET_H=1",
104        "HAVE_NETINET_IN_H=1",
105      ]
106    }
107    sources = nghttp2_lib_sources
108  }
109
110  ohos_shared_library("libnghttp2_shared") {
111    include_dirs = [ "includes" ]
112    license_file = "//third_party/nghttp2/COPYING"
113    defines = []
114    if (is_linux || is_mac || is_ohos) {
115      defines += [
116        "HAVE_ARPA_INET_H=1",
117        "HAVE_NETINET_IN_H=1",
118      ]
119      if ((is_linux || is_ohos) && product_name != "ohos-sdk") {
120        version_script = "libnghttp2_shared.map"
121      }
122    }
123    sources = nghttp2_lib_sources
124
125    subsystem_name = "thirdparty"
126    part_name = "thirdparty_nghttp2"
127  }
128}
129