• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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.
13
14import("//build/ohos.gni")
15
16iptables_path = rebase_path("//third_party/iptables")
17exec_script("install.sh", [ "$iptables_path" ])
18
19config("iptables_config") {
20  cflags = [
21    "-D_LARGEFILE_SOURCE=1",
22    "-D_LARGE_FILES",
23    "-D_FILE_OFFSET_BITS=64",
24    "-D_REENTRANT",
25    "-DENABLE_IPV4",
26    "-DENABLE_IPV6",
27    "-Wall",
28    "-Wno-error",
29    "-Wno-pointer-arith",
30    "-Wno-sign-compare",
31    "-Wno-unused-parameter",
32    "-Wno-missing-field-initializers",
33    "-Wno-parentheses-equality",
34    "-DNO_SHARED_LIBS=1",
35    "-DALL_INCLUSIVE",
36    "-DXTABLES_INTERNAL",
37  ]
38}
39
40ohos_executable("iptables") {
41  sources = [
42    "//third_party/iptables/iptables/ip6tables-standalone.c",
43    "//third_party/iptables/iptables/ip6tables.c",
44    "//third_party/iptables/iptables/iptables-restore.c",
45    "//third_party/iptables/iptables/iptables-save.c",
46    "//third_party/iptables/iptables/iptables-standalone.c",
47    "//third_party/iptables/iptables/iptables-xml.c",
48    "//third_party/iptables/iptables/iptables.c",
49    "//third_party/iptables/iptables/xshared.c",
50    "//third_party/iptables/iptables/xtables-legacy-multi.c",
51  ]
52
53  include_dirs = [
54    "//third_party/iptables",
55    "//third_party/iptables/extensions",
56    "//third_party/iptables/include",
57    "//third_party/iptables/iptables",
58    "//third_party/iptables/libiptc",
59  ]
60  license_file = "//third_party/iptables/COPYING"
61  configs = [ ":iptables_config" ]
62
63  install_enable = true
64
65  deps = [
66    "//third_party/iptables/extensions:libext",
67    "//third_party/iptables/extensions:libext4",
68    "//third_party/iptables/extensions:libext6",
69    "//third_party/iptables/libiptc:libip4tc",
70    "//third_party/iptables/libiptc:libip6tc",
71    "//third_party/iptables/libxtables:libxtables",
72  ]
73
74  symlink_target_name = [ "ip6tables" ]
75  part_name = "iptables"
76  subsystem_name = "thirdparty"
77}
78
79ohos_executable("iptables-save") {
80  sources = [
81    "//third_party/iptables/iptables/ip6tables-standalone.c",
82    "//third_party/iptables/iptables/ip6tables.c",
83    "//third_party/iptables/iptables/iptables-restore.c",
84    "//third_party/iptables/iptables/iptables-save.c",
85    "//third_party/iptables/iptables/iptables-standalone.c",
86    "//third_party/iptables/iptables/iptables-xml.c",
87    "//third_party/iptables/iptables/iptables.c",
88    "//third_party/iptables/iptables/xshared.c",
89    "//third_party/iptables/iptables/xtables-legacy-multi.c",
90  ]
91
92  include_dirs = [
93    "//third_party/iptables",
94    "//third_party/iptables/extensions",
95    "//third_party/iptables/include",
96    "//third_party/iptables/iptables",
97    "//third_party/iptables/libiptc",
98  ]
99  configs = [ ":iptables_config" ]
100
101  install_enable = true
102
103  deps = [
104    "//third_party/iptables/extensions:libext",
105    "//third_party/iptables/extensions:libext4",
106    "//third_party/iptables/extensions:libext6",
107    "//third_party/iptables/libiptc:libip4tc",
108    "//third_party/iptables/libiptc:libip6tc",
109    "//third_party/iptables/libxtables:libxtables",
110  ]
111
112  symlink_target_name = [ "ip6tables-save" ]
113  part_name = "iptables"
114  subsystem_name = "thirdparty"
115}
116
117ohos_executable("iptables-restore") {
118  sources = [
119    "//third_party/iptables/iptables/ip6tables-standalone.c",
120    "//third_party/iptables/iptables/ip6tables.c",
121    "//third_party/iptables/iptables/iptables-restore.c",
122    "//third_party/iptables/iptables/iptables-save.c",
123    "//third_party/iptables/iptables/iptables-standalone.c",
124    "//third_party/iptables/iptables/iptables-xml.c",
125    "//third_party/iptables/iptables/iptables.c",
126    "//third_party/iptables/iptables/xshared.c",
127    "//third_party/iptables/iptables/xtables-legacy-multi.c",
128  ]
129
130  include_dirs = [
131    "//third_party/iptables",
132    "//third_party/iptables/extensions",
133    "//third_party/iptables/include",
134    "//third_party/iptables/iptables",
135    "//third_party/iptables/libiptc",
136  ]
137  configs = [ ":iptables_config" ]
138
139  install_enable = true
140
141  deps = [
142    "//third_party/iptables/extensions:libext",
143    "//third_party/iptables/extensions:libext4",
144    "//third_party/iptables/extensions:libext6",
145    "//third_party/iptables/libiptc:libip4tc",
146    "//third_party/iptables/libiptc:libip6tc",
147    "//third_party/iptables/libxtables:libxtables",
148  ]
149
150  symlink_target_name = [ "ip6tables-restore" ]
151  part_name = "iptables"
152  subsystem_name = "thirdparty"
153}
154