2020-07-16 19:42:05 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=https://developer.android.com/studio/command-line/apksigner
|
2016-10-07 01:38:12 +02:00
|
|
|
TERMUX_PKG_DESCRIPTION="APK signing tool"
|
2019-01-20 22:39:59 +01:00
|
|
|
TERMUX_PKG_LICENSE="Apache-2.0"
|
2020-07-16 19:42:05 +02:00
|
|
|
TERMUX_PKG_VERSION=${TERMUX_ANDROID_BUILD_TOOLS_VERSION}
|
2019-08-12 17:28:41 +02:00
|
|
|
TERMUX_PKG_BUILD_IN_SRC=true
|
2016-10-07 01:38:12 +02:00
|
|
|
TERMUX_PKG_PLATFORM_INDEPENDENT=true
|
2020-07-21 10:19:54 +02:00
|
|
|
TERMUX_PKG_SKIP_SRC_EXTRACT=true
|
2016-10-07 01:38:12 +02:00
|
|
|
|
2020-07-21 10:02:33 +02:00
|
|
|
termux_step_get_source() {
|
2020-07-16 19:42:05 +02:00
|
|
|
mkdir -p "$TERMUX_PKG_SRCDIR" && cd "$TERMUX_PKG_SRCDIR"
|
|
|
|
mkdir -p com/android/apksig/internal/asn1
|
|
|
|
termux_download \
|
|
|
|
"https://android.googlesource.com/platform/tools/apksig/+/refs/tags/platform-tools-$TERMUX_PKG_VERSION/src/main/java/com/android/apksig/internal/asn1/Asn1BerParser.java?format=TEXT" \
|
|
|
|
com/android/apksig/internal/asn1/Asn1BerParser_b64.java \
|
|
|
|
f0506dedb7291dce1066b7aec3fc42c70b1862b39d9cdb176ba75d24b870765e
|
|
|
|
base64 -d com/android/apksig/internal/asn1/Asn1BerParser_b64.java > com/android/apksig/internal/asn1/Asn1BerParser.java
|
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_pre_configure() {
|
|
|
|
# Requires Android SDK, not available on device
|
|
|
|
if $TERMUX_ON_DEVICE_BUILD; then
|
|
|
|
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_make() {
|
2020-07-16 19:42:05 +02:00
|
|
|
mkdir -p $TERMUX_PREFIX/share/dex
|
|
|
|
cp $ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/apksigner.jar "$TERMUX_PKG_SRCDIR"
|
|
|
|
SOURCEFILE="$TERMUX_PKG_SRCDIR/apksigner.jar"
|
2016-10-07 18:59:01 +02:00
|
|
|
|
2020-07-16 19:42:05 +02:00
|
|
|
cd "$TERMUX_PKG_SRCDIR"
|
|
|
|
javac -cp "$SOURCEFILE" com/android/apksig/internal/asn1/Asn1BerParser.java
|
|
|
|
zip -u "$SOURCEFILE" com/android/apksig/internal/asn1/Asn1BerParser.class
|
2018-07-26 12:21:43 +02:00
|
|
|
|
|
|
|
$TERMUX_D8 \
|
|
|
|
--classpath $ANDROID_HOME/platforms/android-$TERMUX_PKG_API_LEVEL/android.jar \
|
|
|
|
--release \
|
|
|
|
--min-api $TERMUX_PKG_API_LEVEL \
|
|
|
|
--output $TERMUX_PKG_TMPDIR \
|
2020-07-16 19:42:05 +02:00
|
|
|
$SOURCEFILE
|
|
|
|
}
|
2018-07-26 12:21:43 +02:00
|
|
|
|
2020-07-16 19:42:05 +02:00
|
|
|
termux_step_make_install() {
|
2018-07-26 12:21:43 +02:00
|
|
|
cd $TERMUX_PKG_TMPDIR
|
2020-07-16 19:42:05 +02:00
|
|
|
unzip $SOURCEFILE */*.txt
|
|
|
|
jar cf apksigner.jar classes.dex com/
|
2018-07-26 12:21:43 +02:00
|
|
|
mv apksigner.jar $TERMUX_PREFIX/share/dex/apksigner.jar
|
|
|
|
|
2016-10-07 01:38:12 +02:00
|
|
|
echo '#!/bin/sh' > $TERMUX_PREFIX/bin/apksigner
|
2020-07-16 19:42:05 +02:00
|
|
|
echo "dalvikvm -cp $TERMUX_PREFIX/share/dex/apksigner.jar com.android.apksigner.ApkSignerTool \$@" >> $TERMUX_PREFIX/bin/apksigner
|
2016-10-07 01:38:12 +02:00
|
|
|
chmod +x $TERMUX_PREFIX/bin/apksigner
|
|
|
|
}
|