# Description: Ant is a Java-based build tool.
# URL: http://ant.apache.org/
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: openjdk17-jdk

name=ant
version=1.10.13
release=1
source=(https://www-eu.apache.org/dist/ant/source/apache-$name-$version-src.tar.xz
	ant.conf)

build() {
	cd apache-$name-$version

	sed -i 's|/usr/bin/python|/usr/bin/python3|' \
		src/script/runant.py

	unset JAVA_HOME
	export JAVA_HOME='/usr/lib/java/openjdk17-jdk'

	./bootstrap.sh
	bootstrap/bin/ant -Ddest=optional -f fetch.xml
	bootstrap/bin/ant dist

	cd apache-$name-$version

	install -d $PKG/usr/share/ant
	cp -Rp etc $PKG/usr/share/ant

	find bin -type f -a ! -name \*.bat -a ! -name \*.cmd \
		-exec install -Dm 755 {} -t "$PKG/usr/share/ant/bin" \;

	install -d "$PKG/usr/bin"
	ln -s /usr/share/ant/bin/ant "$PKG/usr/bin/ant"

	install -Dm 644 "$SRC/ant.conf" -t "$PKG/etc"
	install -Dm 644 lib/*.jar -t "$PKG/usr/share/java/ant"
	ln -s /usr/share/java/ant "$PKG/usr/share/ant/lib"
}
