2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=http://www.eclipse.org/jdt/core/
|
|
|
|
TERMUX_PKG_DESCRIPTION="Eclipse Compiler for Java"
|
2019-01-20 22:39:59 +01:00
|
|
|
TERMUX_PKG_LICENSE="EPL-2.0"
|
2019-12-30 15:51:42 +01:00
|
|
|
# Version 4.12 is the last known to work on Android 7-8.
|
2019-12-30 17:51:20 +01:00
|
|
|
_VERSION=4.12
|
2019-12-30 15:51:42 +01:00
|
|
|
local _DATE=201906051800
|
|
|
|
TERMUX_PKG_VERSION=1:${_VERSION}
|
2019-12-30 17:51:20 +01:00
|
|
|
TERMUX_PKG_SRCURL=http://archive.eclipse.org/eclipse/downloads/drops${_VERSION:0:1}/R-${_VERSION}-${_DATE}/ecj-${_VERSION}.jar
|
2019-12-30 15:51:42 +01:00
|
|
|
TERMUX_PKG_SHA256=69dad18a1fcacd342a7d44c5abf74f50e7529975553a24c64bce0b29b86af497
|
2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_PLATFORM_INDEPENDENT=true
|
2018-08-22 08:31:07 +02:00
|
|
|
TERMUX_PKG_CONFLICTS="ecj4.6"
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_extract_package() {
|
2019-08-08 14:25:54 +02:00
|
|
|
# Certain packages are not safe to build on device because their
|
|
|
|
# build.sh script deletes specific files in $TERMUX_PREFIX.
|
2019-08-12 17:28:41 +02:00
|
|
|
if $TERMUX_ON_DEVICE_BUILD; then
|
2019-08-08 14:25:54 +02:00
|
|
|
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
|
|
|
|
fi
|
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
mkdir $TERMUX_PKG_SRCDIR
|
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_make() {
|
2019-12-30 17:51:20 +01:00
|
|
|
local RAW_JAR=$TERMUX_PKG_CACHEDIR/ecj-${_VERSION}.jar
|
2018-07-26 12:21:43 +02:00
|
|
|
termux_download $TERMUX_PKG_SRCURL \
|
|
|
|
$RAW_JAR \
|
|
|
|
$TERMUX_PKG_SHA256
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2018-07-26 12:21:43 +02:00
|
|
|
mkdir -p $TERMUX_PREFIX/share/{dex,java}
|
|
|
|
$TERMUX_D8 \
|
2018-07-26 12:31:42 +02:00
|
|
|
--classpath $ANDROID_HOME/platforms/android-$TERMUX_PKG_API_LEVEL/android.jar \
|
2018-07-26 12:21:43 +02:00
|
|
|
--release \
|
2019-04-27 22:56:28 +02:00
|
|
|
--min-api $TERMUX_PKG_API_LEVEL \
|
2018-07-26 12:21:43 +02:00
|
|
|
--output $TERMUX_PKG_TMPDIR \
|
2015-06-13 01:03:31 +02:00
|
|
|
$RAW_JAR
|
|
|
|
|
2018-07-26 12:21:43 +02:00
|
|
|
# Package classes.dex into jar:
|
2015-06-13 01:03:31 +02:00
|
|
|
cd $TERMUX_PKG_TMPDIR
|
2018-07-26 12:21:43 +02:00
|
|
|
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
|
2019-02-09 12:16:54 +01:00
|
|
|
jar uf ecj.jar org/eclipse/jdt/internal/compiler/batch/messages.properties
|
2018-07-26 12:21:43 +02:00
|
|
|
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/problem/messages.properties
|
2019-02-09 12:16:54 +01:00
|
|
|
jar uf ecj.jar org/eclipse/jdt/internal/compiler/problem/messages.properties
|
2018-07-26 12:21:43 +02:00
|
|
|
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/messages.properties
|
2019-02-09 12:16:54 +01:00
|
|
|
jar uf ecj.jar org/eclipse/jdt/internal/compiler/messages.properties
|
2018-07-26 12:21:43 +02:00
|
|
|
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/parser/readableNames.props
|
2019-02-09 12:16:54 +01:00
|
|
|
jar uf ecj.jar org/eclipse/jdt/internal/compiler/parser/readableNames.props
|
2019-02-12 09:41:30 +01:00
|
|
|
for i in $(seq 1 24); do
|
2018-07-26 12:21:43 +02:00
|
|
|
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/parser/parser$i.rsc
|
2019-02-09 12:16:54 +01:00
|
|
|
jar uf ecj.jar org/eclipse/jdt/internal/compiler/parser/parser$i.rsc
|
2018-07-26 12:21:43 +02:00
|
|
|
done
|
|
|
|
# Move into place:
|
|
|
|
mv ecj.jar $TERMUX_PREFIX/share/dex/ecj.jar
|
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
rm -rf android-jar
|
|
|
|
mkdir android-jar
|
|
|
|
cd android-jar
|
|
|
|
|
2019-02-09 12:16:54 +01:00
|
|
|
# We need the android classes for JDT to compile against.
|
2019-01-27 09:02:45 +01:00
|
|
|
cp $ANDROID_HOME/platforms/android-28/android.jar .
|
2016-08-10 15:53:47 +02:00
|
|
|
unzip -q android.jar
|
2015-06-13 01:03:31 +02:00
|
|
|
rm -Rf android.jar resources.arsc res assets
|
2017-11-21 05:26:30 +01:00
|
|
|
jar cfM android.jar .
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
cp $TERMUX_PKG_TMPDIR/android-jar/android.jar $TERMUX_PREFIX/share/java/android.jar
|
2017-08-11 14:22:47 +02:00
|
|
|
|
|
|
|
# Bundle in an android.jar from an older API also, for those who want to
|
|
|
|
# build apps that run on older Android versions.
|
2017-08-11 14:26:15 +02:00
|
|
|
rm -Rf ./*
|
2019-04-27 22:56:28 +02:00
|
|
|
cp $ANDROID_HOME/platforms/android-$TERMUX_PKG_API_LEVEL/android.jar android.jar
|
2017-08-11 14:22:47 +02:00
|
|
|
unzip -q android.jar
|
|
|
|
rm -Rf android.jar resources.arsc res assets
|
2019-04-27 22:56:28 +02:00
|
|
|
jar cfM android-$TERMUX_PKG_API_LEVEL.jar .
|
|
|
|
cp $TERMUX_PKG_TMPDIR/android-jar/android-$TERMUX_PKG_API_LEVEL.jar $TERMUX_PREFIX/share/java/
|
2017-08-11 14:22:47 +02:00
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
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
|
2019-04-27 22:56:28 +02:00
|
|
|
install $TERMUX_PKG_BUILDER_DIR/ecj-$TERMUX_PKG_API_LEVEL $TERMUX_PREFIX/bin/ecj-$TERMUX_PKG_API_LEVEL
|
|
|
|
perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/ecj-$TERMUX_PKG_API_LEVEL
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|