forked from nodejs/node-chakracore
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport Android API 19 support #291
Open
Informatic
wants to merge
5
commits into
JaneaSystems:mobile-master
Choose a base branch
from
Informatic:v0.3.2-support-api19
base: mobile-master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Backport Android API 19 support #291
Informatic
wants to merge
5
commits into
JaneaSystems:mobile-master
from
Informatic:v0.3.2-support-api19
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
observation:
suggestion for update to "android_build.sh" #!/bin/bash
set -e
ROOT=${PWD}
if [ $# -eq 0 ]
then
echo "Requires a path to the Android NDK"
echo "Usage: android_build.sh <path_to_ndk> [target_arch] [target_api]"
exit
fi
SCRIPT_DIR="$(dirname "$BASH_SOURCE")"
cd "$SCRIPT_DIR"
SCRIPT_DIR=${PWD}
cd "$ROOT"
cd "$1"
ANDROID_NDK_PATH=${PWD}
cd "$SCRIPT_DIR"
cd ../
BUILD_ARCH() {
TARGET_ARCH="$1"
TARGET_API="$2"
make clean
# Clean previous toolchain.
rm -rf android-toolchain/
source ./android-configure "$ANDROID_NDK_PATH" "$TARGET_ARCH" "$TARGET_API"
make -j $(getconf _NPROCESSORS_ONLN)
TARGET_ARCH_FOLDER="$TARGET_ARCH"
if [ "$TARGET_ARCH_FOLDER" == "arm" ]; then
# Use the Android NDK ABI name.
TARGET_ARCH_FOLDER="armeabi-v7a"
elif [ "$TARGET_ARCH_FOLDER" == "arm64" ]; then
# Use the Android NDK ABI name.
TARGET_ARCH_FOLDER="arm64-v8a"
fi
mkdir -p "out_android/$TARGET_ARCH_FOLDER/"
cp "out/Release/lib.target/libnode.so" "out_android/$TARGET_ARCH_FOLDER/libnode.so"
}
# Usage: android_build.sh <path_to_ndk> [target_arch] [target_api]
# https://developer.android.com/ndk/guides/standalone_toolchain
# The minimum API level supported by NDK toolchains is currently 16 for 32-bit architectures, and 21 for 64-bit architectures.
MIN_TARGET_API_32bit='19'
MIN_TARGET_API_64bit='21'
if [ $# -eq 3 ]; then
BUILD_ARCH "$2" "$3"
elif [ $# -eq 2 ]; then
PARAM="$2"
if [ ! -z "${PARAM##*[!0-9]*}" ]; then
# 2nd param is API (integer)
if [ "$PARAM" -ge "$MIN_TARGET_API_32bit" ]; then
BUILD_ARCH "arm" "$PARAM"
BUILD_ARCH "x86" "$PARAM"
else
BUILD_ARCH "arm" "$MIN_TARGET_API_32bit"
BUILD_ARCH "x86" "$MIN_TARGET_API_32bit"
fi
if [ "$PARAM" -ge "$MIN_TARGET_API_64bit" ]; then
BUILD_ARCH "arm64" "$PARAM"
BUILD_ARCH "x86_64" "$PARAM"
else
BUILD_ARCH "arm64" "$MIN_TARGET_API_64bit"
BUILD_ARCH "x86_64" "$MIN_TARGET_API_64bit"
fi
else
# 2nd param is ARCH
if [ "arm" == "$PARAM" -o "x86" == "$PARAM" ]; then
BUILD_ARCH "$PARAM" "$MIN_TARGET_API_32bit"
else
BUILD_ARCH "$PARAM" "$MIN_TARGET_API_64bit"
fi
fi
else
BUILD_ARCH "arm" "$MIN_TARGET_API_32bit"
BUILD_ARCH "x86" "$MIN_TARGET_API_32bit"
BUILD_ARCH "arm64" "$MIN_TARGET_API_64bit"
BUILD_ARCH "x86_64" "$MIN_TARGET_API_64bit"
fi
cd "$ROOT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This monstrosity of a patchset reverts a bunch of libuv changes that dropped Android API 19 support in latest rebase. I am not sure how tight nodejs dependency on specific libuv version is, so maybe libuv version downgrade could somehow solve this in a more graceful manner.
On the other hand, API 19 is pretty much a dead platform nowadays, but since I've already committed into this (like I already did for nodejs-mobile 0.3.1, when patches only involved two files, but I forgot to test it and open a PR), let me just leave that here up for review.
So far I've only tested this on API 25 device (running aarch64, but with
ndk.abiFilter
set to justarmeabi-v7a
) and API 19 emulator and it seems to work.I'll try to test it on my proper API 19 target this week.I did some preliminary testing on my target physical platform and it seems to work fine so far. I'll undraft this PR after further testing.I've been using this in production on a bunch of API versions for a couple of months and didn't encounter any issues.Checklist