[Replicant] [PATCH] Android: also build as a shared libarry

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Sun Aug 4 21:42:03 UTC 2019


On Android, libsamsung-ipc is dynamically linked
to libcrypto.

However libsamsung-ril uses libsamsung-ipc
as a static library.

Without that fix, on Android 9, linking libsamsung-ril
to libsamsung-ipc fails with the following errors:
  rfs.c:50: error: undefined reference to 'MD5_Init'
  rfs.c:51: error: undefined reference to 'MD5_Update'
  rfs.c:52: error: undefined reference to 'MD5_Update'
  rfs.c:53: error: undefined reference to 'MD5_Final'

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 Android.mk | 59 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 12 deletions(-)

diff --git a/Android.mk b/Android.mk
index aaa3c02..cca4bb7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,8 +17,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-include $(CLEAR_VARS)
-
 ifneq (,$(filter crespo,$(TARGET_DEVICE)))
 	ipc_device_name := crespo
 endif
@@ -51,7 +49,7 @@ ifneq (,$(filter n5100,$(TARGET_DEVICE)))
 	ipc_device_name := n5100
 endif
 
-LOCAL_SRC_FILES := \
+libsamsung_ipc_local_src_files := \
 	samsung-ipc/ipc.c \
 	samsung-ipc/ipc_devices.c \
 	samsung-ipc/ipc_utils.c \
@@ -79,26 +77,63 @@ LOCAL_SRC_FILES := \
 	samsung-ipc/rfs.c \
 	samsung-ipc/gen.c
 
-LOCAL_C_INCLUDES := \
+libsamsung_ipc_local_c_includes := \
 	$(LOCAL_PATH)/include \
 	$(LOCAL_PATH)/samsung-ipc \
 	$(LOCAL_PATH)/samsung-ipc/devices/xmm616/ \
 	$(LOCAL_PATH)/samsung-ipc/devices/xmm626/ \
 	external/openssl/include
 
-LOCAL_CFLAGS := \
+libsamsung_local_cflags := \
 	-DIPC_DEVICE_NAME=\"$(ipc_device_name)\" \
 	-DDEBUG
 
-LOCAL_SHARED_LIBRARIES := libutils libcrypto
+libsamsung_ipc_local_shared_libraries := \
+	libutils \
+	libcrypto
+
+############################################
+# Static library version of libsamsung-ipc #
+############################################
+include $(CLEAR_VARS)
 
 LOCAL_MODULE := libsamsung-ipc
 LOCAL_MODULE_TAGS := optional
 
+LOCAL_SRC_FILES := $(libsamsung_ipc_local_src_files)
+
+LOCAL_C_INCLUDES := $(libsamsung_ipc_local_c_includes)
+
+LOCAL_CFLAGS := $(libsamsung_local_cflags)
+LOCAL_SHARED_LIBRARIES := $(libsamsung_ipc_local_shared_libraries)
+
 include $(BUILD_STATIC_LIBRARY)
 
+############################################
+# Shared library version of libsamsung-ipc #
+############################################
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libsamsung-ipc
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(libsamsung_ipc_local_src_files)
+
+LOCAL_C_INCLUDES := $(libsamsung_ipc_local_c_includes)
+
+LOCAL_CFLAGS := $(libsamsung_local_cflags)
+LOCAL_SHARED_LIBRARIES := $(libsamsung_ipc_local_shared_libraries)
+
+include $(BUILD_SHARED_LIBRARY)
+
+##################
+# ipc-modem tool #
+##################
 include $(CLEAR_VARS)
 
+LOCAL_MODULE := ipc-modem
+LOCAL_MODULE_TAGS := optional
+
 LOCAL_SRC_FILES := tools/ipc-modem.c
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
@@ -106,13 +141,16 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
 LOCAL_STATIC_LIBRARIES := libsamsung-ipc
 LOCAL_SHARED_LIBRARIES := libutils
 
-LOCAL_MODULE := ipc-modem
-LOCAL_MODULE_TAGS := optional
-
 include $(BUILD_EXECUTABLE)
 
+#################
+# ipc-test tool #
+#################
 include $(CLEAR_VARS)
 
+LOCAL_MODULE := ipc-test
+LOCAL_MODULE_TAGS := optional
+
 LOCAL_SRC_FILES := tools/ipc-test.c
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
@@ -120,7 +158,4 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
 LOCAL_STATIC_LIBRARIES := libsamsung-ipc
 LOCAL_SHARED_LIBRARIES := libutils
 
-LOCAL_MODULE := ipc-test
-LOCAL_MODULE_TAGS := optional
-
 include $(BUILD_EXECUTABLE)
-- 
2.22.0



More information about the Replicant mailing list