Codebase list lwjgl / a5eff66 build.xml
a5eff66

Tree @a5eff66 (Download .tar.gz)

build.xml @a5eff66raw · history · blame

  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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
<project name="LWJGL" default="all" basedir=".">

	<property name="build.sysclasspath" value="last" />

	<import file="platform_build/build-definitions.xml"/>
	<import file="platform_build/build-generator.xml"/>
	<import file="platform_build/build-applet.xml"/>
	<import file="platform_build/build-webstart.xml"/>
	<import file="platform_build/build-maven.xml"/>
	<import file="eclipse-update/org.lwjgl.build/build-updatesite.xml"/>

	<!-- ================================================================== -->
	<!-- Everything below this line is targets.								-->
	<!-- Do not modify, unless you know what you're doing 					-->
	<!-- ================================================================== -->

	<!-- ================================================================== -->
	<!-- Initialize build			 										-->
	<!-- ================================================================== -->
	<target name="-initialize">
		<mkdir dir="${lwjgl.bin}"                   taskname="initialiazing bin folder" />
		<mkdir dir="${lwjgl.bin}/lwjgl"             taskname="initialiazing native bin folder" />
		<mkdir dir="${lwjgl.bin}/lwjgles"           taskname="initialiazing native OpenGL ES bin folder"/>
		<mkdir dir="${lwjgl.lib}"                   taskname="initialiazing lib folder" />
		<mkdir dir="${lwjgl.dist}"                  taskname="initialiazing dist folder" />
		<mkdir dir="${lwjgl.docs}/javadoc"          taskname="initialiazing docs folder" />
		<mkdir dir="${lwjgl.res}"                   taskname="initialiazing res folder" />
		<mkdir dir="${lwjgl.temp}"                  taskname="initialiazing temp folder" />
		<mkdir dir="${lwjgl.temp}/jar"              taskname="initialiazing temp/jar folder" />
		<mkdir dir="${lwjgl.temp}/doc"              taskname="initialiazing temp/doc folder" />
		<mkdir dir="${lwjgl.temp}/res"              taskname="initialiazing temp/res folder" />
		<mkdir dir="${lwjgl.temp}/native"           taskname="initialiazing temp/native folder" />
		<mkdir dir="${lwjgl.temp}/native/windows"   taskname="initialiazing temp/windows folder" />
		<mkdir dir="${lwjgl.temp}/native/linux"     taskname="initialiazing temp/linux folder" />
		<mkdir dir="${lwjgl.temp}/native/freebsd"   taskname="initialiazing temp/freebsd folder" />
		<mkdir dir="${lwjgl.temp}/native/openbsd"   taskname="initialiazing temp/openbsd folder" />
		<mkdir dir="${lwjgl.temp}/native/macosx"    taskname="initialiazing temp/macosx folder" />
		<mkdir dir="${lwjgl.temp}/native/solaris"   taskname="initialiazing temp/solaris folder" />
	</target>

	<!-- Cleans up any files created during the execution of this script -->
	<target name="clean" description="Cleans all directories controlled by this ant script" depends="clean-java, clean-native"/>

    <!-- Cleans up any non-native files created during the execution of this script -->
    <target name="clean-java" description="Cleans non-native files generated by this ant script" depends="clean-generated">
        <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
        <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
        <!-- Delete java classes only to avoid unnecessary native recompilation -->
        <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
    </target>

    <!-- Useful when we need to force native recompilation -->
    <target name="clean-native" description="Cleans native files generated by this ant script" depends="clean-generated-native">
        <delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
	    <delete dir="${lwjgl.bin}/lwjgles" quiet="true" failonerror="false" taskname="cleaning native OpenGL ES bin folder"/>
    </target>

	<!-- Creates a distribution of LWJGL -->
	<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
		<!-- Warn user -->
        <echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux, ${lwjgl.lib}/freebsd and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
        <input
            message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
            validargs="yes,no"
            addproperty="do.delete"
        />
        <condition property="do.abort">
            <equals arg1="no" arg2="${do.delete}"/>
        </condition>
        <fail if="do.abort">Build aborted by user.</fail>

        <!-- prepare -->
        <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
        <antcall target="clean-java" />
        <antcall target="-initialize" />

        <!-- compile and create debug jars -->
        <antcall target="generate-debug" />
        <antcall target="compile" />
        <antcall target="-createdebugjars" />

		<!-- Generator will skip all templates if we don't clean -->
		<delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />

        <!-- compile and create jars -->
        <antcall target="generate-all" />
        <antcall target="compile" />
        <antcall target="-createjars" />

        <antcall target="-jars_NoDEP" />
        <antcall target="javadoc" />
        <antcall target="applet-release" />

        <!-- copy resources to res folder -->
        <copy todir="${lwjgl.temp}/res">
            <fileset dir="res"/>
        </copy>

  	    <!-- copy docs -->
 		<copy todir="${lwjgl.temp}/doc">
    	<fileset dir="${lwjgl.docs}">
    		<patternset refid="lwjgl-docs.fileset" />
    	</fileset>
      	</copy>

		<!-- create distribution from files in libs/ and temp/ -->
		<antcall target="-distribution_javadoc" />
		<antcall target="-distribution_source" />
		<antcall target="-distribute" />
	</target>

	<target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/>

	<!-- Create ONLY the jar archives -->
	<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars">
		<antcall target="-jars_NoDEP" />
	</target>

	<!-- Create ONLY the jar archives for the ES build -->
	<target name="jars_es" description="Creates the Java archives ONLY for the ES build and places them in libs/"
	        depends="-initialize, generate-all, compile, -createjars_es">
		<antcall target="-jars_NoDEP"/>
	</target>

	<target name="-jars_NoDEP">
		<move todir="libs/">
			<fileset dir="${lwjgl.temp}/jar">
				<include name="*.jar"/>
			</fileset>
		</move>
	</target>

	<!-- Packages the java files -->
	<target name="-createdebugjars">
		<!-- Create lwjgl.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar">
			<fileset refid="lwjgl.fileset" />
			<fileset refid="lwjgl.fileset.dependencies"/>
			<manifest>
				<attribute name="Sealed" value="true"/>
			</manifest>
		</jar>
	</target>

	<!-- Packages the java files -->
	<target name="-createjars">
		<!-- Create lwjgl.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar">
			<fileset refid="lwjgl.fileset" />
			<fileset refid="lwjgl.fileset.dependencies"/>
			<manifest>
				<attribute name="Sealed" value="true"/>
			</manifest>
		</jar>

		<!-- Create lwjgl_util_applet.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar">
			<fileset dir="${lwjgl.res}" includes="applet*"/>
			<fileset refid="lwjgl_util_applet.fileset" />
			<manifest>
				<attribute name="Sealed" value="true"/>
				<attribute name="Trusted-Library" value="true"/>
				<attribute name="Permissions" value="all-permissions"/>
				<attribute name="Codebase" value="*"/>
				<attribute name="Caller-Allowable-Codebase" value="*"/>
				<attribute name="Application-Library-Allowable-Codebase" value="*"/>
			</manifest>
		</jar>

		<!-- Create lwjgl_test.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
			<fileset refid="lwjgl_test.fileset" />
			<fileset refid="lwjgl_test_extra.fileset" />
		</jar>

		<!-- Create lwjgl_util.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl_util.jar" taskname="lwjgl_util.jar">
			<fileset refid="lwjgl_util.fileset" />
		</jar>
	</target>

	<!-- Packages the java files for the ES build -->
	<target name="-createjars_es">
		<!-- ================================================================== -->
		<!-- Generate a list of the OpenGL extension classes					-->
		<!-- ================================================================== -->
		<fileset id="opengl-template-fileset" dir="${lwjgl.src}/generated/org/lwjgl/opengl" includes="${opengl-template-pattern}"/>
		<property name="opengl-template-files" refid="opengl-template-fileset"/>

		<tempfile property="temp.file"/>
		<echo file="${temp.file}" message="${opengl-template-files}" taskname=""/>

		<loadfile srcfile="${temp.file}" property="opengl-template-classes">
			<filterchain>
				<tokenfilter delimoutput=",">
					<stringtokenizer delims=";"/>
					<replaceregex pattern="(.+)[.]java"
					              replace="org/lwjgl/opengl/\1.class"/>
				</tokenfilter>
			</filterchain>
		</loadfile>

		<delete file="${temp.file}" />

		<!-- Create lwjgl.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar">
			<!-- Files to include in the lwjgl.jar file, for the ES build -->
			<fileset dir="${lwjgl.bin}" excludes="${opengl-template-classes}">
				<patternset id="lwjgl_es.package.pattern">
					<include name="org/**/*"/>
					<exclude name="org/lwjgl/d3d/**"/>
					<exclude name="org/lwjgl/test/**"/>
					<exclude name="org/lwjgl/util/**"/>
					<exclude name="org/lwjgl/examples/**"/>
				</patternset>
			</fileset>

			<manifest>
				<attribute name="Sealed" value="true"/>
			</manifest>
		</jar>

		<!-- Create lwjgl_test.jar -->
		<jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
			<fileset refid="lwjgl_test_es.fileset"/>
		</jar>
	</target>

	<!-- Distributes files  -->
	<target name="-distribute">
		<delete>
			<fileset dir="${lwjgl.temp}/native/" includes="**/*"/>
		</delete>

		<copy todir="${lwjgl.temp}/jar">
			<fileset dir="${lwjgl.lib}/" includes="*.jar"/>
		</copy>
		<copy todir="${lwjgl.temp}/native/windows">
			<fileset dir="${lwjgl.lib}/windows">
				<patternset refid="lwjgl-windows.fileset" />
			</fileset>
		</copy>
		<copy todir="${lwjgl.temp}/native/linux">
			<fileset dir="${lwjgl.lib}/linux">
				<patternset refid="lwjgl-linux.fileset" />
			</fileset>
		</copy>
		<copy todir="${lwjgl.temp}/native/freebsd" failonerror="false">
			<fileset dir="${lwjgl.lib}/freebsd">
				<patternset refid="lwjgl-freebsd.fileset" />
			</fileset>
		</copy>
		<copy todir="${lwjgl.temp}/native/openbsd" failonerror="false">
			<fileset dir="${lwjgl.lib}/openbsd">
				<patternset refid="lwjgl-openbsd.fileset" />
			</fileset>
		</copy>
		<copy todir="${lwjgl.temp}/native/macosx">
			<fileset dir="${lwjgl.lib}/macosx">
				<patternset refid="lwjgl-macosx.fileset" />
			</fileset>
		</copy>
		<copy todir="${lwjgl.temp}/native/solaris">
			<fileset dir="${lwjgl.lib}/solaris">
				<patternset refid="lwjgl-solaris.fileset" />
			</fileset>
		</copy>

		<!-- create base package -->
		<zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip">
			<zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/">
				<patternset refid="lwjgl_base"/>
			</zipfileset>
		</zip>

		<!-- create applet package -->
		<zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip">
			<zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/">
				<patternset refid="lwjgl_applet"/>
			</zipfileset>
		</zip>
	</target>

	<!-- Creates a versioned distribution of javadocs -->
	<target name="-distribution_javadoc">
		<zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" />
	</target>

	<!-- Creates a versioned distribution of the source code -->
	<target name="-distribution_source">
		<zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip">
			<fileset refid="lwjgl.source.fileset" />
		</zip>
	</target>

	<!-- Generates the native headers from source files -->
	<target name="headers" description="invokes javah on java classes" depends="compile">
		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux">
			<class name="org.lwjgl.LinuxSysImplementation" />
			<class name="org.lwjgl.opengl.LinuxEvent" />
			<class name="org.lwjgl.opengl.LinuxMouse" />
			<class name="org.lwjgl.opengl.LinuxKeyboard" />
			<class name="org.lwjgl.opengl.LinuxDisplay" />
			<class name="org.lwjgl.opengl.LinuxPeerInfo" />
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux/opengl">
			<class name="org.lwjgl.opengl.LinuxPbufferPeerInfo"/>
			<class name="org.lwjgl.opengl.LinuxDisplayPeerInfo"/>
			<class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo"/>
			<class name="org.lwjgl.opengl.LinuxContextImplementation"/>
			<class name="org.lwjgl.opengl.LinuxCanvasImplementation"/>
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows">
			<class name="org.lwjgl.WindowsSysImplementation"/>
			<class name="org.lwjgl.opengl.WindowsKeyboard" />
			<class name="org.lwjgl.opengl.WindowsRegistry" />
			<class name="org.lwjgl.opengl.WindowsDisplay"/>
			<class name="org.lwjgl.opengl.WindowsDisplayPeerInfo"/>
			<class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo"/>
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows/opengl">
			<class name="org.lwjgl.opengl.WindowsPbufferPeerInfo"/>
			<class name="org.lwjgl.opengl.WindowsPeerInfo"/>
			<class name="org.lwjgl.opengl.WindowsContextImplementation"/>
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows/opengles">
			<class name="org.lwjgl.opengl.WindowsPeerInfo"/>
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx">
			<class name="org.lwjgl.MacOSXSysImplementation" />
			<class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" />
			<class name="org.lwjgl.opengl.MacOSXPeerInfo" />
			<class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" />
			<class name="org.lwjgl.opengl.MacOSXDisplay" />
			<class name="org.lwjgl.opengl.MacOSXContextImplementation" />
			<class name="org.lwjgl.opengl.MacOSXNativeKeyboard" />
			<class name="org.lwjgl.opengl.MacOSXNativeMouse" />
			<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}">
			<class name="org.lwjgl.opengl.AWTSurfaceLock" />
			<class name="org.lwjgl.DefaultSysImplementation" />
			<class name="org.lwjgl.input.Cursor" />
			<class name="org.lwjgl.input.Keyboard" />
			<class name="org.lwjgl.input.Mouse" />
			<class name="org.lwjgl.openal.AL" />
			<class name="org.lwjgl.opencl.CL" />
            <class name="org.lwjgl.opencl.CallbackUtil" />
            <class name="org.lwjgl.BufferUtils" />
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/opengl">
			<class name="org.lwjgl.opengl.GLContext"/>
			<class name="org.lwjgl.opengl.Pbuffer"/>
			<class name="org.lwjgl.opengl.CallbackUtil"/>
			<class name="org.lwjgl.opengl.NVPresentVideoUtil"/>
			<class name="org.lwjgl.opengl.NVVideoCaptureUtil"/>
		</javah>

		<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/opengles">
			<class name="org.lwjgl.opengles.EGL"/>
			<class name="org.lwjgl.opengles.EGLKHRFenceSync"/>
			<class name="org.lwjgl.opengles.EGLKHRReusableSync"/>
			<class name="org.lwjgl.opengles.EGLNVSync"/>
			<class name="org.lwjgl.opengles.GLContext"/>
			<class name="org.lwjgl.opengles.CallbackUtil"/>
		</javah>
	</target>

	<target name="touch-version">
		<touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/>
		<touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/>
		<touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/>
	</target>

	<target name="version-mismatch">
		<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version">
			<filterchain>
				<tokenfilter>
	    		<containsstring contains="JNI_VERSION ="/>
				</tokenfilter>
			</filterchain>
		</loadfile>
		<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/LinuxSysImplementation.java" property="lwjgl.java.linux.version">
			<filterchain>
				<tokenfilter>
	    		<containsstring contains="JNI_VERSION ="/>
				</tokenfilter>
			</filterchain>
		</loadfile>
		<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version">
			<filterchain>
				<tokenfilter>
	    		<containsstring contains="JNI_VERSION ="/>
				</tokenfilter>
			</filterchain>
		</loadfile>
		<loadfile srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version">
			<filterchain>
				<tokenfilter>
	    		<containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/>
				</tokenfilter>
			</filterchain>
		</loadfile>
		<loadfile srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version">
			<filterchain>
				<tokenfilter>
	    		<containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
				</tokenfilter>
			</filterchain>
		</loadfile>
		<loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
			<filterchain>
				<tokenfilter>
	    		<containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/>
				</tokenfilter>
			</filterchain>
		</loadfile>
		<echo>
			lwjgl.java.windows.version = ${lwjgl.java.windows.version}
			lwjgl.native.windows.version = ${lwjgl.native.windows.version}
			lwjgl.java.linux.version = ${lwjgl.java.linux.version}
			lwjgl.native.linux.version = ${lwjgl.native.linux.version}
			lwjgl.java.freebsd.version = ${lwjgl.java.linux.version}
			lwjgl.native.freebsd.version = ${lwjgl.native.linux.version}
			lwjgl.java.openbsd.version = ${lwjgl.java.linux.version}
			lwjgl.native.openbsd.version = ${lwjgl.native.linux.version}
			lwjgl.java.macosx.version = ${lwjgl.java.macosx.version}
			lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
		</echo>
	</target>

	<macrodef name="version-check">
	  <attribute name="platform"/>
	  <sequential>
			<java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true">
				<jvmarg value="-Djava.library.path=libs/@{platform}"/>
                <jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
	    	<classpath>
	      	<pathelement path="${lwjgl.bin}"/>
	        <pathelement path="${java.class.path}"/>
	      </classpath>
	    </java>

	    <fail message="Unable to load native library: ${nativetest.err}">
	     <condition>
	       <not>
	         <equals arg1="OK" arg2="${nativetest.out}"/>
	       </not>
	     </condition>
	   </fail>

	   <echo message="Successfully executed NativeTest"/>
		</sequential>
	</macrodef>

	<!-- Compiles the Java source code -->
	<target name="compile" description="Compiles the java source code" depends="-initialize">
		<javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" taskname="core">
            <!--<compilerarg value="-Xlint:unchecked"/>-->
			<src path="${lwjgl.src}/java/"/>
			<src path="${lwjgl.src}/generated/"/>
			<include name="org/lwjgl/*.java"/>
			<include name="org/lwjgl/input/**"/>
			<include name="org/lwjgl/opengl/**"/>
			<include name="org/lwjgl/opengles/**"/>
			<include name="org/lwjgl/openal/**"/>
            <include name="org/lwjgl/opencl/**"/>
			<include name="org/lwjgl/util/**"/>
			<exclude name="org/lwjgl/util/generator/**"/>
		</javac>
		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5" target="1.5" taskname="test" />
		<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.5" target="1.5" taskname="examples" />
	</target>

	<target name="compile_native" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
		<condition property="lwjgl.platform.windows">
			<os family="windows" />
		</condition>
		<antcall target="-compile_native_win32" />

		<condition property="lwjgl.platform.linux">
			<os name="Linux" />
		</condition>
		<antcall target="-compile_native_linux" />

		<condition property="lwjgl.platform.freebsd">
			<os name="FreeBSD" />
		</condition>
		<antcall target="-compile_native_freebsd" />

		<condition property="lwjgl.platform.openbsd">
			<os name="OpenBSD" />
		</condition>
		<antcall target="-compile_native_openbsd" />

		<condition property="lwjgl.platform.solaris">
			<os name="SunOS" />
		</condition>
		<antcall target="-compile_native_solaris" />

		<condition property="lwjgl.platform.macosx">
			<os name="Mac OS X" />
		</condition>
		<antcall target="-compile_native_macosx" />
	</target>

	<!-- Compiles LWJGL on Win32 platforms  -->
	<target name="-compile_native_win32" if="lwjgl.platform.windows">
		<ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/windows">
			<fileset dir="${lwjgl.bin}/lwjgl" includes="lwjgl*.dll"/>
		</copy>
		<version-check platform="windows"/>
	</target>

	<!-- Compiles LWJGL on Linux platforms -->
	<target name="-compile_native_linux" if="lwjgl.platform.linux">
		<ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/linux">
			<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
		</copy>
		<!-- headless issues <version-check platform="linux"/> -->
	</target>

	<!-- Compiles LWJGL on FreeBSD platforms -->
	<target name="-compile_native_freebsd" if="lwjgl.platform.freebsd">
		<ant antfile="platform_build/bsd_ant/build.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/freebsd">
			<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
		</copy>
	</target>

	<!-- Compiles LWJGL on OpenBSD platforms -->
	<target name="-compile_native_openbsd" if="lwjgl.platform.openbsd">
		<ant antfile="platform_build/bsd_ant/build.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/openbsd">
			<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
		</copy>
	</target>


	<!-- Compiles LWJGL on solaris platforms -->
	<target name="-compile_native_solaris" if="lwjgl.platform.solaris">
		<!-- Reusing the linux ant task, but copy the output to solaris -->
		<ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/solaris">
			<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
		</copy>
		<version-check platform="solaris"/>
	</target>

	<!-- Compiles LWJGL on Mac platforms -->
	<target name="-compile_native_macosx" if="lwjgl.platform.macosx">
		<ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/>
		<copy file="${lwjgl.bin}/lwjgl/liblwjgl.dylib" todir="${lwjgl.lib}/macosx"/>
		<version-check platform="macosx"/>
	</target>

	<target name="compile_native_es" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
		<condition property="lwjgl.platform.windows">
			<os family="windows"/>
		</condition>
		<antcall target="-compile_native_win32_es"/>

		<condition property="lwjgl.platform.linux">
			<os name="Linux"/>
		</condition>
		<antcall target="-compile_native_linux_es"/>
	</target>

	<!-- Compiles LWJGL ES on Win32 platforms  -->
	<target name="-compile_native_win32_es" if="lwjgl.platform.windows">
		<ant antfile="platform_build/windows_ant/build_es.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/windows">
			<fileset dir="${lwjgl.bin}/lwjgles" includes="lwjgl*.dll"/>
		</copy>
	</target>

	<!-- Compiles LWJGL ES on Linux platforms -->
	<target name="-compile_native_linux_es" if="lwjgl.platform.linux">
		<ant antfile="platform_build/linux_ant/build_es.xml" inheritAll="false"/>
		<copy todir="${lwjgl.lib}/linux">
			<fileset dir="${lwjgl.bin}/lwjgles" includes="liblwjgl*.so"/>
		</copy>
	</target>

	<target name="repack200" description="Pack200-repack a jar file">
		<pack200 src="${input}" destfile="${output}" repack="true"/>
	</target>

	<target name="pack200" description="Pack200 a jar file">
     <pack200 src="${input}" destfile="${output}"/>
	</target>

	<target name="lzma" description="LZMA compress a file">
  	<java fork="true" classname="SevenZip.LzmaAlone">
			<classpath>
      	<pathelement location="platform_build/JLzma.jar"/>
      </classpath>
      <jvmarg value="-Xmx512m"/>
    	<arg value="e"/>
    	<arg value="${input}"/>
    	<arg value="${output}"/>
   	</java>
	</target>

	<target name="compress-sign-class">
		<antcall target="repack200">
			<param name="input" value="${dir}${jarfile}.jar"/>
			<param name="output" value="${dir}${jarfile}-repack.jar"/>
		</antcall>
		<signjar jar="${dir}${jarfile}-repack.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
		<antcall target="pack200">
			<param name="input" value="${dir}${jarfile}-repack.jar"/>
			<param name="output" value="${dir}${jarfile}.jar.pack"/>
		</antcall>
		<antcall target="lzma">
			<param name="input" value="${dir}${jarfile}.jar.pack"/>
			<param name="output" value="${outputdir}${jarfile}.jar.pack.lzma"/>
		</antcall>
		<!--delete file="${dir}${jarfile}-repack.jar"/-->
		<delete file="${dir}${jarfile}.jar.pack"/>
		<!--delete file="${dir}${jarfile}.jar"/-->
		<rename src="${dir}${jarfile}-repack.jar" dest="${dir}${jarfile}.jar" replace="yes"/>
	</target>

	<target name="compress-resource">
		<antcall target="lzma">
			<param name="input" value="${input}"/>
			<param name="output" value="${output}"/>
		</antcall>
	</target>

	<target name="applettest" depends="applet">
		<exec executable="appletviewer">
			<arg value="-J-Djava.security.policy=applet/appletviewer.policy"/>
			<arg path="applet/applet.html"/>
		</exec>
	</target>

	<target name="runtest" depends="all">
		<fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=&lt;main-class&gt; runtest'" unless="test.mainclass"/>
		<condition property="native_path" value="libs/windows">
			<os family="windows" />
		</condition>

		<condition property="native_path" value="libs/linux">
			<or>
				<os name="Linux" />
				<os name="SunOS" />
			</or>
		</condition>

		<condition property="native_path" value="libs/macosx">
			<os name="Mac OS X" />
		</condition>
		<property name="native_path_expanded" location="${native_path}"/>
		<java classname="${test.mainclass}" classpath="res:${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true">
			<sysproperty key="org.lwjgl.util.Debug" value="true"/>
			<sysproperty key="java.library.path" value="${native_path_expanded}"/>
			<arg line="${args}"/>
		</java>
	</target>

	<!-- Creates the Javadoc -->
	<target name="javadoc" description="Creates javadoc from java source code">
		<javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
			<fileset refid="lwjgl.javadoc.fileset" />
			<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
			<bottom><![CDATA[<i>Copyright &#169; 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom>
		</javadoc>
	</target>

	<!-- get and copy nightly binaries into libs folder -->
	<target name="copy-nightly-binaries" depends="-initialize" description="Copies latest successful nightly binaries into appropriate libs folder">
		<delete file="${lwjgl.temp}/lwjgl-${lwjgl.version}.zip" failonerror="false"/>
		<get src="http://ci.newdawnsoftware.com/job/LWJGL-git-dist/lastBuild/artifact/dist/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}" verbose="true"/>
		<unzip src="${lwjgl.temp}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.lib}" overwrite="true">
		 	<patternset>
				<include name="**/native/**/*lwjgl*"/>
			</patternset>
			<globmapper from="lwjgl-${lwjgl.version}/native/*" to="*"/>
		</unzip>
	</target>
</project>