forked from odnoklassniki/one-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·68 lines (57 loc) · 2.82 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0"?>
<project name="one-nio" default="build" basedir=".">
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="test.dir" value="test"/>
<property name="lib.dir" value="lib"/>
<property name="target.jar" value="${build.dir}/${ant.project.name}.jar"/>
<property name="download.repo" value="https://repo1.maven.org/maven2"/>
<property name="gcc.args" value="-O3 -fno-omit-frame-pointer -momit-leaf-frame-pointer"/>
<target name="init">
<mkdir dir="${build.dir}"/>
<available file="${lib.dir}" type="dir" property="lib.dir.exists"/>
<path id="classpath.ref">
<fileset dir="${lib.dir}" includes="*.jar"/>
</path>
</target>
<target name="retrieve-libs" unless="lib.dir.exists">
<echo message="Downloading external libraries..."/>
<mkdir dir="${lib.dir}"/>
<get src="${download.repo}/org/ow2/asm/asm/9.2/asm-9.2.jar" dest="${lib.dir}/asm-9.2.jar"/>
<get src="${download.repo}/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" dest="${lib.dir}/commons-logging-1.2.jar"/>
<get src="${download.repo}/log4j/log4j/1.2.17/log4j-1.2.17.jar" dest="${lib.dir}/log4j-1.2.17.jar"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="clean-all" depends="clean">
<delete dir="${lib.dir}"/>
</target>
<target name="build" depends="build-jar"/>
<target name="compile-classes" depends="init, retrieve-libs">
<echo message="Compiling classes..."/>
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}" destdir="${build.dir}/classes" classpathref="classpath.ref" includeantruntime="false"/>
</target>
<target name="compile-native" depends="init">
<echo message="Compiling native library..."/>
<mkdir dir="${build.dir}/native"/>
<pathconvert property="src.native" pathsep=" ">
<fileset dir="${src.dir}" includes="**/*.c"/>
</pathconvert>
<exec os="Linux" executable="gcc">
<arg line="-D_GNU_SOURCE -fPIC -shared -Wl,-soname,libonenio.so ${gcc.args}
-o ${build.native}/libonenio.so
-I ${java.home}/include -I ${java.home}/include/linux
-I ${java.home}/../include -I ${java.home}/../include/linux
${src.native} -ldl -lrt"/>
</exec>
</target>
<target name="build-jar" depends="compile-classes, compile-native">
<echo message="Building ${target.jar}..."/>
<jar destfile="${target.jar}">
<fileset dir="${build.dir}/classes" includes="**/*.class" />
<fileset dir="${build.dir}/native" includes="*.so" />
</jar>
</target>
</project>