19a0061b6Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
29a0061b6Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
39a0061b6Sopenharmony_ci# you may not use this file except in compliance with the License.
49a0061b6Sopenharmony_ci# You may obtain a copy of the License at
59a0061b6Sopenharmony_ci#
69a0061b6Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
79a0061b6Sopenharmony_ci#
89a0061b6Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
99a0061b6Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
109a0061b6Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119a0061b6Sopenharmony_ci# See the License for the specific language governing permissions and
129a0061b6Sopenharmony_ci# limitations under the License.
139a0061b6Sopenharmony_ci
149a0061b6Sopenharmony_ciimport("//build/ohos.gni")
159a0061b6Sopenharmony_ci
169a0061b6Sopenharmony_ciiptables_path = rebase_path("//third_party/iptables")
179a0061b6Sopenharmony_ciexec_script("install.sh", [ "$iptables_path" ])
189a0061b6Sopenharmony_ci
199a0061b6Sopenharmony_ciconfig("iptables_config") {
209a0061b6Sopenharmony_ci  cflags = [
219a0061b6Sopenharmony_ci    "-D_LARGEFILE_SOURCE=1",
229a0061b6Sopenharmony_ci    "-D_LARGE_FILES",
239a0061b6Sopenharmony_ci    "-D_FILE_OFFSET_BITS=64",
249a0061b6Sopenharmony_ci    "-D_REENTRANT",
259a0061b6Sopenharmony_ci    "-DENABLE_IPV4",
269a0061b6Sopenharmony_ci    "-DENABLE_IPV6",
279a0061b6Sopenharmony_ci    "-Wall",
289a0061b6Sopenharmony_ci    "-Wno-error",
299a0061b6Sopenharmony_ci    "-Wno-pointer-arith",
309a0061b6Sopenharmony_ci    "-Wno-sign-compare",
319a0061b6Sopenharmony_ci    "-Wno-unused-parameter",
329a0061b6Sopenharmony_ci    "-Wno-missing-field-initializers",
339a0061b6Sopenharmony_ci    "-Wno-parentheses-equality",
349a0061b6Sopenharmony_ci    "-DNO_SHARED_LIBS=1",
359a0061b6Sopenharmony_ci    "-DALL_INCLUSIVE",
369a0061b6Sopenharmony_ci    "-DXTABLES_INTERNAL",
379a0061b6Sopenharmony_ci  ]
389a0061b6Sopenharmony_ci}
399a0061b6Sopenharmony_ci
409a0061b6Sopenharmony_ciohos_executable("iptables") {
419a0061b6Sopenharmony_ci  sources = [
429a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/ip6tables-standalone.c",
439a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/ip6tables.c",
449a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-restore.c",
459a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-save.c",
469a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-standalone.c",
479a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-xml.c",
489a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables.c",
499a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/xshared.c",
509a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/xtables-legacy-multi.c",
519a0061b6Sopenharmony_ci  ]
529a0061b6Sopenharmony_ci
539a0061b6Sopenharmony_ci  include_dirs = [
549a0061b6Sopenharmony_ci    "//third_party/iptables",
559a0061b6Sopenharmony_ci    "//third_party/iptables/extensions",
569a0061b6Sopenharmony_ci    "//third_party/iptables/include",
579a0061b6Sopenharmony_ci    "//third_party/iptables/iptables",
589a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc",
599a0061b6Sopenharmony_ci  ]
609a0061b6Sopenharmony_ci  license_file = "//third_party/iptables/COPYING"
619a0061b6Sopenharmony_ci  configs = [ ":iptables_config" ]
629a0061b6Sopenharmony_ci
639a0061b6Sopenharmony_ci  install_enable = true
649a0061b6Sopenharmony_ci
659a0061b6Sopenharmony_ci  deps = [
669a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext",
679a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext4",
689a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext6",
699a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc:libip4tc",
709a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc:libip6tc",
719a0061b6Sopenharmony_ci    "//third_party/iptables/libxtables:libxtables",
729a0061b6Sopenharmony_ci  ]
739a0061b6Sopenharmony_ci
749a0061b6Sopenharmony_ci  symlink_target_name = [ "ip6tables" ]
759a0061b6Sopenharmony_ci  part_name = "iptables"
769a0061b6Sopenharmony_ci  subsystem_name = "thirdparty"
779a0061b6Sopenharmony_ci}
789a0061b6Sopenharmony_ci
799a0061b6Sopenharmony_ciohos_executable("iptables-save") {
809a0061b6Sopenharmony_ci  sources = [
819a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/ip6tables-standalone.c",
829a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/ip6tables.c",
839a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-restore.c",
849a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-save.c",
859a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-standalone.c",
869a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-xml.c",
879a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables.c",
889a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/xshared.c",
899a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/xtables-legacy-multi.c",
909a0061b6Sopenharmony_ci  ]
919a0061b6Sopenharmony_ci
929a0061b6Sopenharmony_ci  include_dirs = [
939a0061b6Sopenharmony_ci    "//third_party/iptables",
949a0061b6Sopenharmony_ci    "//third_party/iptables/extensions",
959a0061b6Sopenharmony_ci    "//third_party/iptables/include",
969a0061b6Sopenharmony_ci    "//third_party/iptables/iptables",
979a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc",
989a0061b6Sopenharmony_ci  ]
999a0061b6Sopenharmony_ci  configs = [ ":iptables_config" ]
1009a0061b6Sopenharmony_ci
1019a0061b6Sopenharmony_ci  install_enable = true
1029a0061b6Sopenharmony_ci
1039a0061b6Sopenharmony_ci  deps = [
1049a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext",
1059a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext4",
1069a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext6",
1079a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc:libip4tc",
1089a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc:libip6tc",
1099a0061b6Sopenharmony_ci    "//third_party/iptables/libxtables:libxtables",
1109a0061b6Sopenharmony_ci  ]
1119a0061b6Sopenharmony_ci
1129a0061b6Sopenharmony_ci  symlink_target_name = [ "ip6tables-save" ]
1139a0061b6Sopenharmony_ci  part_name = "iptables"
1149a0061b6Sopenharmony_ci  subsystem_name = "thirdparty"
1159a0061b6Sopenharmony_ci}
1169a0061b6Sopenharmony_ci
1179a0061b6Sopenharmony_ciohos_executable("iptables-restore") {
1189a0061b6Sopenharmony_ci  sources = [
1199a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/ip6tables-standalone.c",
1209a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/ip6tables.c",
1219a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-restore.c",
1229a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-save.c",
1239a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-standalone.c",
1249a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables-xml.c",
1259a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/iptables.c",
1269a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/xshared.c",
1279a0061b6Sopenharmony_ci    "//third_party/iptables/iptables/xtables-legacy-multi.c",
1289a0061b6Sopenharmony_ci  ]
1299a0061b6Sopenharmony_ci
1309a0061b6Sopenharmony_ci  include_dirs = [
1319a0061b6Sopenharmony_ci    "//third_party/iptables",
1329a0061b6Sopenharmony_ci    "//third_party/iptables/extensions",
1339a0061b6Sopenharmony_ci    "//third_party/iptables/include",
1349a0061b6Sopenharmony_ci    "//third_party/iptables/iptables",
1359a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc",
1369a0061b6Sopenharmony_ci  ]
1379a0061b6Sopenharmony_ci  configs = [ ":iptables_config" ]
1389a0061b6Sopenharmony_ci
1399a0061b6Sopenharmony_ci  install_enable = true
1409a0061b6Sopenharmony_ci
1419a0061b6Sopenharmony_ci  deps = [
1429a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext",
1439a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext4",
1449a0061b6Sopenharmony_ci    "//third_party/iptables/extensions:libext6",
1459a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc:libip4tc",
1469a0061b6Sopenharmony_ci    "//third_party/iptables/libiptc:libip6tc",
1479a0061b6Sopenharmony_ci    "//third_party/iptables/libxtables:libxtables",
1489a0061b6Sopenharmony_ci  ]
1499a0061b6Sopenharmony_ci
1509a0061b6Sopenharmony_ci  symlink_target_name = [ "ip6tables-restore" ]
1519a0061b6Sopenharmony_ci  part_name = "iptables"
1529a0061b6Sopenharmony_ci  subsystem_name = "thirdparty"
1539a0061b6Sopenharmony_ci}
154