-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
3461 lines (2975 loc) · 148 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"?>
<!-- ======================================================================
March 2005
Greenstone3 build and install script
kjdon
====================================================================== -->
<project name="greenstone3" default="usage" basedir=".">
<echo>os.name: ${os.name}</echo>
<!-- ============ classpath =================== -->
<path id="project.classpath">
<fileset dir="lib/java">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ============ self defined tasks =================== -->
<taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
<taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
<taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
<!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
<taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
<taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
<!-- ===================== Property Definitions =========================== -->
<!--
Each of the following properties are used in the build script.
Values for these properties are set by the first place they are
defined, from the following list:
* Definitions on the "ant" command line (ant -Dfoo=bar compile).
* Definitions from a "build.properties" file in the top level
source directory of this application.
* Definitions from a "build.properties" file in the user's
home directory.
* Default definitions in this build.xml file.
You will note below that property values can be composed based on the
contents of previously defined properties. This is a powerful technique
that helps you minimize the number of changes required when your development
environment is modified. Note that property composition is allowed within
"build.properties" files as well as in the "build.xml" script.
-->
<property name="os.linux" value="Linux"/>
<property name="os.mac" value="Mac OS X"/>
<property name="os.solaris" value="SunOS"/>
<property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
<property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2"/> <!-- check this!!!-->
<!-- this is true for linux and macs -->
<condition property="current.os.isunix">
<os family="unix"/>
</condition>
<condition property="current.os.isunixnotmac">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="current.os.ismac">
<os family="mac"/>
</condition>
<condition property="current.os.iswindows">
<os family="windows"/>
</condition>
<!-- create build.properties if it has not been created yet -->
<if>
<bool><not><available file="build.properties"/></not></bool>
<copy file="build.properties.in" tofile="build.properties"/>
</if>
<!-- create the packages dir if it has not been created yet -->
<mkdir dir="packages"/>
<!--the first three properties have to be put on the top to be used by build.properties-->
<property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
<property name="src.packages.home" value="${basedir}/src/packages"/>
<property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
<property name="solr-ext.home" value="${basedir}/ext/solr"/>
<property file="build.properties"/>
<if><bool><available file="${user.home}/build.properties"/></bool>
<property file="${user.home}/build.properties"/>
</if>
<!-- now we've read in properties, apply defaults -->
<property name="disable.collection.building" value="false"/>
<!-- get properties from the environment -->
<property environment="env"/>
<!-- get the filesets defining components and executables -->
<import file="resources/xml/components.xml"/>
<import file="resources/xml/executables.xml"/>
<!-- version properties for external packages -->
<!-- for Java versions < 1.4, we print out the message that Java is too old.
For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 7.0-->
<condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-7.0.57">
<equals arg1="1.4" arg2="${ant.java.version}"/>
</condition>
<condition property="tomcat.version.major" value="5" else="7">
<equals arg1="1.4" arg2="${ant.java.version}"/>
</condition>
<condition property="privileged.attribute" value="privileged='true'" else="">
<equals arg1="7" arg2="${tomcat.version.major}"/>
</condition>
<!-- external access to the GS3 pages or not
https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html -->
<condition property="allowed.IPs"
value=".*"
else="(127\.0\.0\.1|::1|0:0:0:0:0:0:0:1)">
<matches pattern="^(1|true|yes)$" string="${server.external.access}"/>
</condition>
<property name="axis.zip.version" value="axis-bin-1_4.zip"/>
<property name="axis.dir.version" value="axis-1_4"/>
<property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
<property name="build.home" value="${basedir}/build"/>
<property name="src.home" value="${basedir}/src/java"/>
<if><bool><istrue value="${gsdl3home.isreadonly}"/></bool>
<property name="readonly-packages.home" value="${basedir}/packages"/>
<property name="packages.home" value="${gsdl3.writablehome}/packages"/>
<!--
To run solr from a read-only location (like a DVD-ROM), its locktype needs to be "single",
else solr tries to write out a lock file to the collection's index folder which is read-only.
https://cwiki.apache.org/confluence/display/solr/IndexConfig+in+SolrConfig
says that the "single" locktype is "for special situations of a read-only index directory, or ...."
See also http://wiki.apache.org/lucene-java/AvailableLockFactories
And look for the documentation on "locktype" in solr collection's etc/conf/solrconfig.xml
for further information on the different locktypes.
To set the locktype property from the commandline (it's a property to the server web), pass in
"-Dsolr.lock.type=..." to the web server, as explained in
http://lucene.472066.n3.nabble.com/Where-can-we-set-the-parameters-in-Solr-Config-td4183706.html
-->
<property name="readonly.catalina.opts" value="-Dsolr.lock.type=single"/>
<else>
<property name="packages.home" value="${basedir}/packages"/>
<property name="readonly.catalina.opts" value=""/>
</else>
</if>
<!-- this may be set in build.properties, e.g. if you move the web dir to
tomcats webapps directory -->
<property name="web.home" value="${basedir}/web"/>
<property name="web.writablehome" value="${gsdl3.writablehome}"/>
<!-- If using a dispersed GS3 web folder, then the user web would not contain everything in the
default GS3 web (it won't contain a CGI or lib folder inside WEB-INF, for instance) -->
<if>
<bool><available file="${web.home}/WEB-INF/cgi" type="dir"/></bool>
<property name="full.web.dir" value="${web.home}"/>
<else>
<property name="full.web.dir" value="${basedir}/web"/>
</else>
</if>
<!-- jar files needed by applets go here -->
<property name="web.applet" value="${web.home}/applet"/>
<!-- jar files needed by the servlet (and extra ones) go here -->
<property name="web.lib" value="${web.home}/WEB-INF/lib"/>
<property name="web.writablelib" value="${web.writablehome}/WEB-INF/lib"/>
<!-- other files needed by the servlet go here -->
<property name="web.classes" value="${web.home}/WEB-INF/classes"/>
<property name="web.writableclasses" value="${web.writablehome}/WEB-INF/classes"/>
<if>
<bool><istrue value="${gsdl3home.isreadonly}"/></bool>
<echo>Greenstone3 home directory is read-only</echo>
<echo> => Writable area is: ${gsdl3.writablehome}</echo>
<condition property="gsdl3.writablehome.already-exists">
<available file="${gsdl3.writablehome}" type="dir"/>
</condition>
<if>
<bool><not><istrue value="${gsdl3.writablehome.already-exists}"/></not></bool>
<!-- set up writable area -->
<echo>No previous Greenstone home writable area detected</echo>
<echo> => Setting up area</echo>
<mkdir dir="${gsdl3.writablehome}"/>
<mkdir dir="${gsdl3.writablehome}/packages"/>
<mkdir dir="${gsdl3.writablehome}/logs"/>
<mkdir dir="${gsdl3.writablehome}/ext/solr"/>
<chmod perm="a+rwx" dir="${gsdl3.writablehome}"/>
<chmod perm="a+rwx" dir="${gsdl3.writablehome}/packages"/>
<chmod perm="a+rwx" dir="${gsdl3.writablehome}/logs"/>
<chmod perm="a+rwx" dir="${gsdl3.writablehome}/ext/solr"/>
<!-- copy over packages tomcat folder -->
<if>
<bool><istrue value="${current.os.iswindows}"/></bool>
<copy todir="${gsdl3.writablehome}/packages/tomcat"
preservelastmodified="true"
failonerror="true" >
<fileset dir="${readonly-packages.home}/tomcat" includes="**"/>
</copy>
<else>
<!-- else assume Unix -->
<!-- Can't go through the OS-independent <copy> task as it fails to preserve exec permissions -->
<echo>Copying to ${gsdl3.writablehome}/packages/tomcat</echo>
<exec executable="cp" output="/dev/null" spawn="false">
<arg value="-r"/>
<arg value="${readonly-packages.home}/tomcat"/>
<arg value="${gsdl3.writablehome}/packages/."/>
</exec>
<!-- the packages folder in tmp only has read permissions at this stage, it needs more permissions to work when running GS3 off a disc -->
<chmod perm="a+rwx" file="${gsdl3.writablehome}/packages/**" />
</else>
</if>
<echo> => Copying Greenstone's web/WEB-INF to writable area</echo>
<copy todir="${gsdl3.writablehome}/WEB-INF"
preservelastmodified="true"
failonerror="true" >
<fileset dir="${full.web.dir}/WEB-INF" includes="**"/>
</copy>
<copy todir="${gsdl3.writablehome}"
preservelastmodified="true"
failonerror="true" >
<fileset dir="${web.home}" includes="index.html"/>
</copy>
</if>
</if>
<!--- flax: the WordNet home -->
<property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
<!-- jni libraries and java wrappers go here -->
<property name="lib.jni" value="${basedir}/lib/jni"/>
<!-- other jar files needed for installation (but not runtime) go here -->
<property name="lib.java" value="${basedir}/lib/java"/>
<property name="javadocs" value="${basedir}/docs/javadoc"/>
<property name="app.name" value="greenstone3"/>
<property name="app.path" value="/${greenstone.context}"/>
<property name="admin.dir" value="${basedir}/admin"/>
<!-- defaults - set these on the command line or in build.properties or
they will take these default values-->
<property name="app.version" value="trunk"/>
<property name="branch.path" value="trunk"/>
<property name="branch.revision" value="HEAD"/>
<!--constants -->
<property name="svn.root" value="http://svn.greenstone.org"/>
<!-- catalina home is set to tomcat basedir if already installed, otherwise
use greenstone's tomcat -->
<condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
<and>
<isset property="tomcat.installed.path"/>
<not>
<equals arg1="" arg2="${tomcat.installed.path}"/>
</not>
</and>
</condition>
<!-- is there a better way to do this?? what about solaris?? -->
<condition property="os.bin.dir" value="${cross.os}">
<istrue value="${compile.cross}"/>
</condition>
<condition property="os.bin.dir" value="windows">
<os family="windows"/>
</condition>
<condition property="os.bin.dir" value="darwin">
<os family="mac"/>
</condition>
<condition property="os.bin.dir" value="linux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="collection.building.disabled">
<and>
<isset property="disable.collection.building"/>
<istrue value="${disable.collection.building}"/>
</and>
</condition>
<condition property="collection.building.enabled">
<not>
<istrue value="${disable.collection.building}"/>
</not>
</condition>
<condition property="collection.building.enabled.windows">
<and>
<istrue value="${collection.building.enabled}"/>
<isset property="current.os.iswindows"/>
</and>
</condition>
<condition property="collection.building.enabled.unix">
<and>
<istrue value="${collection.building.enabled}"/>
<isset property="current.os.isunix"/>
</and>
</condition>
<condition property="static.arg" value="LDFLAGS=-static" else=" ">
<isset property="compile.static"/>
</condition>
<!-- If building a release then we want to adjust environment variables so that the support library can be seen during compilation -->
<if><bool><isset property="use.gnomelib.ext"/></bool>
<property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
<if><bool><isset property="env.CFLAGS"/></bool>
<property name="cflags.arg" value="CFLAGS="-I${gnome-lib-dir}/include ${env.CFLAGS}""/>
<else>
<property name="cflags.arg" value="CFLAGS="-I${gnome-lib-dir}/include""/>
</else>
</if>
<if><bool><isset property="env.CPPFLAGS"/></bool>
<property name="cppflags.arg" value="CPPFLAGS="-I${gnome-lib-dir}/include ${env.CPPFLAGS}""/>
<else>
<property name="cppflags.arg" value="CPPFLAGS="-I${gnome-lib-dir}/include""/>
</else>
</if>
<if><bool><isset property="env.CXXFLAGS"/></bool>
<property name="cxxflags.arg" value="CXXFLAGS="-I${gnome-lib-dir}/include ${env.CXXFLAGS}""/>
<else>
<property name="cxxflags.arg" value="CXXFLAGS="-I${gnome-lib-dir}/include""/>
</else>
</if>
<!--https://groups.google.com/forum/#!topic/openkinect/m-hfXeYwKtU
compiling up libwv on ElCapitan needs -framework CoreFoundation -->
<if><bool><isset property="env.LDFLAGS"/></bool>
<property name="ldflags.arg" value="LDFLAGS="-L${gnome-lib-dir}/lib ${env.LDFLAGS}""/>
<else>
<property name="ldflags.arg" value="LDFLAGS="-L${gnome-lib-dir}/lib""/>
</else>
</if>
<if><bool><isset property="env.PATH"/></bool>
<property name="path.arg" value="PATH="${gnome-lib-dir}/bin:${env.PATH}""/>
<else>
<property name="path.arg" value="PATH="${gnome-lib-dir}/bin""/>
</else>
</if>
<if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
<property name="pcpath.arg" value="PKG_CONFIG_PATH="${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}""/>
<else>
<property name="pcpath.arg" value="PKG_CONFIG_PATH="${gnome-lib-dir}/lib/pkgconfig""/>
</else>
</if>
<if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
<!--<if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH="${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}""/>
<else>
<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH="${gnome-lib-dir}/lib""/>
</else>
</if>
-->
<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH="${env.DYLD_LIBRARY_PATH}""/>
<else>
<if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
<property name="ldlpath.arg" value="LD_LIBRARY_PATH="${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}""/>
<else>
<property name="ldlpath.arg" value="LD_LIBRARY_PATH="${gnome-lib-dir}/lib""/>
</else>
</if>
</else>
</if>
<else>
<if><bool><isset property="env.CFLAGS"/></bool>
<property name="cflags.arg" value="CFLAGS="${env.CFLAGS}""/>
<else>
<property name="cflags.arg" value=" "/>
</else>
</if>
<if><bool><isset property="env.CPPFLAGS"/></bool>
<property name="cppflags.arg" value="CPPFLAGS="${env.CPPFLAGS}""/>
<else>
<property name="cppflags.arg" value=" "/>
</else>
</if>
<if><bool><isset property="env.CXXFLAGS"/></bool>
<property name="cxxflags.arg" value="CXXFLAGS="${env.CXXFLAGS}""/>
<else>
<property name="cxxflags.arg" value=" "/>
</else>
</if>
<if><bool><isset property="env.LDFLAGS"/></bool>
<property name="ldflags.arg" value="LDFLAGS="${env.LDFLAGS}""/>
<else>
<property name="ldflags.arg" value=" "/>
</else>
</if>
<if><bool><isset property="env.PATH"/></bool>
<property name="path.arg" value="PATH="${env.PATH}""/>
<else>
<property name="path.arg" value=" "/>
</else>
</if>
<if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
<property name="pcpath.arg" value="PKG_CONFIG_PATH="${env.PKG_CONFIG_PATH}""/>
<else>
<property name="pcpath.arg" value=" "/>
</else>
</if>
<if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
<if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
<property name="ldlpath.arg" value="DYLD_LIBRARY_PATH="${env.DYLD_LIBRARY_PATH}""/>
<else>
<property name="ldlpath.arg" value=" "/>
</else>
</if>
<else>
<if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
<property name="ldlpath.arg" value="LD_LIBRARY_PATH="${env.LD_LIBRARY_PATH}""/>
<else>
<property name="ldlpath.arg" value=" "/>
</else>
</if>
</else>
</if>
</else>
</if>
<property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
<condition property="opt.cross.build"
value="--build=${cross.build}" else=" ">
<isset property="cross.build"/>
</condition>
<condition property="cross.configure.args"
value="--host=${cross.host} ${opt.cross.build} CPP=${cross.host}-cpp CC=${cross.host}-gcc CXX=${cross.host}-g++ LD=${cross.host}-ld AR=${cross.host}-ar RANLIB=${cross.host}-ranlib STRIP=${cross.host}-strip ${cross.configure.extraargs} crossOS=${cross.os}" else=" ">
<istrue value="${compile.cross}"/>
</condition>
<!-- if we're told to work with gnome-lib, or if there's a gnome-lib-minimal that the user
has placed in gs2build/ext, then compile gs2build after sourcing gnome-lib environment -->
<condition property="opt.gnomelibext.arg"
value="--enable-gnome-lib-ext" else=" ">
<or>
<available file="${gs2build.home}/ext/gnome-lib-minimal" type="dir"/>
<istrue value="${use.gnomelib.ext}"/>
<istrue value="${checkout.gnomelib.ext}"/>
</or>
</condition>
<!-- if you want to disable wvware, do so here: set the value (not else) field to contain minus-minus-disable-wvware -->
<condition property="gs2.opt.args" value="${opt.gnomelibext.arg} " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
<istrue value="${with.jni}"/>
</condition>
<condition property="gs2.compile.target" value="with-jni" else="without-jni">
<istrue value="${with.jni}"/>
</condition>
<condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
<istrue value="${with.jni}"/>
</condition>
<condition property="gs2.windows.enablejni" value="1" else="0">
<istrue value="${with.jni}"/>
</condition>
<condition property="gs2.windows.enablemg" value="1" else="0">
<istrue value="${with.jni}"/>
</condition>
<condition property="gs2.windows.enablemgpp" value="1" else="0">
<istrue value="${with.jni}"/>
</condition>
<!-- Should accent folding not also be set here ?? -->
<condition property="gs2.windows.usegdbm" value="1" else="0">
<istrue value="${with.jni}"/>
</condition>
<condition property="gs2.windows.usesqlite" value="1" else="0">
<istrue value="${with.jni}"/>
</condition>
<!-- where is search4j tool -->
<condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
<isset property="current.os.iswindows"/>
</condition>
<!-- ============= Base dirs for each package and component ============ -->
<property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
<property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
<property name="gli.home" value="${basedir}/gli"/>
<property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
<condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
<istrue value="${disable.collection.building}"/>
</condition>
<property name="build.src.home" value="${gs2build.home}/build-src"/>
<property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
<property name="mg.home" value="${common.src.home}/indexers/mg"/>
<property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
<property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
<!-- ==================== Compilation Control Options ==================== -->
<!--
These properties control option settings on the Javac compiler when it
is invoked using the <javac> task.
compile.debug Should compilation include the debug option?
compile.deprecation Should compilation include the deprecation option?
compile.optimize Should compilation include the optimize option?
-->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="true"/>
<property name="compile.optimize" value="true"/>
<property name="compile.encoding" value="UTF8"/>
<property name="compile.includeantruntime" value="false"/> <!-- to get rid of annoying 'ant' warning -->
<!--
Rather than relying on the CLASSPATH environment variable, Ant includes
features that makes it easy to dynamically construct the classpath you
need for each compilation. The example below constructs the compile
classpath to include the servlet.jar file, as well as the other components
that Tomcat makes available to web applications automatically, plus anything
that you explicitly added.
-->
<!-- All elements that Tomcat 5 exposes to applications -->
<path id="tomcat5">
<pathelement location="${catalina.home}/common/classes"/>
<fileset dir="${catalina.home}/common/endorsed">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/common/lib">
<include name="*.jar"/>
</fileset>
<!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
<pathelement location="${catalina.home}/shared/classes"/>
<fileset dir="${catalina.home}/shared/lib">
<include name="*.jar"/>
</fileset>
</path>
<!-- All elements that Tomcat 7 exposes to applications -->
<path id="tomcat7">
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="compile.classpath">
<!-- Include all jar files and libraries in our jni lib directory -->
<pathelement location="${lib.jni}"/>
<fileset dir="${lib.jni}">
<include name="*.jar"/>
</fileset>
<!-- Include all jar files in our web lib directory -->
<pathelement location="${web.lib}"/>
<fileset dir="${web.lib}">
<include name="*.jar"/>
</fileset>
<pathelement location="${lib.java}"/>
<fileset dir="${lib.java}">
<include name="*.jar"/>
</fileset>
<!-- include the jar files from the source packages -->
<!-- mg and mgpp get installed into lib/jni but they may not be there yet
so we add them in by name -->
<!-- *** is there any way to make this optional, based on ${with.jni}? -->
<pathelement location="${lib.jni}/mg.jar"/>
<pathelement location="${lib.jni}/mgpp.jar"/>
<!-- Include all elements that Tomcat exposes to applications -->
<path refid="tomcat${tomcat.version.major}"/>
</path>
<path id="local.tomcat.classpath">
<!-- explicitly include the jni java wrappers in the classpath -->
<pathelement location="${lib.jni}"/>
<fileset dir="${lib.jni}">
<include name="*.jar"/>
</fileset>
<pathelement location="${web.writablelib}"/>
<fileset dir="${web.writablelib}">
<include name="derbyclient.jar"/> <!--<include name="derby.jar"/>-->
</fileset>
</path>
<path id="derby.server.classpath">
<pathelement location="${web.writablelib}/derbynet.jar"/>
<pathelement location="${web.writablelib}/derby.jar"/>
</path>
<if><bool><isset property="env.PATH"/></bool>
<path id="local.tomcat.path">
<pathelement location="${basedir}/bin/script"/>
<pathelement location="${basedir}/bin"/>
<pathelement location="${lib.jni}"/>
<pathelement path="${env.PATH}"/>
<pathelement path="${wn.home}/bin"/>
</path>
<!-- Windows can be case sensitive about env.PATH, preferring env.Path. See https://ant.apache.org/manual/Tasks/property.html -->
<else><if><bool><isset property="env.Path"/></bool>
<path id="local.tomcat.path">
<pathelement location="${basedir}/bin/script"/>
<pathelement location="${basedir}/bin"/>
<pathelement location="${lib.jni}"/>
<pathelement path="${env.Path}"/>
<pathelement path="${wn.home}/bin"/>
</path>
<!-- else print error about no path set -->
<else>
<echo>No env.PATH (or env.Path) set. Unable to set local.tomcat.path property</echo>
</else></if></else>
</if>
<target name="test-setup">
<echo>ant java version=${ant.java.version}</echo>
<echo>is unix : ${current.os.isunix}</echo>
<echo>is mac : ${current.os.ismac}</echo>
<echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
<echo>is windows : ${current.os.iswindows}</echo>
<echo>os.unix: ${os.unix}</echo>
<echo>env.PATH: ${env.PATH}</echo>
<echo>env.Path: ${env.Path}</echo>
</target>
<target name="needs-gs3-setup">
<!-- has the gs3-setup script been run?? -->
<condition property="gs3-setup-not-done">
<not>
<isset property="env.GSDL3HOME"/>
</not>
</condition>
<fail if="gs3-setup-not-done" message="Please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before starting the Greenstone server."/>
</target>
<!-- Appends the current env to the file environment.txt. For debugging env vars used by the release-kit. -->
<target name="write-env" description="Writes out the environment that this build.xml is executed in to file environment.txt. For debugging.">
<echo message="*****************ENVIRONMENT OUTPUT:****************${line.separator}" file="environment.txt" append="true" />
<if><bool><istrue value="${current.os.iswindows}"/></bool>
<exec executable="cmd" dir="${basedir}" failonerror="false" output="environment.txt" append="true">
<arg value="/c" />
<arg value="set" />
</exec>
<else>
<exec executable="env" dir="${basedir}" failonerror="false" output="environment.txt" append="true" />
</else>
</if>
<echo message="${line.separator}" file="environment.txt" append="true" />
</target>
<!-- ==================== Primary and Global Targets ============================= -->
<target name="prepare" depends="accept-properties,init,copy-dot-in-files,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
<!-- make sure .sh files are executable -->
<chmod dir="${basedir}" perm="ugo+rx"
includes="*.sh"/>
<chmod dir="${basedir}/bin/script" perm="ugo+rx"
includes="*.sh,*.pl"/>
</target>
<!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
<!--before configuring build-src, make sure that gnome-lib is compiled up-->
<target name="install" depends="init,compile-imagemagick,compile-gnome-lib,install-common-src,install-collection-building,install-runtime,install-solr-ext,setup-for-eclipse,get-isisgdl"
description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
<target name="install-common-src" depends="init"
description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
<antcall target="configure-common-src">
<param name="set.ld.path" value="true"/>
</antcall>
<antcall target="compile-common-src">
<param name="set.ld.path" value="true"/>
</antcall>
<antcall target="install-auxiliary-jar-files"/>
<antcall target="install-jni-files"/>
</target>
<target name="install-collection-building" depends="init" if="collection.building.enabled"
description="Install (configure, compile, install) the Greenstone 2 collection building package." >
<antcall target="configure-collection-building"/>
<antcall target="tweak-makefiles" />
<antcall target="compile-collection-building"/>
</target>
<target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
<target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
<target name="configure" depends="init,configure-tomcat,configure-web"
description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file, including if you change the port number."/>
<target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
<target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
<target name="update" depends="init,svnupdate,clean,install"
description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
<target name="perl-for-building" depends="init">
<!-- uses perl.path if set in build.properties, otherwise try for
environment variable PERLPATH, and failing that assumes 'perl'
is on environment PATH -->
<!-- if, outside build.properties, we only set perl.path if we have gs2build/build-src (collection building), then we won't set perl.path in a (flax) binary, since it doesn't have build-src -->
<if><bool><available file="${gs2build.home}"/></bool>
<if><bool><not><isset property="perl.path"/></not></bool>
<if>
<bool>
<and>
<isset property="env.PERLPATH"/>
<not><equals arg1="${env.PERLPATH}" arg2=""/></not>
</and>
</bool>
<!-- set perlpath to env.PERLPATH.
This is the path to perl\bin that's found by findperl.bat when the server is launched
through GLI instead of the console.
For windows, this env.PERLPATH is the bin folder and needs a backslash at end, since it
will appear suffixed with "perl.exe" in the perl setting in packages\tomcat\config\web.xml.
This web.xml's path to perl is then used to find perl when running the perl scripts in the
cgi folder, so without a slash appended at this point it becomes "binperl" in web.xml, and
things will break when GLI launches the server on Windows and the online GS3 metadata editor
is used to save user-edited metadata. -->
<if><bool><istrue value="${current.os.iswindows}"/></bool>
<property name="perl.path" value="${env.PERLPATH}\"/>
<else>
<property name="perl.path" value="${env.PERLPATH}"/>
</else>
</if>
<else>
<echo>
Using PATH environment variable to locate Perl.
</echo>
<exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
<arg value="perl" />
</exec>
<exec executable="${gs2build.home}/bin/windows/which" osfamily="windows" spawn="false" outputproperty="full.perl.path">
<arg value="perl" />
</exec>
<stringutil string="${full.perl.path}" property="partial.perl.path">
<replace regex="\/[^\/]*$" replacement="/" />
</stringutil>
<stringutil string="${partial.perl.path}" property="perl.path">
<replace regex="\\[^\\]*$" replacement="\\" />
</stringutil>
<if><bool><istrue value="${current.os.isunix}"/></bool>
<if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
<echo>
Non-standard location of Perl found: ${full.perl.path}
Set the environment variable PERLPATH or the perl.path property in
build.properties to explicitly control the version of Perl used.
</echo>
</if>
</if>
</else>
</if>
</if>
<!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
<if><bool><isset property="perl.path"/></bool>
<property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
<else>
<property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
</else>
</if>
<!-- gs2build not available, perl.path -->
<else>
<property name="perl.path" value=""/>
</else>
</if>
<stringutil string="${perl.path}" property="escaped.perl.path">
<replace regex="\\" replacement="\\\\" />
</stringutil>
</target>
<target name="get-default-servlet-url">
<echo>${server.protocol}://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}</echo>
</target>
<target name="get-solr-servlet-url">
<echo>${server.protocol}://${tomcat.server}:${tomcat.port}/${solr.context}</echo>
</target>
<target name="check-derbyserver-running">
<condition property="derby.isrunning" value="true" else="false">
<!--<socket server="jdbc:derby://${derby.server}" port="${derby.server.port}"/>-->
<socket server="${derby.server}" port="${derby.server.port}"/><!-- like telnet machine port -->
</condition>
<echo>Derby is running: ${derby.isrunning}</echo>
</target>
<!-- Need a copy of the check-derby-running target with a distinct property, because ant restart runs
both stop and start, which stop and start derby respectively. Both need check the derby socket.
Because each property can be set only once during an invocation with ant, ant restart will need
two check-derbyserver properties, one for each derby check. -->
<target name="check-derbyserver-started">
<condition property="derby.isstarted" value="true" else="false">
<socket server="${derby.server}" port="${derby.server.port}"/>
</condition>
<echo>Derby is running: ${derby.isstarted}</echo>
</target>
<!-- Unused -->
<target name="start-derby-java" depends="check-derbyserver-running">
<if><bool><not><istrue value="${derby.isrunning}"/></not></bool>
<echo>Launching derby on ${derby.server}:${derby.server.port}...</echo>
<java classname="org.apache.derby.drda.NetworkServerControl" fork="true" spawn="true" clonevm="true">
<arg value="start"/>
<classpath refid="derby.server.classpath"/>
</java>
<else>
<echo>Derby server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo>
</else>
</if>
</target>
<target name="start-derby" depends="check-derbyserver-started">
<if><bool><not><istrue value="${derby.isstarted}"/></not></bool>
<echo>About to launch derby on ${derby.server}:${derby.server.port}</echo>
<antcall target="force-start-derby"/>
<else>
<echo>Derby networked server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo>
</else>
</if>
</target>
<!-- Using derby 10.1.2.1
See db-derby-10.1.2.1-bin/docs/html/adminguide/index.html -->
<target name="force-start-derby">
<property name="derby.server.classpath.prop" refid="derby.server.classpath" />
<exec executable="java" spawn="true"><!-- failonerror="true"-->
<env key="CLASSPATH" path="${derby.server.classpath.prop}"/>
<arg value="org.apache.derby.drda.NetworkServerControl"/>
<arg value="start"/>
<arg value="-p"/>
<arg value="${derby.server.port}"/>
</exec>
</target>
<target name="force-stop-derby">
<java classname="org.apache.derby.drda.NetworkServerControl">
<arg value="shutdown"/>
<arg value="-p"/>
<arg value="${derby.server.port}"/>
<classpath refid="derby.server.classpath"/>
</java>
</target>
<target name="stop-derby" description="Shutdown derby server only if running" depends="check-derbyserver-running"><!-- if="${derby.isrunning}" checks if true or false only from ant 1.8 on -->
<if><bool><istrue value="${derby.isrunning}"/></bool>
<!--<echo>Derby is |${derby.isrunning}| running</echo>-->
<antcall target="force-stop-derby"/>
<else>
<echo>Derby is not running</echo>
</else>
</if>
</target>
<target name="start" depends="needs-gs3-setup,init,configure-tomcat,configure-web,configure-solr-ext,start-derby,start-tomcat"
description="Startup the Tomcat server." >
<echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
<echo>Tomcat: ${catalina.home}</echo>
<echo>Java : ${java.home}</echo>
<if><bool><available file="${build.src.home}"/></bool>
<echo>Perl : ${full.perl.path}</echo>
</if>
<if><bool><isset property="install.flax"/></bool>
<property name="url" value="${server.protocol}://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
<else>
<property name="url" value="${server.protocol}://${tomcat.server}:${tomcat.port}${app.path}/"/>
</else>
</if>
<echo>URL : ${url}</echo>
<!-- assuming that index.html is not needed here -->
<!--Now write out the url with oaiserver suffix as the baseURL property in OAIConfig.xml-->
<available file="${basedir}/resources/oai/OAIConfig.xml" property="oaiconfig.present"/>
<antcall target="init-oaiconfig">
<param name="url" value="${url}"/>
</antcall>
</target>
<target name="init-oaiconfig" if="oaiconfig.present">
<echo>Writing out baseURL ${url}oaiserver to ${web.writableclasses}/OAIConfig.xml</echo>
<copy file="${basedir}/resources/oai/OAIConfig.xml" tofile="${web.writableclasses}/OAIConfig.xml"/>
<rsr verbosity="1" file="${web.writableclasses}/OAIConfig.xml" pattern="<baseURL>.*</baseURL>" replacement="<baseURL>${url}oaiserver</baseURL>" />
</target>
<target name="stop" depends="init,stop-tomcat,stop-derby"
description="Shutdown the Tomcat server."/>
<target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
<!-- =========== Help targets =================================== -->
<property name="install-command" value="ant [options] prepare install"/>
<target name="usage" description="Print a help message">
<echo message=" Execute 'ant -projecthelp' for a list of targets."/>
<echo message=" Execute 'ant -help' for Ant help."/>
<echo>
To install Greenstone3, run '${install-command}'.
There are properties defined in build.properties. The install
process will ask you if these properties are set correctly.
To avoid this prompt, use the '-Dproperties.accepted=yes'
option.
To log the output, use the '-logfile build.log' option.
The README.txt file has more information about the ant targets
and install process.
</echo>
</target>
<target name="help" depends="usage" description="Print a help message"/>
<target name="debug" depends="init" description="Display all the currently used properties">
<echoproperties/>
</target>
<!-- ====== initialization and setup targets ================== -->
<target name="accept-properties" unless="properties.accepted">