summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Protsenko <semen.protsenko@linaro.org>2017-01-16 22:22:14 +0200
committerSam Protsenko <semen.protsenko@linaro.org>2018-07-04 17:34:31 +0300
commit7f24faccd0ae91f68483cb82c91d4242d8fddd6d (patch)
tree0f4b67e17b9a5dc2edac853b8ed753c01493a85f
parentda34949ce33819fa336f311f0fc1c1509925a40a (diff)
downloadppp-7f24faccd0ae91f68483cb82c91d4242d8fddd6d.tar.gz
pppd: Add rules for building the pppol2tp-android plugin
Build plugin as shared library. It uses some symbols from pppd, so let's allow building the plugin with undefined symbols, as they will be resolved at runtime, when plugin is loaded (on dlopen() call). Plugin will be installed to next path: - on 32-bit systems: /system/lib/ - on 64-bit systems: /system/lib64/ - on Multilib build: to both paths above We install it in /system/$LIB/ rather than /system/$LIB/pppd/$VERSION/, because we previously modified pppd to look in /system/$LIB for plugins, as it is the only allowed path for dlopen(). While at it, extract flags that common for pppd and plugins to separate variable, to avoid code duplication. Also, add pppol2tp-android as pppd dependency, so it will be built and installed along with pppd. Let's use LOCAL_REQUIRED_MODULE instead of LOCAL_SHARED_LIBRARIES, because latter would lead to linking pppd binary against pppol2tp-android.so, which we don't want, as pppol2tp-android.so is just a plugin and should be loaded via dlopen() only when it's needed. -Wno-pointer-sign is added to avoid next error shown by presubmit (Treehugger Robot), because 32-bit ABI is broken: error: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign] -Wno-unused-variable flag is removed, because pppd builds cleanly now. [1] https://lwn.net/Articles/507794/ Change-Id: I4b51a0f2bf99550c0fe126b6e56e08127dde812b Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
-rw-r--r--pppd/Android.mk24
1 files changed, 20 insertions, 4 deletions
diff --git a/pppd/Android.mk b/pppd/Android.mk
index ba06198..7cb13b0 100644
--- a/pppd/Android.mk
+++ b/pppd/Android.mk
@@ -1,3 +1,8 @@
+# Flags common to both pppd and plugins
+COMMON_CFLAGS := -DCHAPMS=1 -DMPPE=1 -DINET6=1 -DUSE_OPENSSL=1 \
+ -Wno-missing-field-initializers -Wno-unused-parameter -Werror \
+ -Wno-pointer-sign
+
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -36,15 +41,26 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include
-LOCAL_CFLAGS := -DCHAPMS=1 -DMPPE=1 -DINET6=1 -DUSE_OPENSSL=1 -Wno-unused-parameter -Wno-empty-body -Wno-missing-field-initializers -Wno-attributes -Wno-sign-compare -Wno-pointer-sign -Werror
-
-# Turn off warnings for now until this is fixed upstream. b/18632512
-LOCAL_CFLAGS += -Wno-unused-variable
+LOCAL_CFLAGS := $(COMMON_CFLAGS)
+LOCAL_CFLAGS += -Wno-empty-body -Wno-attributes -Wno-sign-compare
# Enable plugin support
LOCAL_CFLAGS += -DPLUGIN
LOCAL_LDFLAGS := -ldl -rdynamic
LOCAL_MODULE:= pppd
+LOCAL_REQUIRED_MODULES := pppol2tp-android
include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := pppol2tp-android
+LOCAL_SRC_FILES := plugins/pppol2tp-android/pppol2tp-android.c
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/include \
+ $(LOCAL_PATH)/plugins/pppol2tp-android
+LOCAL_CFLAGS := $(COMMON_CFLAGS)
+LOCAL_CFLAGS += -Wno-gnu-designator -Wno-format
+LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
+include $(BUILD_SHARED_LIBRARY)