/
build.xml
executable file
·1121 lines (914 loc) · 39.4 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
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
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<project name="Processing" default="build">
<!-- Sets properties for macosx/windows/linux depending on current system -->
<condition property="platform" value="macosx">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<condition property="platform" value="linux">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
<!-- Require Java 7 to bootstrap, otherwise there will be sadness.
Java 1.8 caused build problems (with ECJ?) so not supported. -->
<fail message="Unsupported Java version: ${java.version}. Make sure that Java 7 (aka Java 1.7) is installed.">
<condition>
<not>
<or>
<contains string="${java.version}" substring="1.7" />
</or>
</not>
</condition>
</fail>
<property name="examples.dir"
value="../../processing-docs/content/examples" />
<property name="jdk.version" value="7" />
<property name="jdk.update" value="72" />
<property name="jdk.build" value="14" />
<property name="jdk.stuff" value="${jdk.version}u${jdk.update}" />
<property name="jdk.esoteric" value="1.${jdk.version}.0_${jdk.update}" />
<!-- Figure out the JRE download location for Linux and Windows. -->
<condition property="jre.file"
value="jre-${jdk.stuff}-${platform}-i586.tar.gz">
<equals arg1="${sun.arch.data.model}" arg2="32" />
</condition>
<condition property="jre.file"
value="jre-${jdk.stuff}-${platform}-x64.tar.gz">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<!-- JDK location for Mac OS X -->
<condition property="jdk.file" value="jdk-${jdk.stuff}-macosx-x64.dmg">
<equals arg1="${platform}" arg2="macosx" />
</condition>
<fileset dir="windows/work/java" id="jre-optional-windows">
<include name="bin/dtplugin" />
<include name="bin/plugin2" />
<include name="bin/kinit.exe" />
<include name="bin/klist.exe" />
<include name="bin/ktab.exe" />
<!--<include name="bin/keytool" />-->
<include name="bin/orbd" />
<include name="bin/policytool" />
<include name="bin/rmid" />
<include name="bin/rmiregistry" />
<include name="bin/servertool" />
<include name="bin/tnameserv" />
<include name="bin/javaws.exe" />
<include name="lib/javaws.jar" />
<include name="lib/ext/dnsns.jar" />
<include name="lib/cmm/PYCC.pf" />
</fileset>
<fileset dir="linux/work/java" id="jre-optional-linux">
<!--<include name="bin/keytool" />-->
<include name="bin/orbd" />
<include name="bin/policytool" />
<include name="bin/rmid" />
<include name="bin/rmiregistry" />
<include name="bin/servertool" />
<include name="bin/tnameserv" />
<include name="bin/javaws" />
<include name="lib/javaws.jar" />
<include name="lib/ext/dnsns.jar" />
<include name="lib/cmm/PYCC.pf" />
</fileset>
<!-- Unused JavaFX files that can be removed from the JRE on Windows
and Linux. On Mac OS X, this is removed by the appbundler task.
www.oracle.com/technetwork/java/javase/jdk-7-readme-429198.html -->
<!-- There might be others, based on what was in the Java 6 docs,
but that info isn't part of the Java 7 instructions.
http://www.oracle.com/technetwork/java/javase/jrereadme-182762.html -->
<fileset dir="${platform}/work/java" id="javafx-basics">
<include name="THIRDPARTYLICENSEREADME-JAVAFX.txt" />
<include name="lib/javafx.properties" />
<include name="lib/jfxrt.jar" />
<include name="lib/security/javafx.policy" />
</fileset>
<fileset dir="windows/work/java" id="javafx-windows">
<include name="bin/decora-sse.dll" />
<include name="bin/fxplugins.dll" />
<include name="bin/glass.dll" />
<include name="bin/glib-lite.dll" />
<include name="bin/gstreamer-lite.dll" />
<include name="bin/javafx-font.dll" />
<include name="bin/javafx-iio.dll" />
<include name="bin/jfxmedia.dll" />
<include name="bin/jfxwebkit.dll" />
<include name="bin/libxml2.dll" />
<include name="bin/libxslt.dll" />
</fileset>
<fileset dir="linux/work/java" id="javafx-linux-32">
<include name="lib/i386/fxavcodecplugin-52.so" />
<include name="lib/i386/fxavcodecplugin-53.so" />
<include name="lib/i386/fxplugins.so" />
<include name="lib/i386/libglass.so" />
<include name="lib/i386/libgstplugins-lite.so" />
<include name="lib/i386/libgstreamer-lite.so" />
<include name="lib/i386/libjavafx-font.so" />
<include name="lib/i386/libjavafx-iio.so" />
<include name="lib/i386/libjfxmedia.so" />
<include name="lib/i386/libjfxwebkit.so" />
<include name="lib/i386/libprism-es2.so" />
</fileset>
<fileset dir="linux/work/java" id="javafx-linux-64">
<include name="lib/amd64/fxavcodecplugin-52.so" />
<include name="lib/amd64/fxavcodecplugin-53.so" />
<include name="lib/amd64/fxplugins.so" />
<include name="lib/amd64/libglass.so" />
<include name="lib/amd64/libgstplugins-lite.so" />
<include name="lib/amd64/libgstreamer-lite.so" />
<include name="lib/amd64/libjavafx-font.so" />
<include name="lib/amd64/libjavafx-iio.so" />
<include name="lib/amd64/libjfxmedia.so" />
<include name="lib/amd64/libjfxwebkit.so" />
<include name="lib/amd64/libprism-es2.so" />
</fileset>
<!--
<echo message="${java.class.path}" />
-->
<!-- Set a property named macosx, linux, or windows.
The 'value' chosen is arbitrary. -->
<property name="${platform}" value="${platform}" />
<property environment="env" />
<!-- code signing hack, turns on code signing during dist -->
<condition property="codesign">
<equals arg1="${env.USER}" arg2="fry" />
</condition>
<!-- Set the version of Java that must be present to build. -->
<property name="jdk.path.macosx"
value="/Library/Java/JavaVirtualMachines/jdk${jdk.esoteric}.jdk" />
<available file="${jdk.path.macosx}" property="macosx_jdk_found" />
<fail if="macosx" unless="macosx_jdk_found"
message="JDK ${jdk.stuff} required.${line.separator}To build on OS X, you must install Oracle's JDK ${jdk.stuff} from${line.separator}http://www.oracle.com/technetwork/java/javase/downloads${line.separator}or http://download.processing.org/java/${jdk.file}${line.separator}Note that only ${jdk.stuff} (not a later or earlier version) will work. ${line.separator}And it must be the JDK, not the JRE. And do not try to defy me again." />
<!--
<fail if="linux" unless="java_tools_found"
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Ubuntu Linux, this might be /usr/lib/jvm/java-6-sun." />
-->
<!-- Figure out the platform-specific output directory for all this work. -->
<condition property="target.path"
value="macosx/work/Processing.app/Contents/Java">
<os family="mac" />
</condition>
<condition property="target.path" value="linux/work">
<os family="unix" />
</condition>
<condition property="target.path" value="windows/work">
<os family="windows" />
</condition>
<!-- Libraries required for running processing -->
<!-- also need to copy these to the bundleapp task for macosx -->
<fileset dir=".." id="runtime.jars">
<include name="app/pde.jar" />
<include name="app/lib/antlr.jar" />
<include name="app/lib/jna.jar" />
<include name="app/lib/ant.jar" />
<include name="app/lib/ant-launcher.jar" />
<include name="app/lib/org-netbeans-swing-outline.jar" />
<include name="app/lib/jdi.jar" />
<include name="app/lib/jdimodel.jar" />
<include name="app/lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar" />
<include name="app/lib/com.ibm.icu_4.4.2.v20110823.jar" />
</fileset>
<target name="build" description="Build Processing.">
<antcall target="${platform}-build" />
</target>
<target name="run" description="Run Processing.">
<antcall target="${platform}-run" />
</target>
<target name="dist" depends="revision-check"
description="Build Processing for distribution.">
<input message="Enter version number:"
addproperty="version"
defaultvalue="${revision}" />
<available file="${examples.dir}" property="examples.exist" />
<fail unless="examples.exist" message="To do a distribution, the processing-docs repo must be checked out at the same level as the processing repo." />
<antcall target="${platform}-dist" />
</target>
<!-- "§$§$&, ant doesn't have a built-in help target :( -->
<target name="help" description="Show project help">
<java classname="org.apache.tools.ant.Main">
<arg value="-p" />
</java>
</target>
<!-- - - - - - - - - - - - - - - - - - -->
<!-- Subprojects: Core, App, Libraries -->
<!-- - - - - - - - - - - - - - - - - - -->
<target name="subprojects-clean">
<subant buildpath="../core" target="clean"/>
<subant buildpath="../app" target="clean"/>
<subant buildpath="../java/libraries/dxf" target="clean"/>
<subant buildpath="../java/libraries/net" target="clean"/>
<subant buildpath="../java/libraries/pdf" target="clean"/>
<subant buildpath="../java/libraries/serial" target="clean"/>
<subant buildpath="shared/tools/MovieMaker" target="clean"/>
<subant buildpath="../pdex" target="clean"/>
<!-- make sure this isn't around from an old build 140730 -->
<delete dir="../java/examples" />
</target>
<target name="subprojects-build">
<subant buildpath="../core" target="build"/>
<subant buildpath="../app" target="build"/>
<subant buildpath="../java/libraries/dxf" target="build"/>
<subant buildpath="../java/libraries/net" target="build"/>
<subant buildpath="../java/libraries/pdf" target="build"/>
<subant buildpath="../java/libraries/serial" target="build"/>
<subant buildpath="shared/tools/MovieMaker" target="build"/>
<subant buildpath="../pdex" target="package"/>
</target>
<!-- - - - - - - - - -->
<!-- Basic Assembly -->
<!-- - - - - - - - - -->
<target name="assemble" depends="version-clear, version-write">
<fail unless="target.path"
message="Do not call assemble from the command line." />
<!-- copy shared tools folder -->
<copy todir="${target.path}/tools">
<fileset dir="shared/tools" />
</copy>
<copy todir="${target.path}/modes/java">
<fileset dir="../java">
<!-- don't include LWJGL, it's not operational -->
<exclude name="libraries/lwjgl/**" />
<exclude name="reference.zip" />
<exclude name="**/._*" />
</fileset>
</copy>
<!-- get the examples folder, but don't require it to buid -->
<copy todir="${target.path}/modes/java/examples" failonerror="false">
<fileset dir="${examples.dir}" />
</copy>
<unzip dest="${target.path}/modes/java"
src="../java/reference.zip"
overwrite="false">
<patternset>
<exclude name="__MACOSX/**" />
<exclude name="**/._*" />
</patternset>
</unzip>
<!-- copy PDE X mode folder-->
<copy todir="${target.path}/modes/">
<fileset dir="../pdex/dist" />
</copy>
</target>
<target name="version-clear">
<delete file="${target.path}/lib/version.txt" />
</target>
<target name="version-write" if="version">
<echo file="${target.path}/lib/version.txt" message="${version}"/>
</target>
<!-- - - - - - - - - -->
<!-- Revision check -->
<!-- - - - - - - - - -->
<target name="revision-check">
<!-- figure out the revision number -->
<loadfile srcfile="../todo.txt" property="revision">
<filterchain>
<headfilter lines="1"/>
<tokenfilter>
<stringtokenizer suppressdelims="true"/>
<!-- grab the thing from the first line that's 4 digits -->
<containsregex pattern="(\d\d\d\d)" />
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="revision is ${revision}." /> -->
<!-- figure out the revision number in base.java -->
<loadfile srcfile="../app/src/processing/app/Base.java"
property="revision.base">
<filterchain>
<tokenfilter>
<linetokenizer />
<containsregex pattern="String VERSION_NAME = "/>
<replaceregex pattern="[^0-9]*" flags="g" replace=""/>
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="base revision is ${revision.base}." /> -->
<condition property="revision.correct">
<!-- Using contains because I can't figure out how to get rid of the
LF in revision.base. Please file a bug if you have a fix. -->
<contains string="${revision.base}" substring="${revision}"/>
</condition>
<!-- the revision.base property won't be set
if $revision wasn't found... -->
<fail unless="revision.correct"
message="Fix revision number in Base.java" />
</target>
<!-- - - - - - - - -->
<!-- Mac OS X -->
<!-- - - - - - - - -->
<target name="macosx-clean" depends="subprojects-clean" description="Clean Mac OS X build">
<delete dir="macosx/work" />
<delete file="macosx/processing-*.dmg" />
</target>
<target name="macosx-checkos" unless="macosx">
<echo>
=======================================================
Processing for Mac OS X can only be built on Mac OS X.
Bye.
=======================================================
</echo>
<fail message="wrong platform (${os.name})" />
</target>
<target name="macosx-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
<mkdir dir="macosx/work" />
<!-- app bundler for OS X and Java 1.7 -->
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="macosx/appbundler.jar" />
<!--icon="macosx/processing.icns"-->
<bundleapp outputDirectory="macosx/work"
name="Processing"
displayName="Processing"
executableName="Processing"
identifier="org.processing.app"
signature="Pde2"
icon="macosx/processing.icns"
copyright="© The Processing Foundation"
getInfo="${version}, Copyright © The Processing Foundation"
shortVersion="${version}"
version="${revision}"
mainClassName="processing.app.Base">
<!-- The appbundler task needs a couple files (the Info.plist and
anything else outside /jre) from the full JDK, even though
it's primarily copying over the JRE folder. -->
<runtime dir="${jdk.path.macosx}/Contents/Home" />
<!-- Eventually we'll want to load the JRE directly from
the .tgz on the Oracle site, though it's in a folder called
jre1.7.0_40.jre, so we'll need to strip that out. -->
<!-- Same as runtime.jars, seen above; plus core.jar. -->
<classpath file="../app/pde.jar" />
<classpath file="../app/lib/antlr.jar" />
<classpath file="../app/lib/jna.jar" />
<classpath file="../app/lib/ant.jar" />
<classpath file="../app/lib/ant-launcher.jar" />
<classpath file="../app/lib/org-netbeans-swing-outline.jar" />
<classpath file="../app/lib/jdi.jar" />
<classpath file="../app/lib/jdimodel.jar" />
<classpath file="../app/lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar" />
<classpath file="../app/lib/com.ibm.icu_4.4.2.v20110823.jar" />
<!-- plus core.jar... note that this is no longer shared -->
<classpath file="../core/library/core.jar" />
<arch name="x86_64"/>
<!-- no support for this with Java 7 from Oracle -->
<!--<arch name="i386"/>-->
<!--icon="macosx/template.app/Contents/Resources/pde.icns"-->
<!--icon="${bundle.icon}"-->
<bundledocument extensions="pde"
icon="macosx/pde.icns"
name="Processing Source Code"
role="Editor">
</bundledocument>
<!-- Sets dock icon when debugging (not launched via launch svcs) -->
<option value="-Xdock:icon=Contents/Resources/processing.icns" />
<!-- Don't think these actually make any difference. -->
<!--
<option value="-Xdock:name=Processing" />
-->
<!-- Probably no longer needed? [fry 130917]
<option value="-Xms128M" />
-->
<!-- returning 140606 per PDE X request -->
<option value="-Xmx256M" />
<option value="-Dapple.awt.application.name=Processing" />
<!-- avoid conflicts with JNA DLLs already in the path -->
<option value="-Djna.nosys=true" />
<option value="-Dapple.laf.useScreenMenuBar=true" />
<option value="-Dcom.apple.macos.use-file-dialog-packages=true" />
<option value="-Dcom.apple.macos.useScreenMenuBar=true" />
<option value="-Dcom.apple.smallTabs=true" />
<!--
the old options; most of these are probably no longer useful
<key>apple.laf.useScreenMenuBar</key>
<string>true</string>
<key>apple.awt.showGrowBox</key>
<string>true</string>
<key>com.apple.smallTabs</key>
<string>true</string>
<key>apple.awt.Antialiasing</key>
<string>false</string>
<key>apple.awt.TextAntialiasing</key>
<string>true</string>
<key>com.apple.hwaccel</key>
<string>true</string>
<key>apple.awt.use-file-dialog-packages</key>
<string>false</string>
<key>apple.awt.graphics.UseQuartz</key>
<string>true</string>
-->
</bundleapp>
<!-- The 'keytool' file is deleted by our appbundler. Add it back so that
Android signing works properly. (Not modifying our appbundler since
most of the time that appbundler is used, keytool isn't needed).
Also, because Ant's copy task does not retain file permissions on Unix systems,
we need to use <exec executable="cp" ... > instead -->
<exec executable="cp">
<arg line="${jdk.path.macosx}/Contents/Home/bin/keytool macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/bin"/>
</exec>
<!-- Replace libjli.dylib symlink with actual file.
Deals with code signing issues on OS X 10.9.5+ -->
<property name="jli.path" value="macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/MacOS/libjli.dylib" />
<delete file="${jli.path}" />
<exec executable="cp">
<arg line="${jdk.path.macosx}/Contents/Home/jre/lib/jli/libjli.dylib ${jli.path}"/>
</exec>
<copy todir="macosx/work/Processing.app/Contents/Java">
<fileset dir=".." includes="core/library/**" /> <!-- why this? -->
<!--<fileset dir="shared" includes="launch4j/**" />-->
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
<fileset file="shared/revisions.txt" />
</copy>
<!--
Processing.app/Contents/PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/lib/fonts
-->
<copy todir="macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/lib/fonts">
<fileset dir="shared/lib/fonts" includes="*" />
</copy>
<antcall target="assemble">
<param name="target.path"
value="macosx/work/Processing.app/Contents/Java" />
</antcall>
<exec executable="macosx/language_gen.py" />
<property name="launch4j.dir" value="macosx/work/Processing.app/Contents/Java/modes/java/application/launch4j" />
<!-- rename the version we need -->
<move file="${launch4j.dir}/bin/windres-macosx"
tofile="${launch4j.dir}/bin/windres" />
<move file="${launch4j.dir}/bin/ld-macosx"
tofile="${launch4j.dir}/bin/ld" />
<!-- make executable (ant doesn't preserve) -->
<chmod perm="ugo+x" file="${launch4j.dir}/bin/windres" />
<chmod perm="ugo+x" file="${launch4j.dir}/bin/ld" />
<!-- remove the others -->
<delete failonerror="true">
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
</delete>
</target>
<target name="macosx-run" depends="macosx-build"
description="Run Mac OS X version">
<exec executable="open" dir="macosx/work" spawn="true">
<arg value="-a" />
<arg value="/Applications/Utilities/Terminal.app" />
<!-- <arg value="Processing.app/Contents/MacOS/JavaApplicationStub" />-->
<arg value="Processing.app/Contents/MacOS/Processing" />
</exec>
</target>
<target name="macosx-dist-sign" if="codesign">
<echo>
Code signing will only work if you have a $99/yr Apple developer ID.
With a proper ID, if code signing fails, you may need to use:
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
</echo>
<!-- 3rd party is for the app store, dev id is gatekeeper only -->
<!--<arg value="3rd Party Mac Developer Application" />-->
<exec executable="/usr/bin/codesign" dir="macosx/work">
<arg value="--force" />
<arg value="--sign" />
<arg value="Developer ID Application" />
<arg value="Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk" />
</exec>
<exec executable="/usr/bin/codesign" dir="macosx/work">
<arg value="--force" />
<arg value="--sign" />
<arg value="Developer ID Application" />
<arg value="Processing.app" />
</exec>
</target>
<target name="macosx-dist" if="macosx"
depends="macosx-build"
description="Create a downloadable .zip for the Mac OS X version">
<!-- The ant copy command does not preserve permissions. -->
<chmod file="macosx/work/Processing.app/Contents/MacOS/JavaApplicationStub" perm="ugo+x" />
<!-- Now handled by the app bundler -->
<!--
<replace file="macosx/work/Processing.app/Contents/Info.plist"
token="VERSION" value="${version}" />
<replace file="macosx/work/Processing.app/Contents/Info.plist"
token="REVISION" value="${revision}" />
-->
<antcall target="macosx-dist-sign" />
<exec executable="ditto" dir="macosx/work">
<arg line="-c -k -rsrc . ../processing-${version}-macosx.zip" />
</exec>
<echo>
=======================================================
Processing for Mac OS X was built. Grab it from
macosx/processing-${version}-macosx.zip
=======================================================
</echo>
</target>
<!-- - - - - - - - -->
<!-- Linux -->
<!-- - - - - - - - -->
<target name="linux-clean" depends="subprojects-clean" description="Clean linux version">
<delete dir="linux/work" />
</target>
<target name="linux-checkos" unless="linux">
<echo>
=======================================================
Processing for Linux can only be built on on unix systems.
Bye.
=======================================================
</echo>
<fail message="wrong platform (${os.name})" />
</target>
<target name="linux-build" depends="revision-check, linux-checkos, subprojects-build" description="Build linux version">
<mkdir dir="linux/work" />
<copy todir="linux/work">
<fileset dir=".." includes="core/library/**" />
<fileset dir="shared" includes="launch4j/**" />
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
<fileset dir="shared" includes="modes/**" />
<fileset file="shared/revisions.txt" />
</copy>
<antcall target="assemble">
<param name="target.path" value="linux/work" />
</antcall>
<property name="launch4j.dir" value="linux/work/modes/java/application/launch4j" />
<!-- rename the version we need -->
<move file="${launch4j.dir}/bin/windres-linux"
tofile="${launch4j.dir}/bin/windres" />
<move file="${launch4j.dir}/bin/ld-linux"
tofile="${launch4j.dir}/bin/ld" />
<!-- make executable (ant doesn't preserve) -->
<chmod perm="ugo+x" file="${launch4j.dir}/bin/windres" />
<chmod perm="ugo+x" file="${launch4j.dir}/bin/ld" />
<!-- remove the others -->
<delete failonerror="true">
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
</delete>
<copy todir="linux/work/lib" flatten="true">
<fileset refid="runtime.jars" />
</copy>
<copy file="linux/processing" todir="linux/work" />
<chmod perm="ugo+x" file="linux/work/processing" />
<!-- copy command line tool -->
<copy file="linux/processing" tofile="linux/work/processing-java" />
<chmod perm="ugo+x" file="linux/work/processing-java" />
<get src="http://download.processing.org/java/${jre.file}"
dest="linux/jre.tgz"
usetimestamp="true" />
<!--
Cannot use ant version of tar because it doesn't preserve properties.
<untar compression="gzip"
dest="linux/work"
src="linux/jre.tgz"
overwrite="false"/>
-->
<!--
http://www.gnu.org/software/tar/manual/html_section/transform.html
-->
<exec executable="tar" dir="linux">
<!-- Change directory -->
<!--
<arg value="-C" />
<arg value="linux/work" />
<arg value="-xzpf" />
-->
<arg value="xfz" />
<arg value="jre.tgz"/>
</exec>
<!--
We only want to move when the folder didn't exist before
<move file="linux/jre1.7.0_40" tofile="linux/work/java" />
-->
<exec executable="rsync" dir="linux">
<arg value="-a" />
<arg value="--delete" />
<arg value="jre${jdk.esoteric}/" />
<arg value="work/java" />
</exec>
<delete dir="linux/jre${jdk.esoteric}" />
<!-- Remove unused JRE bloat. -->
<delete failonerror="true">
<fileset refid="javafx-basics" />
<fileset refid="javafx-linux-${sun.arch.data.model}" />
<fileset refid="jre-optional-linux" />
</delete>
<copy todir="linux/work/java/lib/fonts">
<fileset dir="shared/lib/fonts" includes="*" />
</copy>
</target>
<target name="linux-run" depends="linux-build"
description="Run Linux version">
<exec executable="./processing" dir="linux/work" spawn="true"/>
</target>
<target name="linux-dist-tar" depends="linux-build"
description="Build .tar.gz of linux version">
<!--
<tar compression="gzip" destfile="linux/processing-${version}.tgz">
<tarfileset dir="linux/work" prefix="processing-${version}" />
</tar>
-->
<!-- rename the work folder temporarily -->
<move file="linux/work" tofile="linux/processing-${version}" />
<property name="linux.dist" value="linux/processing-${version}-linux${sun.arch.data.model}.tgz" />
<exec executable="tar">
<arg value="--directory=linux" />
<arg value="--file=${linux.dist}" />
<arg value="-cpz" />
<arg value="processing-${version}" />
</exec>
<!-- put... the candle... back -->
<!-- (rename the work processing-NNNN version to work) -->
<move file="linux/processing-${version}" tofile="linux/work" />
<echo>
=======================================================
Processing for Linux was built. Grab the archive from
${linux.dist}
=======================================================
</echo>
</target>
<target name="linux-dist" depends="linux-dist-tar"
description="Build .deb of linux version">
<!-- start with a clean debian folder -->
<delete dir="linux/debian" quiet="true" />
<!-- setup the file structure -->
<mkdir dir="linux/debian/opt" />
<mkdir dir="linux/debian/usr/bin" />
<mkdir dir="linux/debian/usr/share/applications/" />
<mkdir dir="linux/debian/usr/share/mime/packages/" />
<!-- rename the work folder temporarily -->
<move file="linux/work" tofile="linux/debian/opt/processing" />
<symlink link="linux/debian/usr/bin/processing" resource="../../opt/processing/processing" />
<!-- place .desktop and .sharedmimeinfo file -->
<copy file="linux/processing.desktop" tofile="linux/debian/usr/share/applications/processing.desktop" >
<filterchain>
<replacetokens >
<token key="version" value="${version}" />
</replacetokens>
</filterchain >
</copy >
<copy file="linux/processing.sharedmimeinfo" tofile="linux/debian/usr/share/mime/packages/processing.xml" />
<!-- Set properties for DEBIAN/control file -->
<property name="linux.deb" value="linux/processing-${version}-linux${sun.arch.data.model}.deb" />
<condition property="deb.arch" value="i386">
<equals arg1="${sun.arch.data.model}" arg2="32" />
</condition>
<condition property="deb.arch" value="amd64">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<length property="deb.bsize" >
<fileset dir="linux/debian" />
</length>
<script language="javascript">
<![CDATA[
var length_bytes = project.getProperty("deb.bsize");
var length_kbytes = Math.ceil(length_bytes / 1024);
project.setNewProperty("deb.kbsize", length_kbytes);
]]>
</script>
<!-- place DEBIAN/control file. -->
<mkdir dir="linux/debian/DEBIAN" />
<copy file="linux/control" tofile="linux/debian/DEBIAN/control" >
<filterchain>
<replacetokens >
<token key="version" value="${version}" />
<token key="size" value="${deb.kbsize}" />
<token key="arch" value="${deb.arch}" />
</replacetokens>
</filterchain >
</copy >
<copy file="linux/copyright" tofile="linux/debian/DEBIAN/copyright" />
<!-- Create .deb file -->
<exec executable="fakeroot" dir="linux" failonerror="true">
<arg value="dpkg-deb" />
<arg value="--build" />
<arg value="debian" />
<arg value="../${linux.deb}" />
</exec>
<!-- put... the candle... back -->
<!-- (rename the debian processing version to work) -->
<move file="linux/debian/opt/processing" tofile="linux/work" />
<!-- cleanup -->
<delete dir="linux/debian" />
<echo>
=======================================================
Processing for Linux was built. Grab the deb from
${linux.deb}
=======================================================
</echo>
</target>
<!-- - - - - - - - -->
<!-- Windows -->
<!-- - - - - - - - -->
<target name="windows-clean" depends="subprojects-clean"
description="Clean windows version">
<delete dir="windows/work" />
</target>
<target name="windows-checkos" unless="windows">
<echo>
=======================================================
Processing for Windows can only be built on windows.
Bye.
=======================================================
</echo>
<fail message="wrong platform (${os.name})" />
</target>
<target name="windows-build"
depends="revision-check, windows-checkos, subprojects-build"
description="Build windows version">
<mkdir dir="windows/work" />
<!-- assemble the pde -->
<mkdir dir="windows/work/lib" />
<copy todir="windows/work/lib" flatten="true">
<fileset refid="runtime.jars" />
</copy>
<copy todir="windows/work">
<fileset dir=".." includes="core/library/**" />
<fileset dir="shared" includes="launch4j/**" />
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
<fileset dir="shared" includes="modes/**" />
<fileset file="shared/revisions.txt" />
</copy>
<fixcrlf file="windows/work/revisions.txt" eol="crlf" encoding="UTF-8" />
<antcall target="assemble">
<param name="target.path" value="windows/work" />
</antcall>
<property name="launch4j.dir" value="windows/work/modes/java/application/launch4j" />
<!-- rename the version we need -->
<move file="${launch4j.dir}/bin/windres-windows.exe"
tofile="${launch4j.dir}/bin/windres.exe" />
<move file="${launch4j.dir}/bin/ld-windows.exe"
tofile="${launch4j.dir}/bin/ld.exe" />
<!-- remove the others -->
<delete failonerror="true">
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
</delete>
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar; ${launch4j.dir}/lib/xstream.jar" />
<!-- not all launch4j options are available when embedded inside this
file (i.e. the icon param doesn't work), so use a config file -->
<launch4j configFile="windows/config.xml" />
<launch4j configFile="windows/config-cmd.xml" />
<!-- cygwin requires html, dll, and exe to have the +x flag -->
<chmod perm="ugo+x">
<fileset dir="windows/work" includes="**/*.html, **/*.dll, **/*.exe" />
</chmod>
<!-- starting with 2.0a7, require the local JRE + tools.jar -->
<get src="http://download.processing.org/java/${jre.file}"
dest="windows/jre.tgz"
usetimestamp="true" />
<!--
<unzip dest="windows/work" src="windows/jre.zip" overwrite="false"/>
-->
<!-- Hopefully this is OK with the permissions (unlike Linux),
since those shouldn't matter on Windows. -->
<untar compression="gzip"
dest="windows/work"
src="windows/jre.tgz"
overwrite="false" />
<move file="windows/work/jre${jdk.esoteric}"
tofile="windows/work/java" />
<!-- Remove space-wasting JavaFX garbage. -->
<delete failonerror="true">
<fileset refid="javafx-basics" />
<fileset refid="javafx-windows" />
<fileset refid="jre-optional-windows" />
</delete>
<copy todir="windows/work/java/lib/fonts">
<fileset dir="shared/lib/fonts" includes="*" />
</copy>
</target>
<target name="windows-run" depends="windows-build"
description="Run windows version">
<exec executable="windows/work/processing.exe"
dir="windows/work" spawn="true"/>
</target>
<target name="windows-dist" depends="windows-build"
description="Create .zip files of windows version">
<!--
<zip basedir="windows/work"
prefix="processing-${version}"
destfile="windows/processing-${version}.zip" />
<zip basedir="windows/work"
prefix="processing-${version}"
destfile="windows/processing-${version}-expert.zip"
excludes="java/**" />
-->
<property name="windows.dist" value="windows/processing-${version}-windows${sun.arch.data.model}.zip" />
<zip destfile="${windows.dist}">
<zipfileset dir="windows/work"
prefix="processing-${version}" />
</zip>
<!-- Expert is too much of a headache. Just nix it for 2.0. -->
<!--
<zip destfile="windows/processing-${version}-windows-expert.zip">
<zipfileset dir="windows/work"
prefix="processing-${version}"
excludes="java/**" />
</zip>
-->
<echo>
=======================================================
Processing for Windows was built. Grab the archive from
${windows.dist}
=======================================================
</echo>
</target>
<!-- - - - - - - - - - - - - - - - - - -->
<!-- Package source 'n tag the release -->
<!-- - - - - - - - - - - - - - - - - - -->
<!--
not ready to automate this yet, since we often have to reset the tag
<target name="dist-src" depends="dist">