dx: use version patched to work under Android 9 and higher

Fixes the issue described in https://www.reddit.com/r/termux/comments/ejrasu/java_on_my_s10_refuses_to_work/.

Android 9 and higher no longer provides JCA API - see https://developer.android.com/guide/topics/security/cryptography#crypto_provider.
This commit is contained in:
Leonid Pliushch 2020-01-18 10:50:48 +02:00
parent 0e08a15a7b
commit 3bd977c9d6

View File

@ -1,37 +1,35 @@
TERMUX_PKG_HOMEPAGE=http://developer.android.com/tools/help/index.html TERMUX_PKG_HOMEPAGE=http://developer.android.com/tools/help/index.html
TERMUX_PKG_DESCRIPTION="Command which takes in class files and reformulates them for usage on Android" TERMUX_PKG_DESCRIPTION="Command which takes in Java class files and converts them to format executable by Dalvik VM"
TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_VERSION=$TERMUX_ANDROID_BUILD_TOOLS_VERSION TERMUX_PKG_VERSION=1:1.16
TERMUX_PKG_SRCURL=https://dl.bintray.com/xeffyr/sources/dx/dx-android-1.16.jar
TERMUX_PKG_SHA256=b9b7917267876b74c8ff6707e7a576c93b6dfe8cacc4f1cc791d606bcbbb7bd5
TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true
termux_step_make_install() { termux_step_make_install() {
# Rewrite packages to avoid using com.android.* classes which may clash with termux_download "$TERMUX_PKG_SRCURL" \
# classes in the Android runtime on devices (see #1801): "$TERMUX_PKG_CACHEDIR/dx-${TERMUX_PKG_VERSION:2}.jar" \
local JARJAR=$TERMUX_PKG_CACHEDIR/jarjar.jar "$TERMUX_PKG_SHA256"
local RULEFILE=$TERMUX_PKG_TMPDIR/jarjar-rule.txt
local REWRITTEN_DX=$TERMUX_PKG_TMPDIR/dx-rewritten.jar
termux_download \
http://central.maven.org/maven2/com/googlecode/jarjar/jarjar/1.3/jarjar-1.3.jar \
$JARJAR \
4225c8ee1bf3079c4b07c76fe03c3e28809a22204db6249c9417efa4f804b3a7
echo 'rule com.android.** dx.@1' > $RULEFILE
java -jar $JARJAR process $RULEFILE \
$ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar \
$REWRITTEN_DX
# Dex the rewritten jar file: install -Dm600 "$TERMUX_PKG_CACHEDIR/dx-${TERMUX_PKG_VERSION:2}.jar" \
mkdir -p $TERMUX_PREFIX/share/dex "$TERMUX_PREFIX"/share/dex/dx.jar
$TERMUX_D8 \
--release \
--min-api $TERMUX_PKG_API_LEVEL \
--output $TERMUX_PKG_TMPDIR \
$REWRITTEN_DX
cd $TERMUX_PKG_TMPDIR cat <<- EOF > "$TERMUX_PREFIX"/bin/dx
jar cf dx.jar classes.dex #!${TERMUX_PREFIX}/bin/sh
mv dx.jar $TERMUX_PREFIX/share/dex/dx.jar exec dalvikvm \
-Xmx256m \
-cp ${TERMUX_PREFIX}/share/dex/dx.jar \
dx.dx.command.Main "\$@"
EOF
chmod 700 "$TERMUX_PREFIX"/bin/dx
install $TERMUX_PKG_BUILDER_DIR/dx $TERMUX_PREFIX/bin/dx cat <<- EOF > "$TERMUX_PREFIX"/bin/dx-merge
perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/dx #!${TERMUX_PREFIX}/bin/sh
exec dalvikvm \
-Xmx256m \
-cp ${TERMUX_PREFIX}/share/dex/dx.jar \
dx.dx.merge.DexMerger "\$@"
EOF
chmod 700 "$TERMUX_PREFIX"/bin/dx-merge
} }