summaryrefslogtreecommitdiffstats
path: root/build.xml
blob: f7809b056cff09de6d15c2d78c92fd7341fb53eb (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!-- Buildfile -->
<project name="jake2" default="usage" basedir=".">

	<taskdef name="proguard" classname="proguard.ant.ProGuardTask">
		<classpath>
    		<pathelement location="lib/proguard/proguard.jar"/>
    	</classpath>
	</taskdef>
	

	<taskdef name="izpack" classpath="lib/izpack/standalone-compiler.jar"
         classname="com.izforge.izpack.ant.IzPackTask"/>
         
	<!-- properties -->
	<property name="version" value="cvs"/> 
	<property name="src" location="src"/>
	<property name="test" location="test"/>
	<property name="build" location="build"/>
	<property name="dist" location="dist"/>

	<!-- different classpaths -->
	<path id="build.class.path">
		<pathelement location="lib/jogl/jogl.jar"/>
		<pathelement location="lib/jsr231/jogl.jar"/>
		<pathelement location="lib/jsr231/gluegen-rt.jar"/>
		<pathelement location="lib/joal/joal.jar"/>
		<pathelement location="lib/lwjgl/lwjgl.jar"/>
		<pathelement location="lib/lwjgl/lwjgl_util.jar"/>
	</path>
	
	<!-- usage -->
	<target name="usage">
		<echo message="command line arguments for build.sh or build.bat"/>
		<echo message=""/>
		<echo message="installer    build installer"/>
		<echo message="bindist      build .tar.gz and .zip binary distribution"/>
		<echo message="srcdist      build only source distribution"/>
		<echo message="all          build everything"/>
		<echo message="clean        delete classfiles keep distribution files"/>
		<echo message="distclean    delete all generated files"/>
		<echo message="jar          build only dist/lib/jake2.jar"/>
		<echo message=""/>
	</target>

	<!-- initialize directories -->
	<target name="init">
		<mkdir dir="${build}"/>
		<mkdir dir="${dist}/lib"/>
	</target>

	<!-- compile -->
	<target name="compile" depends="init">
		<javac destdir="${build}" optimize="off" debug="on" source="1.4">
			<src path="${src}"/>
			<include name="jake2/**"/>
			<classpath refid="build.class.path"/>
		</javac>
	</target>
	
	<!-- copy resources -->
	<target name="copyres" depends="init">
		<copy todir="${build}">
			<fileset dir="resources">
				<include name="**/*"/>
			</fileset>
		</copy>
	</target>
	
	<!-- copy files -->
	<target name="copy">
		<copy todir="${dist}/lib">
			<fileset dir="lib/jogl">
				<include name="*.jar"/>
			</fileset>
			<fileset dir="lib/joal">
				<include name="*.jar"/>
			</fileset>
			<fileset dir="lib/lwjgl">
				<include name="*.jar"/>
			</fileset>
		</copy>
		<copy todir="${dist}/lib/linux">
			<fileset dir="lib/jogl/linux">
				<include name="*"/>
			</fileset>
			<fileset dir="lib/joal/linux">
				<include name="*"/>
			</fileset>			
		</copy>
		<copy todir="${dist}/lib/linux/lwjgl">
			<fileset dir="lib/lwjgl/linux">
				<include name="*"/>
			</fileset>				
		</copy>
		<copy todir="${dist}/lib/windows">
			<fileset dir="lib/jogl/windows">
				<include name="*"/>
			</fileset>
			<fileset dir="lib/joal/windows">
				<include name="*"/>
			</fileset>
		</copy>
		<copy todir="${dist}/lib/windows/lwjgl">
			<fileset dir="lib/lwjgl/windows">
				<include name="*"/>
			</fileset>				
		</copy>
		<copy todir="${dist}/lib/osx">
			<fileset dir="lib/jogl/osx">
				<include name="*"/>
			</fileset>			
			<fileset dir="lib/joal/osx">
				<include name="*"/>
			</fileset>
		</copy>
		<copy todir="${dist}/lib/osx/lwjgl">
			<fileset dir="lib/lwjgl/osx">
				<include name="*"/>
			</fileset>				
		</copy>
		<copy todir="${dist}">
			<fileset dir="scripts">
				<include name="Jake2*"/>
			</fileset>
			<fileset dir=".">
				<include name="ChangeLog"/>
				<include name="LICENSE"/>
				<include name="README"/>
				<include name="readme.id"/>			
			</fileset>
		</copy>
		<chmod perm="755">
			<fileset dir="${dist}">
				<include name="*.sh"/>
			</fileset>
		</chmod>
		<fixcrlf srcdir="${dist}"
			eol="crlf"
			includes="*.bat"
		/>
		<fixcrlf srcdir="${dist}"
			eol="lf"
			includes="*.sh"
		/> 		
	</target>
		
	<!-- jar -->
	<target name="jar" depends="compile,copyres">
		<jar destfile="${dist}/lib/jake2.jar" basedir="${build}">
			<include name="jake2/**"/>
			<include name="*.png"/>
			<include name="mirrors"/>
		</jar>
		<property name="classes" value="${java.home}/lib/rt.jar"/>
        <condition property="classes" value="${java.home}/../Classes/classes.jar">
            <os name="Mac OS X"/>
        </condition> 		
		<!-- proguard printseeds="on" printusage="off" outjar="${dist}/lib/jake2.jar"
			defaultpackage="" overloadaggressively="off" printmapping="jake2.map">
			<injar name="jake2.jar"/>
			<libraryjar name="lib/jogl/jogl.jar"/>
			<libraryjar name="lib/jsr231/jogl.jar"/>
			<libraryjar name="lib/joal/joal.jar"/>
			<libraryjar name="lib/joal/gluegen-rt.jar"/>
			<libraryjar name="${classes}"/>
			<keep access="public" name="jake2.Jake2">
				<method name="main(java.lang.String[])"/>
			</keep>
		</proguard -->
	</target>
	
	<target name="patch" depends="copy">
		<!-- performance patch for lwjgl -->
		<javac destdir="${build}" optimize="off" debug="on" source="1.4">
			<src path="lib/lwjgl/patch"/>
			<include name="org/lwjgl/**"/>
			<classpath refid="build.class.path"/>
		</javac>
		<!-- update original lwjgl.jar -->
		<jar destfile="${dist}/lib/lwjgl.jar" basedir="${build}" update="true">
			<include name="org/lwjgl/**"/>
		</jar>
	</target>
	
	<!-- everything -->
	<target name="all" depends="installer,bindist,srcdist">
	</target>

	<!-- dist -->
	<target name="dist" depends="jar,copy,patch">
	</target>
		
	<!-- binary distribution -->
	<target name="bindist" depends="dist">
		<tar destfile="jake2-${version}.tar.gz" compression="gzip">
			<tarfileset dir="${dist}" prefix="Jake2" mode="755">
				<include name="*.sh"/>
			</tarfileset>
			<tarfileset dir="${dist}" prefix="Jake2">
				<include name="**"/>
				<exclude name="*.sh"/>
			</tarfileset>
		</tar>
		<zip destfile="jake2-${version}.zip">
			<zipfileset dir="${dist}" prefix="Jake2">
				<include name="**"/>
			</zipfileset>
		</zip>
	</target>
	
	<!-- source distribution -->
	<target name="srcdist">
		<tar destfile="jake2src-${version}.tar.gz" compression="gzip">
			<tarfileset dir="." prefix="Jake2" mode="755">
				<include name="scripts/*.*"/>
				<include name="build.sh"/>
			</tarfileset>
			<tarfileset dir="." prefix="Jake2">
				<include name="src/jake2/**"/>
				<include name="resources/**"/>
				<include name="lib/**"/>
				<include name="build.xml"/>
				<include name="build.bat"/>
				<include name="ChangeLog"/>
				<include name="LICENSE"/>
				<include name="README*"/>
				<include name="install.xml"/>
				<include name="readme.id"/>
				<include name="Jake2_Eclipse_Setup.txt"/>
			</tarfileset>
		</tar>
		<zip destfile="jake2src-${version}.zip">
			<zipfileset dir="." prefix="Jake2">
				<include name="src/jake2/**"/>
				<include name="resources/**"/>				
				<include name="scripts/*.*"/>
				<include name="lib/**"/>
				<include name="build.xml"/>
				<include name="build.sh"/>
				<include name="build.bat"/>
				<include name="ChangeLog"/>
				<include name="LICENSE"/>
				<include name="README*"/>
				<include name="install.xml"/>
				<include name="readme.id"/>
				<include name="Jake2_Eclipse_Setup.txt"/>
			</zipfileset>
		</zip>
	</target>
	
	<!-- standalone installer -->
	<target name="installer" depends="dist">
		<izpack input="${basedir}/install.xml"
        	output="${basedir}/Jake2-${version}-install.jar"
        	installerType="standard"
        	basedir="${dist}"
        	izPackDir="${basedir}/lib/izpack"/>
	</target>
	
	<!-- webstart -->
	<target name="webstart" depends="dist">
		<mkdir dir="webstart/lib"/>
		<copy todir="webstart/lib">
			<fileset dir="${dist}/lib">
				<include name="**/*.jar"/>
				<exclude name="jogl.jar"/>
				<exclude name="joal.jar"/>
				<exclude name="gluegen-rt.jar"/>
			</fileset>
		</copy>

		<mkdir dir="webstart/lib/linux"/>
		<jar destfile="webstart/lib/linux/lwjgl-native.jar" basedir="${dist}/lib/linux/lwjgl">
			<include name="*.so"/>
		</jar>
		<mkdir dir="webstart/lib/osx"/>
		<jar destfile="webstart/lib/osx/lwjgl-native.jar" basedir="${dist}/lib/osx/lwjgl">
			<include name="liblwjgl.jnilib"/>
			<include name="openal.dylib"/>
		</jar>
		<mkdir dir="webstart/lib/windows"/>
		<jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows/lwjgl">
			<include name="lwjgl.dll"/>
			<include name="OpenAL32.dll"/>
		</jar>
		<signjar keystore="${user.home}/bytonic" alias="bytonic" storepass="${bytonic.pass}">
			<fileset dir="webstart/lib">
				<include name="**/*.jar"/>
			</fileset>
		</signjar>
	</target>
	
	<!-- clean -->
	<target name="clean">
		<delete dir="${build}"/>
	</target>
	
	<!-- distclean -->
	<target name="distclean" depends="clean">
		<delete dir="${dist}"/>
		<delete dir="webstart/lib"/>
		<delete>
			<fileset dir=".">
				<include name="*.tar.gz"/>
				<include name="*.zip"/>
				<include name="*.map"/>
				<include name="*.jar"/>
			</fileset>
		</delete>
	</target>
</project>