Merge pull request #1115 from deltachat/fix-ring

adapt to ndk r20b
This commit is contained in:
cyBerta
2019-11-15 17:22:30 +01:00
committed by GitHub
6 changed files with 30 additions and 29 deletions
-2
View File
@@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="org.thoughtcrime.securesms">
<uses-sdk tools:overrideLibrary="com.amulyakhare.textdrawable,com.astuetz.pagerslidingtabstrip,pl.tajchert.waitingdots,com.h6ah4i.android.multiselectlistpreferencecompat,android.support.v13,com.davemorrissey.labs.subscaleview,com.tomergoldst.tooltips,com.klinker.android.send_message,com.takisoft.colorpicker,android.support.v14.preference"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="android.hardware.location" android:required="false"/>
+1 -1
View File
@@ -95,7 +95,7 @@ android {
applicationId "com.b44t.messenger"
multiDexEnabled true
minSdkVersion 14
minSdkVersion 18
targetSdkVersion 28
vectorDrawables.useSupportLibrary = true
+2 -4
View File
@@ -20,13 +20,11 @@ include $(CLEAR_VARS)
LOCAL_MODULE := native-utils
LOCAL_C_INCLUDES := $(JNI_DIR)/utils/
LOCAL_LDLIBS := -ljnigraphics -llog -lz -latomic
LOCAL_LDLIBS := -ljnigraphics -llog -lz
LOCAL_STATIC_LIBRARIES := deltachat-core
# if you get "undefined reference" errors, the reason for this may be the _order_! Eg. libiconv as the first library does not work!
# "breakpad" was placed after "crypto", NativeLoader.cpp after dc_wrapper.c
LOCAL_CFLAGS := -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno -std=c99
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
LOCAL_SRC_FILES := \
+2 -3
View File
@@ -1,5 +1,4 @@
APP_PLATFORM := android-14
APP_PLATFORM := android-18
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
NDK_TOOLCHAIN_VERSION := 4.9
APP_STL := gnustl_static
APP_STL := c++_static
+2 -2
View File
@@ -59,7 +59,7 @@ static char* char_ref__(JNIEnv* env, jstring a) {
return NULL;
}
char* cstr = strndup(pBytes, length);
char* cstr = strndup((const char*)pBytes, length);
(*env)->ReleaseByteArrayElements(env, stringJbytes, pBytes, JNI_ABORT);
(*env)->DeleteLocalRef(env, stringJbytes);
@@ -92,7 +92,7 @@ static jstring jstring_new__(JNIEnv* env, const char* a)
int a_bytes = strlen(a);
jbyteArray array = (*env)->NewByteArray(env, a_bytes);
(*env)->SetByteArrayRegion(env, array, 0, a_bytes, a);
(*env)->SetByteArrayRegion(env, array, 0, a_bytes, (const jbyte*)a);
jstring ret = (jstring) (*env)->NewObject(env, s_strCls, s_strCtor, array, s_strEncode);
(*env)->DeleteLocalRef(env, array); /* we have to delete the reference as it is not returned to Java, AFAIK */
+23 -17
View File
@@ -1,38 +1,44 @@
#!/bin/sh
set -e
echo "starting time: `date`"
cd jni/deltachat-core-rust
# to setup the toolchains (from https://medium.com/visly/rust-on-android-19f34a2fb43 )
# run the following in `jni/deltachat-core-rust`:
# $ rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
#
# then:
# $ mkdir ~/.NDK
# $ $ANDROID_NDK/build/tools/make_standalone_toolchain.py --api 14 --arch arm --install-dir ~/.NDK/arm
# $ $ANDROID_NDK/build/tools/make_standalone_toolchain.py --api 21 --arch arm64 --install-dir ~/.NDK/arm64
# $ $ANDROID_NDK/build/tools/make_standalone_toolchain.py --api 14 --arch x86 --install-dir ~/.NDK/x86
# $ $ANDROID_NDK/build/tools/make_standalone_toolchain.py --api 21 --arch x86_64 --install-dir ~/.NDK/x86_64
# (--api should be aligned with APP_PLATFORM from Application.mk and with minSdkVersion)
# this installs toolchains in `~/.NDK`
# after that, add PATH_TO_NDK/toolchains/llvm/prebuilt/HOST/bin to your $PATH
# and add the correct clang-linkers to `~/.cargo/config`:
# ```
# [target.armv7-linux-androideabi]
# linker = "PATH_TO_NDK/toolchains/llvm/prebuilt/HOST/bin/armv7a-linux-androideabi18-clang"
# [target.aarch64-linux-android]
# linker = "PATH_TO_NDK/toolchains/llvm/prebuilt/HOST/bin/aarch64-linux-android21-clang"
# [target.i686-linux-android]
# linker = "PATH_TO_NDK/toolchains/llvm/prebuilt/HOST/bin/i686-linux-android18-clang"
# [target.x86_64-linux-android]
# linker = "PATH_TO_NDK/toolchains/llvm/prebuilt/HOST/bin/x86_64-linux-android21-clang"
# ```
# then, the following should work:
echo "-- cross compiling to armv7-linux-androideabi (arm) --"
export RUSTFLAGS="-C linker=$HOME/.NDK/arm/bin/clang";
export PATH=~/.NDK/arm/bin:$PATH;
export CFLAGS=-D__ANDROID_API__=18
TARGET_CC=armv7a-linux-androideabi18-clang \
cargo build --release --target armv7-linux-androideabi -p deltachat_ffi
echo "-- cross compiling to aarch64-linux-android (arm64) --"
export RUSTFLAGS="-C linker=$HOME/.NDK/arm64/bin/clang";
export PATH=~/.NDK/arm64/bin:$PATH;
export CFLAGS=-D__ANDROID_API__=21
TARGET_CC=aarch64-linux-android21-clang \
cargo build --release --target aarch64-linux-android -p deltachat_ffi
echo "-- cross compiling to i686-linux-android (x86) --"
export RUSTFLAGS="-C linker=$HOME/.NDK/x86/bin/clang";
export PATH=~/.NDK/x86/bin:$PATH;
export CFLAGS=-D__ANDROID_API__=18
TARGET_CC=i686-linux-android18-clang \
cargo build --release --target i686-linux-android -p deltachat_ffi
echo "-- cross compiling to x86_64-linux-android (x86_64) --"
export RUSTFLAGS="-C linker=$HOME/.NDK/x86_64/bin/clang";
export PATH=~/.NDK/x86_64/bin:$PATH;
export CFLAGS=-D__ANDROID_API__=21
TARGET_CC=x86_64-linux-android21-clang \
cargo build --release --target x86_64-linux-android -p deltachat_ffi
echo -- copy generated .a files --