summaryrefslogtreecommitdiff
path: root/Android.mk
diff options
context:
space:
mode:
authorGilad Arnold <garnold@google.com>2015-08-05 15:26:02 -0700
committerGilad Arnold <garnold@google.com>2015-08-13 13:13:56 -0700
commit7db56bd4c91a516637995b9bf75241cb0c323bf9 (patch)
treed68435428a04e8f433367eef7e0c1e70b1df3048 /Android.mk
parentb4f3e0edd0e8c502d137bf7aa3ebfabf0be46183 (diff)
downloadfirewalld-7db56bd4c91a516637995b9bf75241cb0c323bf9.tar.gz
Build firewalld in Android.
* Drop firewalld/ prefix from #include paths. * Rename the DBus interface definition to have a .dbus.xml suffix; needed for it to be picked up by the build infrastructure. * Add __BRILLO__ preprocessor symbol for conditionally: 1) Removing support for Permission Broker (currently not available and no concrete porting plan yet). 2) Disable dropping privileges in minijail invocations (yet to be figured out). 3) Adapting DBus bindings header paths (slightly different). 4) Adapting helper utility paths (iptables, iproute2). 5) Making punching of IPv6 firewall rules optional and autodetected. * Re-license everything to AOSP and add NOTICE and MODULE_LICENSE_APACHE2. * Added Android.mk for building all the targets we need, including init.firewalld.rc with proper SELinux attributes (when supported). Bug: 22827985 Change-Id: I05f74f80f95f689b4bbf60a2708e76ef5495b96e
Diffstat (limited to 'Android.mk')
-rw-r--r--Android.mk82
1 files changed, 82 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..03b9e3a
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# Definitions applying to all targets. Be sure to $(eval) this last.
+define firewalld_common
+ LOCAL_CPP_EXTENSION := .cc
+ LOCAL_RTTI_FLAG := -frtti
+ LOCAL_CLANG := true
+ LOCAL_SRC_FILES += \
+ dbus_bindings/dbus-service-config.json \
+ dbus_bindings/org.chromium.Firewalld.dbus.xml
+ LOCAL_SHARED_LIBRARIES += \
+ libchrome \
+ libchrome-dbus \
+ libchromeos \
+ libchromeos-dbus \
+ libchromeos-minijail \
+ libdbus \
+ libminijail
+ LOCAL_CFLAGS += -D__BRILLO__ -Wall -Werror -Wno-unused-parameter
+ LOCAL_CPPFLAGS += -Wno-sign-promo
+endef
+
+# === libfirewalld (static library) ===
+include $(CLEAR_VARS)
+LOCAL_MODULE := libfirewalld
+LOCAL_SRC_FILES := \
+ firewall_daemon.cc \
+ firewall_service.cc \
+ iptables.cc
+$(eval $(firewalld_common))
+include $(BUILD_STATIC_TEST_LIBRARY)
+
+# === firewalld ===
+include $(CLEAR_VARS)
+LOCAL_MODULE := firewalld
+LOCAL_REQUIRED_MODULES := init.firewalld.rc
+LOCAL_SRC_FILES := \
+ main.cc
+LOCAL_STATIC_LIBRARIES := libfirewalld
+LOCAL_C_INCLUDES += external/gtest/include
+$(eval $(firewalld_common))
+include $(BUILD_EXECUTABLE)
+
+# === init.firewalld.rc ===
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.firewalld.rc
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_INITRCD)
+
+ifdef INITRC_TEMPLATE
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE): $(INITRC_TEMPLATE)
+ $(call generate-initrc-file,firewalld,,net_admin net_raw)
+endif
+
+# === unittest ===
+include $(CLEAR_VARS)
+LOCAL_MODULE := firewalld_unittest
+LOCAL_SRC_FILES := \
+ iptables_unittest.cc \
+ mock_iptables.cc \
+ run_all_tests.cc
+LOCAL_STATIC_LIBRARIES := libfirewalld libgmock
+$(eval $(firewalld_common))
+include $(BUILD_NATIVE_TEST)