9 |
DESCRIPTION="Ant is a java-based build tool." |
DESCRIPTION="Ant is a java-based build tool." |
10 |
HOMEPAGE="http://ant.apache.org/" |
HOMEPAGE="http://ant.apache.org/" |
11 |
|
|
12 |
|
# enable bootstrap of ant or not (0=disabled, 1=enabled) |
13 |
|
BOOTSTRAP=0 |
14 |
|
|
15 |
DEPEND=">= virtual/java-jdk |
DEPEND=">= virtual/java-jdk |
16 |
>= dev-java/junit-4.12" |
>= dev-java/junit-4.12 |
17 |
|
>= dev-java/hamcrest-1.3" |
18 |
|
|
19 |
|
SDEPEND=">= virtual/sed" |
20 |
|
|
21 |
|
if [[ ${BOOTSTRAP} = 0 ]] |
22 |
|
then |
23 |
|
SDEPEND="${SDEPEND} |
24 |
|
>= dev-java/apache-ant-1.9" |
25 |
|
fi |
26 |
|
|
27 |
SRCFILE="${PNAME}-${PVER}-src.tar.bz2" |
SRCFILE="${PNAME}-${PVER}-src.tar.bz2" |
28 |
SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
29 |
|
|
30 |
|
OPT_SRCFILE="optional-20160503-1.tar.bz2" |
31 |
|
|
32 |
sminclude mbuild java |
sminclude mbuild java |
33 |
msetfeature "!check" |
msetfeature "!check" |
34 |
|
|
35 |
SRC_URI=( |
SRC_URI=( |
36 |
http://www.apache.org/dist/ant/source/${SRCFILE} |
http://www.apache.org/dist/ant/source/${SRCFILE} |
37 |
mirror://${PNAME}/${SRCFILE} |
mirror://${PNAME}/${SRCFILE} |
38 |
|
mirror://${PNAME}/${OPT_SRCFILE} |
39 |
) |
) |
40 |
|
|
41 |
UP2DATE="updatecmd http://www.apache.org/dist/ant/source/ | grep ${PNAME}- | sed 's:-src::g' | highesttarball" |
UP2DATE="updatecmd http://www.apache.org/dist/ant/source/ | grep ${PNAME}- | sed 's:-src::g' | highesttarball" |
42 |
|
|
43 |
|
src_prepare() |
44 |
|
{ |
45 |
|
munpack ${SRCFILE} || die |
46 |
|
munpack ${OPT_SRCFILE} ${SRCDIR}/lib/optional || die |
47 |
|
cd ${SRCDIR} |
48 |
|
|
49 |
|
# fix memory issues with systemd-nspawn |
50 |
|
sed -i 's:maxmemory="1000M":maxmemory="100M":' build.xml || die |
51 |
|
} |
52 |
|
|
53 |
src_compile() |
src_compile() |
54 |
{ |
{ |
55 |
|
local myopts |
56 |
|
local targets |
57 |
local junit |
local junit |
58 |
|
local hamcrest |
59 |
|
local ant_exec |
60 |
cd ${SRCDIR} |
cd ${SRCDIR} |
61 |
|
|
62 |
# get junit from classpath |
# get junit from classpath |
66 |
else |
else |
67 |
junit="${JAVA_CLASSPATH_DIR}/junit.jar" |
junit="${JAVA_CLASSPATH_DIR}/junit.jar" |
68 |
fi |
fi |
69 |
# and copy it to lib/optional as apache-ant has now a hard-dependency to it |
# and linking it to lib/optional as apache-ant has now a hard-dependency to it |
70 |
echo "Using junit.jar from ${junit}!" |
echo "Using junit.jar from ${junit}!" |
71 |
cp -v ${junit} ${SRCDIR}/lib/optional/junit.jar || die |
rm -v ${SRCDIR}/lib/optional/junit.jar || die |
72 |
|
ln -snf ${unit} ${SRCDIR}/lib/optional/unit.jar || die |
73 |
|
rm -v ${SRCDIR}/lib/optional/junit-4.11.jar || die |
74 |
|
ln -vsnf ${unit} ${SRCDIR}/lib/optional/unit-4.11.jar || die |
75 |
|
|
76 |
|
# get hamcrest-core from classpath |
77 |
|
if [[ -L ${JAVA_CLASSPATH_DIR}/hamcrest-core.jar ]] |
78 |
|
then |
79 |
|
hamcrest="${JAVA_CLASSPATH_DIR}/$(readlink ${JAVA_CLASSPATH_DIR}/hamcrest-core.jar)" |
80 |
|
else |
81 |
|
hamcrest="${JAVA_CLASSPATH_DIR}/hamcrest-core.jar" |
82 |
|
fi |
83 |
|
# and linking it to lib/optional as apache-ant has now a hard-dependency to it |
84 |
|
echo "Using hamcrest-core.jar from ${hamcrest}!" |
85 |
|
rm -v ${SRCDIR}/lib/optional/hamcrest-core-1.3.jar || die |
86 |
|
ln -vsnf ${hamcrest} ${SRCDIR}/lib/optional/hamcrest-core-1.3.jar || die |
87 |
|
|
88 |
|
case ${BOOTSTRAP} in |
89 |
|
0) ant_exec="ant" ;; |
90 |
|
1) ant_exec='./build.sh' ;; |
91 |
|
*) die "unknown bootstrap option '${BOOTSTRAP}'" ;; |
92 |
|
esac |
93 |
|
|
94 |
|
# we use a tarball which provides all optionals to honor proxy |
95 |
|
# |
96 |
|
# # ant needs HOME to download libs to $HOME/.m2/repository |
97 |
|
# # this one does not honor authenticated proxies |
98 |
|
# export ANT_OPTS="-Duser.home=${SRCDIR}" |
99 |
|
# ${ant_exec} -Ddest=optional -f fetch.xml || die |
100 |
|
|
101 |
|
# enable verbose mode |
102 |
|
myopts+=" -verbose" |
103 |
|
|
104 |
|
# all build targets all together (disabled by default, don't want javadocs) |
105 |
|
#targets+=" dist" |
106 |
|
|
107 |
|
# only build the jars and internals but not javadocs |
108 |
|
targets+=" jars internal_dist" |
109 |
|
|
110 |
|
# enable build of javadocs (disabled by default to save lots of ram @buildtime) |
111 |
|
#targets+=" javadocs" |
112 |
|
# don't fail the build on javadocs erros |
113 |
|
#myopts+=" -Djavadoc.failonerror=false" |
114 |
|
|
115 |
install -d dist || die |
${ant_exec} ${myopts} ${targets} || die |
|
./build.sh -Ddist.dir=dist/ dist || die |
|
116 |
} |
} |
117 |
|
|
118 |
src_install() |
src_install() |