From ad23ccb2191c8478da2ade1f565d32c6b70f9e39 Mon Sep 17 00:00:00 2001 From: unlnown542a Date: Thu, 26 Apr 2018 22:28:30 +0300 Subject: [PATCH 1/5] separating android binary build --- {android/i2pd => android_binary/jni}/Android.mk | 2 +- {android/i2pd => android_binary/jni}/Application.mk | 2 +- daemon/Daemon.h | 2 +- daemon/HTTPServer.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) rename {android/i2pd => android_binary/jni}/Android.mk (98%) rename {android/i2pd => android_binary/jni}/Application.mk (95%) diff --git a/android/i2pd/Android.mk b/android_binary/jni/Android.mk similarity index 98% rename from android/i2pd/Android.mk rename to android_binary/jni/Android.mk index ae56110c..1c7cd92e 100755 --- a/android/i2pd/Android.mk +++ b/android_binary/jni/Android.mk @@ -13,7 +13,7 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_LDLIBS := -lz LOCAL_SRC_FILES := $(IFADDRS_PATH)/ifaddrs.c \ - $(wildcard $(LIB_SRC_PATH)/*.cpp)\ + $(wildcard $(LIB_SRC_PATH)/*.cpp)\ $(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp)\ $(DAEMON_SRC_PATH)/UnixDaemon.cpp \ $(DAEMON_SRC_PATH)/Daemon.cpp \ diff --git a/android/i2pd/Application.mk b/android_binary/jni/Application.mk similarity index 95% rename from android/i2pd/Application.mk rename to android_binary/jni/Application.mk index acc6f895..c2112d54 100755 --- a/android/i2pd/Application.mk +++ b/android_binary/jni/Application.mk @@ -15,7 +15,7 @@ APP_STL := gnustl_static # Enable c++11 extensions in source code APP_CPPFLAGS += -std=c++11 -fvisibility=default -fPIE -APP_CPPFLAGS += -DANDROID -D__ANDROID__ -DUSE_UPNP +APP_CPPFLAGS += -DANDROID_BINARY -DANDROID -D__ANDROID__ -DUSE_UPNP APP_LDFLAGS += -rdynamic -fPIE -pie ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) APP_CPPFLAGS += -DANDROID_ARM7A diff --git a/daemon/Daemon.h b/daemon/Daemon.h index 4491d303..00baf7b9 100644 --- a/daemon/Daemon.h +++ b/daemon/Daemon.h @@ -64,7 +64,7 @@ namespace util DaemonWin32 ():isGraceful(false) {} }; -#elif defined(ANDROID) +#elif (defined(ANDROID) && !defined(ANDROID_BINARY)) #define Daemon i2p::util::DaemonAndroid::Instance() // dummy, invoked from android/jni/DaemonAndroid.* class DaemonAndroid: public i2p::util::Daemon_Singleton diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 657e6d43..faf386d8 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -227,7 +227,7 @@ namespace http { default: s << "Unknown"; } s << "
\r\n"; -#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) +#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY)) if (auto remains = Daemon.gracefulShutdownInterval) { s << "Stopping in: "; s << remains << " seconds"; @@ -504,7 +504,7 @@ namespace http { s << " Decline transit tunnels
\r\n"; else s << " Accept transit tunnels
\r\n"; -#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) +#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY)) if (Daemon.gracefulShutdownInterval) s << " Cancel graceful shutdown
"; else @@ -964,14 +964,14 @@ namespace http { i2p::context.SetAcceptsTunnels (false); else if (cmd == HTTP_COMMAND_SHUTDOWN_START) { i2p::context.SetAcceptsTunnels (false); -#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) +#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY)) Daemon.gracefulShutdownInterval = 10*60; #elif defined(WIN32_APP) i2p::win32::GracefulShutdown (); #endif } else if (cmd == HTTP_COMMAND_SHUTDOWN_CANCEL) { i2p::context.SetAcceptsTunnels (true); -#if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) +#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY)) Daemon.gracefulShutdownInterval = 0; #elif defined(WIN32_APP) i2p::win32::StopGracefulShutdown (); From c7b796ff313d007f6bfd1e0ab4830234b4d8cbd6 Mon Sep 17 00:00:00 2001 From: unlnown542a Date: Thu, 26 Apr 2018 22:40:13 +0300 Subject: [PATCH 2/5] separate Android binary build based on DaemonLinux --- {android_binary => android_binary_only}/jni/Android.mk | 0 {android_binary => android_binary_only}/jni/Application.mk | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {android_binary => android_binary_only}/jni/Android.mk (100%) rename {android_binary => android_binary_only}/jni/Application.mk (100%) diff --git a/android_binary/jni/Android.mk b/android_binary_only/jni/Android.mk similarity index 100% rename from android_binary/jni/Android.mk rename to android_binary_only/jni/Android.mk diff --git a/android_binary/jni/Application.mk b/android_binary_only/jni/Application.mk similarity index 100% rename from android_binary/jni/Application.mk rename to android_binary_only/jni/Application.mk From 08a8ab98926797a2b9d9e3af6d8ead289227b25c Mon Sep 17 00:00:00 2001 From: unlnown542a Date: Thu, 26 Apr 2018 22:42:12 +0300 Subject: [PATCH 3/5] format --- android_binary_only/jni/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android_binary_only/jni/Android.mk b/android_binary_only/jni/Android.mk index 1c7cd92e..ae56110c 100755 --- a/android_binary_only/jni/Android.mk +++ b/android_binary_only/jni/Android.mk @@ -13,7 +13,7 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_LDLIBS := -lz LOCAL_SRC_FILES := $(IFADDRS_PATH)/ifaddrs.c \ - $(wildcard $(LIB_SRC_PATH)/*.cpp)\ + $(wildcard $(LIB_SRC_PATH)/*.cpp)\ $(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp)\ $(DAEMON_SRC_PATH)/UnixDaemon.cpp \ $(DAEMON_SRC_PATH)/Daemon.cpp \ From 6e95318cba0ce810ce7e7a1c2e72b4882afbfff3 Mon Sep 17 00:00:00 2001 From: unlnown542a Date: Thu, 26 Apr 2018 22:44:32 +0300 Subject: [PATCH 4/5] I2PD_LIBS_PATH = /path/to/libraries to be same as in android normal build --- android_binary_only/jni/Application.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android_binary_only/jni/Application.mk b/android_binary_only/jni/Application.mk index c2112d54..7cd5c813 100755 --- a/android_binary_only/jni/Application.mk +++ b/android_binary_only/jni/Application.mk @@ -28,7 +28,7 @@ APP_OPTIM := debug # git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git # git clone https://github.com/PurpleI2P/android-ifaddrs.git # change to your own -I2PD_LIBS_PATH = /home/u/build/i2p/daemon/static.libs +I2PD_LIBS_PATH = /path/to/libraries BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt From db8a546b8fa2d23accbdf41de3ddc69e66df10d7 Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 26 Apr 2018 20:07:51 +0000 Subject: [PATCH 5/5] android i2pd executable build instructions --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8fc8393a..9b7e42d4 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,12 @@ Build instructions: * [windows](https://i2pd.readthedocs.io/en/latest/devs/building/windows/) * [iOS](https://i2pd.readthedocs.io/en/latest/devs/building/ios/) * [android](https://i2pd.readthedocs.io/en/latest/devs/building/android/) +* android executable binary build: + - clone https://github.com/unlnown542a/i2pd.git or download https://github.com/unlnown542a/i2pd/archive/openssl.zip + - change to i2pd/android_binary_only + - edit jni/Application.mk - define path to static libs I2PD_LIBS_PATH + - in the directory i2pd/android_binary_only run: ndk-build -j4 + - find compiled binary - libs/armeabi-v7a/i2pd **Supported systems:**