aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-12-14 16:10:02 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-14 16:10:02 -0800
commitced479ab75042eeada4f8990aac2b6449ed68f79 (patch)
treed582c957f67f2153a4e8d2738afc493d06f12994
parent2300647b228d2c4a7b77f3f6b5b006b6c17594c9 (diff)
parentde807dc5950f2cbfccd3b9e1ca6ca3666bc230ee (diff)
downloadiptables-ced479ab75042eeada4f8990aac2b6449ed68f79.tar.gz
Merge "Convert iptables to Android.bp" am: 57faecf268 am: 66242e3b31
am: de807dc595 Change-Id: I6912a0c04b1dc3b90cc6fe892254968394739938
-rw-r--r--Android.bp36
-rw-r--r--Android.mk3
-rw-r--r--extensions/Android.bp129
-rw-r--r--extensions/Android.mk45
-rwxr-xr-xextensions/gen_init36
-rw-r--r--extensions/libext.mk62
-rw-r--r--iptables/Android.bp93
-rw-r--r--iptables/Android.mk103
l---------iptables/NOTICE1
-rw-r--r--libiptc/Android.bp22
-rw-r--r--libiptc/Android.mk61
-rw-r--r--libxtables/Android.bp26
-rw-r--r--libxtables/Android.mk46
13 files changed, 343 insertions, 320 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..3808573c
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,36 @@
+cc_library_headers {
+ name: "iptables_headers",
+ export_include_dirs: ["include"],
+}
+
+cc_library_headers {
+ name: "iptables_config_header",
+ export_include_dirs: ["."],
+}
+
+cc_library_headers {
+ name: "iptables_iptables_headers",
+ export_include_dirs: ["iptables"],
+}
+
+cc_defaults {
+ name: "iptables_defaults",
+
+ cflags: [
+ "-D_LARGEFILE_SOURCE=1",
+ "-D_LARGE_FILES",
+ "-D_FILE_OFFSET_BITS=64",
+ "-D_REENTRANT",
+
+ "-DENABLE_IPV4",
+ "-DENABLE_IPV6",
+
+ "-Wall",
+ "-Werror",
+ "-Wno-pointer-arith",
+ "-Wno-sign-compare",
+ "-Wno-unused-parameter",
+ ],
+
+ header_libs: ["iptables_headers"],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 4a2bd29f..00000000
--- a/Android.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/extensions/Android.bp b/extensions/Android.bp
new file mode 100644
index 00000000..6296db98
--- /dev/null
+++ b/extensions/Android.bp
@@ -0,0 +1,129 @@
+cc_defaults {
+ name: "libext_defaults",
+ defaults: ["iptables_defaults"],
+
+ header_libs: ["iptables_config_header"],
+
+ cflags: [
+ "-DNO_SHARED_LIBS=1",
+ "-DXTABLES_INTERNAL",
+
+ "-Wno-format",
+ "-Wno-missing-field-initializers",
+ // libxt_recent.c:202:11: error: address of array 'info->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
+ "-Wno-pointer-bool-conversion",
+ "-Wno-tautological-pointer-compare",
+ ],
+}
+
+// All of the extension source files have the same function name (_init). Since we don't support
+// per-file cflags that upstream uses, instead:
+//
+// 1. Rewrite the source files with filter_init to have per-file function names. (libext*_srcs)
+// 2. Create a new source file that defines a function (init_extensions*) with gen_init that calls
+// all of the renamed _init functions (libext*_init)
+//
+// This all happens three times -- once each for libext, libext4, libext6
+
+genrule {
+ name: "libext_init",
+ cmd: "$(location gen_init) '' $(locations libxt_*.c) > $(out)",
+ srcs: [
+ "gen_init",
+ "libxt_*.c",
+ ],
+ out: ["initext.c"],
+ exclude_srcs: [
+ // Exclude some modules that are problematic to compile (types/headers)
+ "libxt_TCPOPTSTRIP.c",
+ "libxt_connlabel.c",
+ "libxt_cgroup.c",
+
+ "libxt_dccp.c",
+ "libxt_ipvs.c",
+ ],
+}
+
+gensrcs {
+ name: "libext_srcs",
+ tool_files: ["filter_init"],
+ cmd: "$(location filter_init) $(in) > $(out)",
+ output_extension: "c",
+ srcs: ["libxt_*.c"],
+ exclude_srcs: [
+ // Exclude some modules that are problematic to compile (types/headers)
+ "libxt_TCPOPTSTRIP.c",
+ "libxt_connlabel.c",
+ "libxt_cgroup.c",
+
+ "libxt_dccp.c",
+ "libxt_ipvs.c",
+ ],
+}
+
+cc_library_static {
+ name: "libext",
+ defaults: ["libext_defaults"],
+ srcs: [
+ ":libext_init",
+ ":libext_srcs",
+ ],
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+genrule {
+ name: "libext4_init",
+ cmd: "$(location gen_init) '4' $(locations libipt_*.c) > $(out)",
+ srcs: [
+ "gen_init",
+ "libipt_*.c",
+ ],
+ out: ["initext.c"],
+}
+
+gensrcs {
+ name: "libext4_srcs",
+ tool_files: ["filter_init"],
+ cmd: "$(location filter_init) $(in) > $(out)",
+ output_extension: "c",
+ srcs: ["libipt_*.c"],
+}
+
+cc_library_static {
+ name: "libext4",
+ defaults: ["libext_defaults"],
+ srcs: [
+ ":libext4_init",
+ ":libext4_srcs",
+ ],
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+genrule {
+ name: "libext6_init",
+ cmd: "$(location gen_init) '6' $(locations libip6t_*.c) > $(out)",
+ srcs: [
+ "gen_init",
+ "libip6t_*.c",
+ ],
+ out: ["initext.c"],
+}
+
+gensrcs {
+ name: "libext6_srcs",
+ tool_files: ["filter_init"],
+ cmd: "$(location filter_init) $(in) > $(out)",
+ output_extension: "c",
+ srcs: ["libip6t_*.c"],
+}
+
+cc_library_static {
+ name: "libext6",
+ defaults: ["libext_defaults"],
+ srcs: [
+ ":libext6_init",
+ ":libext6_srcs",
+ ],
+}
diff --git a/extensions/Android.mk b/extensions/Android.mk
deleted file mode 100644
index 74f1caba..00000000
--- a/extensions/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-#----------------------------------------------------------------
-## extension
-
-MY_srcdir:=$(LOCAL_PATH)
-# Exclude some modules that are problematic to compile (types/header).
-MY_excluded_modules:=TCPOPTSTRIP connlabel cgroup
-
-MY_pfx_build_mod := $(patsubst ${MY_srcdir}/libxt_%.c,%,$(sort $(wildcard ${MY_srcdir}/libxt_*.c)))
-MY_pf4_build_mod := $(patsubst ${MY_srcdir}/libipt_%.c,%,$(sort $(wildcard ${MY_srcdir}/libipt_*.c)))
-MY_pf6_build_mod := $(patsubst ${MY_srcdir}/libip6t_%.c,%,$(sort $(wildcard ${MY_srcdir}/libip6t_*.c)))
-MY_pfx_build_mod := $(filter-out ${MY_excluded_modules} dccp ipvs,${MY_pfx_build_mod})
-MY_pf4_build_mod := $(filter-out ${MY_excluded_modules} dccp ipvs,${MY_pf4_build_mod})
-MY_pf6_build_mod := $(filter-out ${MY_excluded_modules} dccp ipvs,${MY_pf6_build_mod})
-MY_pfx_objs := $(patsubst %,libxt_%.o,${MY_pfx_build_mod})
-MY_pf4_objs := $(patsubst %,libipt_%.o,${MY_pf4_build_mod})
-MY_pf6_objs := $(patsubst %,libip6t_%.o,${MY_pf6_build_mod})
-# libxt_recent.c:202:11: error: address of array 'info->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
-MY_warnings := \
- -Wall -Werror \
- -Wno-format \
- -Wno-missing-field-initializers \
- -Wno-pointer-arith \
- -Wno-pointer-bool-conversion \
- -Wno-sign-compare \
- -Wno-tautological-pointer-compare \
- -Wno-unused-parameter \
-
-libext_suffix :=
-libext_prefix := xt
-libext_build_mod := $(MY_pfx_build_mod)
-include $(LOCAL_PATH)/libext.mk
-
-libext_suffix := 4
-libext_prefix := ipt
-libext_build_mod := $(MY_pf4_build_mod)
-include $(LOCAL_PATH)/libext.mk
-
-libext_suffix := 6
-libext_prefix := ip6t
-libext_build_mod := $(MY_pf6_build_mod)
-include $(LOCAL_PATH)/libext.mk
-
-
-#----------------------------------------------------------------
diff --git a/extensions/gen_init b/extensions/gen_init
new file mode 100755
index 00000000..c1844f36
--- /dev/null
+++ b/extensions/gen_init
@@ -0,0 +1,36 @@
+#!/bin/bash -e
+#
+# Generate init_extensions* functions to call all the _init functions from
+# filter_init
+#
+# Usage: gen_init <suffix> filename...
+#
+# Example output:
+#
+# void libxt_tcp_init(void);
+# void libxt_udp_init(void);
+# void init_extensions(void);
+# void init_extensions(void) {
+# libxt_tcp_init();
+# libxt_udp_init();
+# }
+
+EXT=$1
+shift
+
+for i in "$@"; do
+ f=${i##*/}
+ f=${f%%.*}
+ echo "void ${f}_init(void);"
+done
+
+echo "void init_extensions${EXT}(void);"
+echo "void init_extensions${EXT}(void) {"
+
+for i in "$@"; do
+ f=${i##*/}
+ f=${f%%.*}
+ echo " ${f}_init();"
+done
+
+echo "}"
diff --git a/extensions/libext.mk b/extensions/libext.mk
deleted file mode 100644
index 060ecf01..00000000
--- a/extensions/libext.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS:=
-LOCAL_MODULE:=libext$(libext_suffix)
-
-# LOCAL_MODULE_CLASS must be defined before calling $(local-generated-sources-dir)
-#
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-MY_gen := $(call local-generated-sources-dir)
-
-# LOCAL_PATH needed because of dirty #include "blabla.c"
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/ \
- $(LOCAL_PATH)/.. \
- $(MY_gen) \
- $(LOCAL_PATH)
-
-LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
-# The $* does not work as expected. It ends up empty. Even with SECONDEXPANSION.
-# LOCAL_CFLAGS+=-D_INIT=lib$*_init
-LOCAL_CFLAGS+=-DXTABLES_INTERNAL
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
-# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
-LOCAL_CFLAGS+=-D__ANDROID__
-LOCAL_CFLAGS += $(MY_warnings)
-
-MY_GEN_INITEXT:= $(MY_gen)/initext.c
-$(MY_GEN_INITEXT): MY_initext_func := $(addprefix $(libext_prefix)_,$(libext_build_mod))
-$(MY_GEN_INITEXT): MY_suffix := $(libext_suffix)
-$(MY_GEN_INITEXT):
- @mkdir -p $(dir $@)
- @( \
- echo "" >$@; \
- for i in $(MY_initext_func); do \
- echo "extern void lib$${i}_init(void);" >>$@; \
- done; \
- echo "void init_extensions$(MY_suffix)(void);" >>$@; \
- echo "void init_extensions$(MY_suffix)(void)" >>$@; \
- echo "{" >>$@; \
- for i in $(MY_initext_func); do \
- echo " ""lib$${i}_init();" >>$@; \
- done; \
- echo "}" >>$@; \
- );
-
-MY_lib_sources:= \
- $(patsubst %,$(LOCAL_PATH)/lib$(libext_prefix)_%.c,$(libext_build_mod))
-
-MY_gen_lib_sources:= $(patsubst $(LOCAL_PATH)/%,${MY_gen}/%,${MY_lib_sources})
-
-${MY_gen_lib_sources}: PRIVATE_PATH := $(LOCAL_PATH)
-${MY_gen_lib_sources}: PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/filter_init $(PRIVATE_PATH)/$(notdir $@) > $@
-${MY_gen_lib_sources}: PRIVATE_MODULE := $(LOCAL_MODULE)
-${MY_gen_lib_sources}: PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
-${MY_gen_lib_sources}: ${MY_gen}/% : $(LOCAL_PATH)/% $(LOCAL_PATH)/filter_init
- $(transform-generated-source)
-
-$(MY_GEN_INITEXT): $(MY_gen_lib_sources)
-
-LOCAL_GENERATED_SOURCES:= $(MY_GEN_INITEXT) $(MY_gen_lib_sources)
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/iptables/Android.bp b/iptables/Android.bp
new file mode 100644
index 00000000..4f3f8cf3
--- /dev/null
+++ b/iptables/Android.bp
@@ -0,0 +1,93 @@
+cc_defaults {
+ name: "iptables_cmd_defaults",
+ defaults: ["iptables_defaults"],
+
+ cflags: [
+ "-Wno-missing-field-initializers",
+ "-Wno-parentheses-equality",
+
+ "-DNO_SHARED_LIBS=1",
+ "-DALL_INCLUSIVE",
+ "-DXTABLES_INTERNAL",
+ ],
+
+ header_libs: ["iptables_config_header"],
+
+ required: ["xtables.lock"],
+
+ srcs: [
+ "xtables-multi.c",
+ "iptables-xml.c",
+ "xshared.c",
+ ],
+
+ static_libs: [
+ "libext",
+ "libxtables",
+ ],
+}
+
+//----------------------------------------------------------------
+// The iptables lock file
+
+prebuilt_etc {
+ name: "xtables.lock",
+ src: "xtables.lock",
+}
+
+//----------------------------------------------------------------
+// iptables
+
+cc_binary {
+ name: "iptables",
+ defaults: ["iptables_cmd_defaults"],
+
+ // Undefine ENABLE_IPV6 (from defaults), since that's handled in ip6tables.
+ cflags: ["-UENABLE_IPV6"],
+
+ srcs: [
+ "iptables-save.c",
+ "iptables-restore.c",
+ "iptables-standalone.c",
+ "iptables.c",
+ ],
+
+ static_libs: [
+ "libext4",
+ "libip4tc",
+ ],
+
+ symlinks: [
+ "iptables-save",
+ "iptables-restore",
+ ],
+}
+
+//----------------------------------------------------------------
+// ip6tables
+cc_binary {
+ name: "ip6tables",
+ defaults: ["iptables_cmd_defaults"],
+
+ // Undefine ENABLE_IPV4 (from defaults), since that's handled in iptables.
+ cflags: ["-UENABLE_IPV4"],
+
+ srcs: [
+ "ip6tables-save.c",
+ "ip6tables-restore.c",
+ "ip6tables-standalone.c",
+ "ip6tables.c",
+ ],
+
+ static_libs: [
+ "libext6",
+ "libip6tc",
+ ],
+
+ symlinks: [
+ "ip6tables-save",
+ "ip6tables-restore",
+ ],
+}
+
+//----------------------------------------------------------------
diff --git a/iptables/Android.mk b/iptables/Android.mk
deleted file mode 100644
index 095b90dc..00000000
--- a/iptables/Android.mk
+++ /dev/null
@@ -1,103 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-commonFlags:= \
- -Wno-missing-field-initializers \
- -Wno-sign-compare \
- -Wno-pointer-arith \
- -Wno-unused-parameter \
- -Wno-parentheses-equality \
- -Werror
-
-#----------------------------------------------------------------
-# The iptables lock file
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := xtables.lock
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT)/etc
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-#----------------------------------------------------------------
-# iptables
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/ \
- $(LOCAL_PATH)/../
-
-LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
-LOCAL_CFLAGS+=-DALL_INCLUSIVE
-LOCAL_CFLAGS+=-DXTABLES_INTERNAL
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4
-# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
-LOCAL_CFLAGS+=-D__ANDROID__
-LOCAL_CFLAGS += $(commonFlags)
-
-LOCAL_REQUIRED_MODULES := xtables.lock
-
-LOCAL_SRC_FILES:= \
- xtables-multi.c iptables-xml.c xshared.c \
- iptables-save.c iptables-restore.c \
- iptables-standalone.c iptables.c
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:=iptables
-
-LOCAL_STATIC_LIBRARIES := \
- libext \
- libext4 \
- libip4tc \
- libxtables
-
-LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_OUT)/bin; \
- ln -sf iptables $(TARGET_OUT)/bin/iptables-save; \
- ln -sf iptables $(TARGET_OUT)/bin/iptables-restore
-
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-
-include $(BUILD_EXECUTABLE)
-
-#----------------------------------------------------------------
-# ip6tables
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/ \
- $(LOCAL_PATH)/../
-
-LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
-LOCAL_CFLAGS+=-DALL_INCLUSIVE
-LOCAL_CFLAGS+=-DXTABLES_INTERNAL
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV6
-# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
-LOCAL_CFLAGS+=-D__ANDROID__
-LOCAL_CFLAGS += $(commonFlags)
-
-LOCAL_REQUIRED_MODULES := xtables.lock
-
-LOCAL_SRC_FILES:= \
- xtables-multi.c iptables-xml.c xshared.c \
- ip6tables-save.c ip6tables-restore.c \
- ip6tables-standalone.c ip6tables.c
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:=ip6tables
-
-LOCAL_STATIC_LIBRARIES := \
- libext \
- libext6 \
- libip6tc \
- libxtables
-
-LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_OUT)/bin; \
- ln -sf ip6tables $(TARGET_OUT)/bin/ip6tables-save; \
- ln -sf ip6tables $(TARGET_OUT)/bin/ip6tables-restore
-
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-
-include $(BUILD_EXECUTABLE)
-
-#----------------------------------------------------------------
diff --git a/iptables/NOTICE b/iptables/NOTICE
new file mode 120000
index 00000000..7e1b82f6
--- /dev/null
+++ b/iptables/NOTICE
@@ -0,0 +1 @@
+../NOTICE \ No newline at end of file
diff --git a/libiptc/Android.bp b/libiptc/Android.bp
new file mode 100644
index 00000000..9f95909b
--- /dev/null
+++ b/libiptc/Android.bp
@@ -0,0 +1,22 @@
+cc_defaults {
+ name: "libiptc_defaults",
+ defaults: ["iptables_defaults"],
+
+ cflags: ["-Wno-pointer-sign"],
+}
+
+cc_library_static {
+ name: "libip4tc",
+ defaults: ["libiptc_defaults"],
+
+ srcs: ["libip4tc.c"],
+}
+
+cc_library_static {
+ name: "libip6tc",
+ defaults: ["libiptc_defaults"],
+
+ cflags: ["-Wno-unused-function"],
+
+ srcs: ["libip6tc.c"],
+}
diff --git a/libiptc/Android.mk b/libiptc/Android.mk
deleted file mode 100644
index d034175e..00000000
--- a/libiptc/Android.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-#----------------------------------------------------------------
-# libip4tc
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/
-
-# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
-LOCAL_CFLAGS:=-D__ANDROID__
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
-LOCAL_CFLAGS += \
- -Wall -Werror \
- -Wno-pointer-arith \
- -Wno-pointer-sign \
- -Wno-sign-compare \
- -Wno-unused-parameter \
-
-LOCAL_SRC_FILES:= \
- libip4tc.c \
-
-
-LOCAL_LDFLAGS:=-version-info 1:0:1
-LOCAL_MODULE_TAGS:=
-LOCAL_MODULE:=libip4tc
-
-include $(BUILD_STATIC_LIBRARY)
-
-
-#----------------------------------------------------------------
-# libip6tc
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/
-
-# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
-LOCAL_CFLAGS:=-D__ANDROID__
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
-LOCAL_CFLAGS += \
- -Wall -Werror \
- -Wno-pointer-arith \
- -Wno-pointer-sign \
- -Wno-sign-compare \
- -Wno-unused-function \
- -Wno-unused-parameter \
-
-LOCAL_SRC_FILES:= \
- libip6tc.c \
-
-
-LOCAL_LDFLAGS:=-version-info 1:0:1
-LOCAL_MODULE_TAGS:=
-LOCAL_MODULE:=libip6tc
-
-include $(BUILD_STATIC_LIBRARY)
-
-#----------------------------------------------------------------
diff --git a/libxtables/Android.bp b/libxtables/Android.bp
new file mode 100644
index 00000000..41d61466
--- /dev/null
+++ b/libxtables/Android.bp
@@ -0,0 +1,26 @@
+//----------------------------------------------------------------
+// libxtables
+
+cc_library_static {
+ name: "libxtables",
+ defaults: ["iptables_defaults"],
+
+ header_libs: [
+ "iptables_iptables_headers",
+ "iptables_config_header",
+ ],
+ export_header_lib_headers: ["iptables_headers"],
+
+ cflags: [
+ "-DNO_SHARED_LIBS=1",
+ "-DXTABLES_INTERNAL",
+ "-DXTABLES_LIBDIR=\"xtables_libdir_not_used\"",
+
+ "-Wno-missing-field-initializers",
+ ],
+
+ srcs: [
+ "xtables.c",
+ "xtoptions.c",
+ ],
+}
diff --git a/libxtables/Android.mk b/libxtables/Android.mk
deleted file mode 100644
index 1fb44e8d..00000000
--- a/libxtables/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-#----------------------------------------------------------------
-# libxtables
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/ \
- $(LOCAL_PATH)/../iptables/ \
- $(LOCAL_PATH)/.. \
-
-LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
-LOCAL_CFLAGS+=-DXTABLES_INTERNAL
-LOCAL_CFLAGS+=-DXTABLES_LIBDIR=\"xtables_libdir_not_used\"
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
-LOCAL_CFLAGS += -Wno-sign-compare -Wno-pointer-arith -Wno-type-limits -Wno-missing-field-initializers -Wno-unused-parameter -Wno-clobbered -Wno-tautological-compare -Werror
-
-LOCAL_LDFLAGS:=-version-info 10:0:0
-LOCAL_SRC_FILES:= \
- xtables.c xtoptions.c
-
-LOCAL_MODULE:=libxtables
-
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include/ \
- $(LOCAL_PATH)/../iptables/ \
- $(LOCAL_PATH)/..
-
-LOCAL_CFLAGS:=-DSHARED_LIBS=1
-LOCAL_CFLAGS+=-DXTABLES_INTERNAL
-LOCAL_CFLAGS+=-DXTABLES_LIBDIR=\"xtables_libdir_not_used\"
-LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
-
-LOCAL_CFLAGS += -Wno-sign-compare -Wno-pointer-arith -Wno-type-limits -Wno-missing-field-initializers -Wno-unused-parameter -Wno-clobbered -Wno-tautological-compare -Werror
-
-LOCAL_SRC_FILES:= \
- xtables.c xtoptions.c
-
-LOCAL_MODULE:=libxtables
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/
-
-include $(BUILD_SHARED_LIBRARY)