From 59e0aed4cc4075c43fa7238c70ecbc8135de03ac Mon Sep 17 00:00:00 2001 From: Barracuda72 Date: Thu, 13 Feb 2020 22:47:57 +0500 Subject: [PATCH 1/3] Enable x86 build --- native/build.sh | 30 ++++++++++++++---------------- templates/app-build.gradle | 4 ++-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/native/build.sh b/native/build.sh index be36040..eb7ec2d 100755 --- a/native/build.sh +++ b/native/build.sh @@ -121,21 +121,18 @@ build_arm64 () { # ARM64 uses OPENSSL_ARCH="linux-generic64 -DB_ENDIAN" -# x86 FFMPEG doesn't work on modern android, and neither side wants to -# do the work to fix it. So we'll drop support. - -# build_x86 () { -# -# export ANDROID_PLATFORM=android-15 -# export PLATFORM=x86 -# export NDK_ARCH=x86 -# export FFMPEG_ARCH=x86 -# export GCC_ARCH=i686-linux-android -# export OPENSSL_ARCH="android-x86" -# export PICFLAG="-fPIC" -# -# build_platform -# } +build_x86 () { + + export ANDROID_PLATFORM=android-21 + export PLATFORM=x86 + export NDK_ARCH=x86 + export FFMPEG_ARCH=x86 + export GCC_ARCH=i686-linux-android + export OPENSSL_ARCH="linux-generic32" + export PICFLAG="-fPIC" + + build_platform +} build_x86_64 () { @@ -158,10 +155,11 @@ build_ () { build_arm64 build_arm + build_x86 build_x86_64 export ANDROID_PLATFORM=android-21 - export ALL_PLATFORMS="armeabi-v7a x86_64 arm64-v8a" + export ALL_PLATFORMS="armeabi-v7a x86_64 x86 arm64-v8a" run jni all run finish dist diff --git a/templates/app-build.gradle b/templates/app-build.gradle index e0307ef..4970e55 100644 --- a/templates/app-build.gradle +++ b/templates/app-build.gradle @@ -23,7 +23,7 @@ android { enable true; reset(); - include "x86_64", "armeabi-v7a", "arm64-v8a" + include "x86", "x86_64", "armeabi-v7a", "arm64-v8a" universalApk true } } @@ -44,7 +44,7 @@ android { } } - project.ext.versionCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1, 'x86_64': 8] + project.ext.versionCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1, 'x86': 4, 'x86_64': 8] android.applicationVariants.all { variant -> // assign different version code for each output From bf8d2e1b22a38bbf6143f059d5cd6d56dd97801d Mon Sep 17 00:00:00 2001 From: Barracuda72 Date: Thu, 13 Feb 2020 22:48:14 +0500 Subject: [PATCH 2/3] Fix FFmpeg build on x86 --- native/scripts/ffmpeg.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/native/scripts/ffmpeg.sh b/native/scripts/ffmpeg.sh index 8eef223..545cb00 100644 --- a/native/scripts/ffmpeg.sh +++ b/native/scripts/ffmpeg.sh @@ -21,6 +21,7 @@ build () { --extra-ldflags="$LDFLAGS" \ --extra-ldexeflags=-pie \ --enable-cross-compile \ + --disable-asm \ --disable-shared \ --enable-pic \ --enable-static \ From 48d7ca85f2e3ccba510839871d6d4cc3aca22145 Mon Sep 17 00:00:00 2001 From: Barracuda72 Date: Thu, 13 Feb 2020 23:14:34 +0500 Subject: [PATCH 3/3] Make '--disable-asm' conditional on x86 FFMPEG_ARCH --- native/scripts/ffmpeg.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/native/scripts/ffmpeg.sh b/native/scripts/ffmpeg.sh index 545cb00..551980c 100644 --- a/native/scripts/ffmpeg.sh +++ b/native/scripts/ffmpeg.sh @@ -12,6 +12,13 @@ build () { pushd "ffmpeg-$version" + if [ "$FFMPEG_ARCH" = "x86" ]; then + FFMPEG_FLAGS="--disable-asm"; + else + FFMPEG_FLAGS=""; + fi; + + ./configure --prefix="$INSTALLDIR" \ --cc="$CC" \ --ld="$CC" \ @@ -21,7 +28,7 @@ build () { --extra-ldflags="$LDFLAGS" \ --extra-ldexeflags=-pie \ --enable-cross-compile \ - --disable-asm \ + $FFMPEG_FLAGS \ --disable-shared \ --enable-pic \ --enable-static \