From 09fe7c4a5927687d05c6eddccb4f191a0a68a00f Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sat, 18 Aug 2018 07:46:21 +0200 Subject: [PATCH] ecj4.6: add package for compatibility with android 5 and 6 --- packages/ecj4.6/build.sh | 74 ++++++++++++++++++++++++++++++++++++++++ packages/ecj4.6/ecj | 11 ++++++ packages/ecj4.6/ecj-21 | 11 ++++++ 3 files changed, 96 insertions(+) create mode 100755 packages/ecj4.6/build.sh create mode 100755 packages/ecj4.6/ecj create mode 100755 packages/ecj4.6/ecj-21 diff --git a/packages/ecj4.6/build.sh b/packages/ecj4.6/build.sh new file mode 100755 index 000000000..04e1ee23f --- /dev/null +++ b/packages/ecj4.6/build.sh @@ -0,0 +1,74 @@ +TERMUX_PKG_HOMEPAGE=http://www.eclipse.org/jdt/core/ +TERMUX_PKG_DESCRIPTION="Eclipse Compiler for Java, for android 5 and 6" +TERMUX_PKG_VERSION=4.6.2 +_date=201611241400 +TERMUX_PKG_SHA256=9953dc2be829732e1b939106a71de018f660891220dbca559a5c7bff84883e51 +TERMUX_PKG_SRCURL=http://archive.eclipse.org/eclipse/downloads/drops${TERMUX_PKG_VERSION:0:1}/R-$TERMUX_PKG_VERSION-$_date/ecj-$TERMUX_PKG_VERSION.jar +TERMUX_PKG_PLATFORM_INDEPENDENT=true +TERMUX_PKG_CONFLICTS="ecj" +TERMUX_PKG_REPLACES="ecj" + +termux_step_extract_package () { + mkdir $TERMUX_PKG_SRCDIR +} + +termux_step_make () { + local RAW_JAR=$TERMUX_PKG_CACHEDIR/ecj-${TERMUX_PKG_VERSION}.jar + termux_download $TERMUX_PKG_SRCURL \ + $RAW_JAR \ + $TERMUX_PKG_SHA256 + + mkdir -p $TERMUX_PREFIX/share/{dex,java} + $TERMUX_D8 \ + --classpath $ANDROID_HOME/platforms/android-$TERMUX_PKG_API_LEVEL/android.jar \ + --release \ + --min-api 21 \ + --output $TERMUX_PKG_TMPDIR \ + $RAW_JAR + + # Package classes.dex into jar: + cd $TERMUX_PKG_TMPDIR + jar cf ecj.jar classes.dex + # Add needed properties file to jar file: + jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/batch/messages.properties + jar uf ecj.jar org/eclipse/jdt/internal/compiler/batch/messages.properties + jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/problem/messages.properties + jar uf ecj.jar org/eclipse/jdt/internal/compiler/problem/messages.properties + jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/messages.properties + jar uf ecj.jar org/eclipse/jdt/internal/compiler/messages.properties + jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/parser/readableNames.props + jar uf ecj.jar org/eclipse/jdt/internal/compiler/parser/readableNames.props + for i in `seq 1 24`; do + jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/parser/parser$i.rsc + jar uf ecj.jar org/eclipse/jdt/internal/compiler/parser/parser$i.rsc + done + # Move into place: + mv ecj.jar $TERMUX_PREFIX/share/dex/ecj.jar + + rm -rf android-jar + mkdir android-jar + cd android-jar + + # We need the android classes for JDT to compile against. + cp $ANDROID_HOME/platforms/android-27/android.jar . + unzip -q android.jar + rm -Rf android.jar resources.arsc res assets + jar cfM android.jar . + + cp $TERMUX_PKG_TMPDIR/android-jar/android.jar $TERMUX_PREFIX/share/java/android.jar + + # Bundle in an android.jar from an older API also, for those who want to + # build apps that run on older Android versions. + rm -Rf ./* + cp $ANDROID_HOME/platforms/android-21/android.jar android.jar + unzip -q android.jar + rm -Rf android.jar resources.arsc res assets + jar cfM android-21.jar . + cp $TERMUX_PKG_TMPDIR/android-jar/android-21.jar $TERMUX_PREFIX/share/java/ + + rm -Rf $TERMUX_PREFIX/bin/javac + install $TERMUX_PKG_BUILDER_DIR/ecj $TERMUX_PREFIX/bin/ecj + perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/ecj + install $TERMUX_PKG_BUILDER_DIR/ecj-21 $TERMUX_PREFIX/bin/ecj-21 + perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/ecj-21 +} diff --git a/packages/ecj4.6/ecj b/packages/ecj4.6/ecj new file mode 100755 index 000000000..07c79c046 --- /dev/null +++ b/packages/ecj4.6/ecj @@ -0,0 +1,11 @@ +#!/bin/sh + +# -proc:none to disable annotation processing. +# -7 for java 1.7 compatibility. +dalvikvm -Xmx256m \ + -cp @TERMUX_PREFIX@/share/dex/ecj.jar \ + org.eclipse.jdt.internal.compiler.batch.Main \ + -proc:none \ + -7 \ + -cp @TERMUX_PREFIX@/share/java/android.jar \ + $@ diff --git a/packages/ecj4.6/ecj-21 b/packages/ecj4.6/ecj-21 new file mode 100755 index 000000000..8383a7684 --- /dev/null +++ b/packages/ecj4.6/ecj-21 @@ -0,0 +1,11 @@ +#!/bin/sh + +# -proc:none to disable annotation processing. +# -7 for java 1.7 compatibility. +dalvikvm -Xmx256m \ + -cp @TERMUX_PREFIX@/share/dex/ecj.jar \ + org.eclipse.jdt.internal.compiler.batch.Main \ + -proc:none \ + -7 \ + -cp @TERMUX_PREFIX@/share/java/android-21.jar \ + $@