ant: use openjdk instead of dalvikvm (#7628)

This commit is contained in:
Raven Ravener 2021-10-02 18:30:30 +04:30 committed by GitHub
parent 871d28c0ba
commit 6e98ebc001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 95 deletions

View File

@ -1,81 +0,0 @@
#!@TERMUX_PREFIX@/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e -u
# Extract launch and ant arguments, (see details below).
ant_exec_args=
no_config=false
ant_exec_debug=false
show_help=false
for arg in "$@" ; do
if [ "$arg" = "--noconfig" ] ; then
no_config=true
elif [ "$arg" = "--execdebug" ] ; then
ant_exec_debug=true
elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then
show_help=true
ant_exec_args="$ant_exec_args -h"
else
if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then
show_help=true
fi
ant_exec_args="$ant_exec_args \"$arg\""
fi
done
if [ -z "$ANT_HOME" ]; then
ANT_HOME=@TERMUX_PREFIX@/share/ant
fi
if ! $no_config ; then
if [ -f "$HOME/.ant/ant.conf" ] ; then
. $HOME/.ant/ant.conf
fi
if [ -f "$HOME/.antrc" ] ; then
. "$HOME/.antrc"
fi
fi
ANT_LIB="${ANT_HOME}/lib"
if [ -z "$LOCALCLASSPATH" ] ; then
LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar
else
LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH
fi
# Show script help if requested
if $show_help ; then
echo $0 '[script options] [options] [target [target2 [target3] ..]]'
echo 'Script Options:'
echo ' --help, --h print this message and ant help'
echo ' --noconfig suppress sourcing of /etc/ant.conf,'
echo ' $HOME/.ant/ant.conf, and $HOME/.antrc'
echo ' configuration files'
echo ' --execdebug print ant exec line generated by this'
echo ' launch script'
echo ' '
fi
# Execute ant using eval/exec to preserve spaces in paths, java options, and ant args
ant_sys_opts=
ant_exec_command="exec dalvikvm $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\""
if $ant_exec_debug ; then
echo $ant_exec_command $ant_exec_args
fi
eval $ant_exec_command "$ant_exec_args"

View File

@ -1,26 +1,21 @@
TERMUX_PKG_HOMEPAGE=http://ant.apache.org/
TERMUX_PKG_DESCRIPTION="Java based build tool like make"
TERMUX_PKG_VERSION=1.10.11
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=http://apache.mirrors.spacedump.net//ant/binaries/apache-ant-${TERMUX_PKG_VERSION}-bin.tar.bz2
TERMUX_PKG_SHA256=ffc6c9eb2d153db76e18df70fa145744ddd0d754339df5a797a47603cfeaa8a6
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_RECOMMENDS="openjdk-17"
TERMUX_PKG_DEPENDS="openjdk-17"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_make_install() {
mkdir -p $TERMUX_PREFIX/share/ant/lib
for jar in ant ant-launcher; do
$TERMUX_D8 \
--classpath $ANDROID_HOME/platforms/android-$TERMUX_PKG_API_LEVEL/android.jar \
--release \
--min-api $TERMUX_PKG_API_LEVEL \
--output $TERMUX_PREFIX/share/ant/lib/${jar}.jar \
lib/${jar}.jar
done
install $TERMUX_PKG_BUILDER_DIR/ant $TERMUX_PREFIX/bin/ant
perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/ant
mv ./bin/ant .
rm -f ./bin/*
mv ./ant ./bin/
rm -rf $TERMUX_PREFIX/opt/ant
mkdir -p $TERMUX_PREFIX/opt/ant
cp -r ./* $TERMUX_PREFIX/opt/ant
ln -sfr $TERMUX_PREFIX/opt/ant/bin/ant $PREFIX/bin/ant
}