1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-25 06:26:05 +03:00

Add support for Android L

Build position-indepent executables, required for Android L (5.0+)
They also work with kitkat.

Add new maketarget "cross-android-old" that builds without PIE
for older versions.

Include both new and old versions in latest-android.zip. Add arm64.

Hopefully solves github PR #14.
This commit is contained in:
Erik Ekman 2015-08-05 19:33:50 +02:00
parent d8bf5cc85b
commit c269a00344
6 changed files with 46 additions and 11 deletions

View File

@ -56,15 +56,32 @@ iodine-latest:
@for i in README.md CHANGELOG TODO; do cp $$i iodine-latest/$$i.txt; done
@unix2dos iodine-latest/*
#non-PIE build for old android
cross-android-old:
@(cd src; $(MAKE) base64u.c base64u.h)
@(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk MY_PLATFORM=old)
#Position-indepedent build for modern android
cross-android:
@(cd src; $(MAKE) base64u.c base64u.h)
@(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk)
@(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk MY_PLATFORM=kitkat)
iodine-latest-android.zip: iodine-latest
@mv iodine-latest iodine-latest-android
@mkdir -p iodine-latest-android/armeabi iodine-latest-android/x86
@mkdir -p iodine-latest-android/pre-kitkat/armeabi
@mkdir -p iodine-latest-android/pre-kitkat/x86
@$(MAKE) cross-android-old TARGET_ARCH_ABI=armeabi
@cp src/libs/armeabi/* iodine-latest-android/pre-kitkat/armeabi
@$(MAKE) cross-android-old TARGET_ARCH_ABI=x86
@cp src/libs/x86/* iodine-latest-android/pre-kitkat/x86
@rm -rf src/libs src/obj
@mkdir -p iodine-latest-android/armeabi
@mkdir -p iodine-latest-android/arm64-v8a
@mkdir -p iodine-latest-android/x86
@$(MAKE) cross-android TARGET_ARCH_ABI=armeabi
@cp src/libs/armeabi/* iodine-latest-android/armeabi
@$(MAKE) cross-android TARGET_ARCH_ABI=arm64-v8a
@cp src/libs/arm64-v8a/* iodine-latest-android/arm64-v8a
@$(MAKE) cross-android TARGET_ARCH_ABI=x86
@cp src/libs/x86/* iodine-latest-android/x86
@cp README-android.txt iodine-latest-android

View File

@ -37,9 +37,13 @@ For more information: http://blog.bokhorst.biz/5123
3. Build:
cd src
make base64u.h base64u.c
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk MY_PLATFORM=kitkat
or run "make cross-android" in the iodine root directory.
To build for other archs, specify TARGET_ARCH_ABI:
"make cross-android TARGET_ARCH_ABI=x86"
For older android versions (pre-kitkat), build with "make cross-android" in the
root directory, or manually like above but without the MY_PLATFORM part.
The iodine binary ends up in src/libs/<arch>/iodine

View File

@ -20,5 +20,14 @@ LOCAL_SRC_FILES := tun.c dns.c read.c encoding.c login.c base32.c base64.c base6
LOCAL_CFLAGS := -c -DANDROID -DLINUX -DIFCONFIGPATH=\"/system/bin/\" -Wall -DGITREVISION=\"$(HEAD_COMMIT)\"
LOCAL_LDLIBS := -lz
#Choose platform level (for PIE support)
ifeq (kitkat, $(strip $(MY_PLATFORM)))
APP_PLATFORM := android-16
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
else
APP_PLATFORM := android-3
endif
include $(BUILD_EXECUTABLE)

View File

@ -17,6 +17,9 @@
#ifndef __FIX_ANDROID_H__
#define __FIX_ANDROID_H__
/* Newer android platforms can have this data already */
#ifndef C_IN
typedef struct {
unsigned id :16;
unsigned rd :1;
@ -51,4 +54,6 @@ typedef struct {
#define T_TXT 16
#define T_SRV 33
#endif /* !C_IN */
#endif

View File

@ -32,10 +32,10 @@
#ifdef WINDOWS32
#include "windows.h"
#else
#include <arpa/nameser.h>
#ifdef ANDROID
#include "android_dns.h"
#endif
#include <arpa/nameser.h>
#ifdef DARWIN
#define BIND_8_COMPAT
#include <arpa/nameser_compat.h>

View File

@ -27,9 +27,6 @@
#ifdef WINDOWS32
#include "windows.h"
#else
#ifdef ANDROID
#include "android_dns.h"
#endif
#include <arpa/nameser.h>
#ifdef DARWIN
#define BIND_8_COMPAT
@ -38,6 +35,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <err.h>
#ifdef ANDROID
#include "android_dns.h"
#endif
#endif