source: main/trunk/greenstone3/build.xml@ 24868

Last change on this file since 24868 was 24868, checked in by sjm84, 12 years ago

Fixed the perlpath escaping (I think?)

File size: 90.9 KB
RevLine 
[15124]1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
[20241]10 <echo>os.name: ${os.name}</echo>
[15124]11
[15799]12 <!-- ============ classpath =================== -->
13 <path id="project.classpath">
14 <fileset dir="lib/java">
15 <include name="**/*.jar"/>
16 </fileset>
17 </path>
18
19 <!-- ============ self defined tasks =================== -->
20 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
21 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
[19930]22 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
[21196]23 <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
[15799]24 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
[23854]25 <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
26
[19930]27
[15799]28 <!-- ===================== Property Definitions =========================== -->
29
30 <!--
[15124]31
32 Each of the following properties are used in the build script.
33 Values for these properties are set by the first place they are
34 defined, from the following list:
35
36 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
37
38 * Definitions from a "build.properties" file in the top level
[15799]39 source directory of this application.
[15124]40
41 * Definitions from a "build.properties" file in the user's
[15799]42 home directory.
[15124]43
44 * Default definitions in this build.xml file.
45
46 You will note below that property values can be composed based on the
47 contents of previously defined properties. This is a powerful technique
48 that helps you minimize the number of changes required when your development
49 environment is modified. Note that property composition is allowed within
50 "build.properties" files as well as in the "build.xml" script.
51
[15799]52 -->
[18227]53
54 <!-- create build.properties if it has not been created yet -->
55 <if>
56 <bool><not><available file="build.properties"/></not></bool>
57 <copy file="build.properties.in" tofile="build.properties"/>
58 </if>
59
[18515]60 <!-- create the packages dir if it has not been created yet -->
61 <mkdir dir="packages"/>
[15799]62
[15859]63 <!--the first three properties have to be put on the top to be used by build.properties-->
[19960]64 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
[15124]65 <property name="src.packages.home" value="${basedir}/src/packages"/>
[15859]66 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
[19878]67
[15124]68 <property file="build.properties"/>
[16962]69 <if><bool><available file="${user.home}/build.properties"/></bool>
70 <property file="${user.home}/build.properties"/>
71 </if>
[15124]72
[20464]73 <!-- now we've read in properties, apply defaults -->
74 <property name="disable.collection.building" value="false"/>
75
[15124]76 <!-- get properties from the environment -->
77 <property environment="env"/>
[15799]78
[20127]79 <!-- get the filesets defining components and executables -->
[19975]80 <import file="resources/xml/components.xml"/>
[20127]81 <import file="resources/xml/executables.xml"/>
[15799]82
83 <!-- version properties for external packages -->
[20079]84 <!-- for Java versions < 1.4, we print out the message that Java is too old.
85 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 6.0-->
86 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-6.0.20">
87 <equals arg1="1.4" arg2="${ant.java.version}"/>
88 </condition>
89 <condition property="tomcat.version.major" value="5" else="6">
90 <equals arg1="1.4" arg2="${ant.java.version}"/>
91 </condition>
[22320]92 <condition property="privileged.attribute" value="privileged='true'" else="">
93 <equals arg1="6" arg2="${tomcat.version.major}"/>
94 </condition>
[20233]95
[22405]96 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
97 <property name="axis.dir.version" value="axis-1_4"/>
[24077]98 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
[15799]99
[15124]100 <property name="build.home" value="${basedir}/build"/>
101 <property name="src.home" value="${basedir}/src/java"/>
102 <property name="packages.home" value="${basedir}/packages"/>
103 <!-- this may be set in build.properties, eg if you move the web dir to
104 tomcats webapps directory -->
105 <property name="web.home" value="${basedir}/web"/>
106 <!-- jar files needed by applets go here -->
107 <property name="web.applet" value="${web.home}/applet"/>
[20085]108
[15124]109 <!-- jar files needed by the servlet (and extra ones) go here -->
110 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
111 <!-- other files needed by the servlet go here -->
112 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
113 <!--- flax: the WordNet home -->
114 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
115
116 <!-- jni libraries and java wrappers go here -->
117 <property name="lib.jni" value="${basedir}/lib/jni"/>
[19878]118
119 <!-- other jar files needed for installation (but not runtime) go here -->
[18110]120 <property name="lib.java" value="${basedir}/lib/java"/>
[15799]121
[15124]122 <property name="javadocs" value="${basedir}/docs/javadoc"/>
123
124 <property name="app.name" value="greenstone3"/>
125 <property name="app.path" value="/${app.name}"/>
126
[18124]127 <property name="admin.dir" value="${basedir}/admin"/>
[15124]128
129 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
130 <property name="app.version" value="trunk"/>
131 <property name="branch.path" value="trunk"/>
132 <property name="branch.revision" value="HEAD"/>
133
134 <!--constants -->
135 <property name="svn.root" value="http://svn.greenstone.org"/>
136
[19878]137 <!-- catalina home is set to tomcat basedir if already installed, otherwise
[15124]138 use greenstone's tomcat -->
[20085]139 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
[15124]140 <and>
141 <isset property="tomcat.installed.path"/>
142 <not>
[16936]143 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]144 </not>
145 </and>
146 </condition>
[19878]147
[15124]148 <property name="os.linux" value="Linux"/>
149 <property name="os.mac" value="Mac OS X"/>
150 <property name="os.solaris" value="SunOS"/>
151 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
[22056]152 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista,Windows 7"/> <!-- check this!!!-->
[15124]153
154 <!-- this is true for linux and macs -->
155 <condition property="current.os.isunix">
156 <os family="unix"/>
157 </condition>
158
159 <condition property="current.os.isunixnotmac">
160 <and>
161 <os family="unix"/>
162 <not>
[19933]163 <os family="mac"/>
[15124]164 </not>
165 </and>
166 </condition>
[19878]167
[15124]168 <condition property="current.os.ismac">
169 <os family="mac"/>
170 </condition>
171
172 <condition property="current.os.iswindows">
173 <os family="windows"/>
174 </condition>
175
[19933]176 <!-- is there a better way to do this?? what about solaris?? -->
177 <condition property="os.bin.dir" value="windows">
178 <os family="windows"/>
179 </condition>
180 <condition property="os.bin.dir" value="darwin">
181 <os family="mac"/>
182 </condition>
183 <condition property="os.bin.dir" value="linux">
184 <and>
185 <os family="unix"/>
186 <not>
187 <os family="mac"/>
188 </not>
189 </and>
190 </condition>
191
192
[19878]193 <condition property="collection.building.disabled">
[20464]194 <and>
195 <isset property="disable.collection.building"/>
196 <istrue value="${disable.collection.building}"/>
197 </and>
[19878]198 </condition>
199
[15124]200 <condition property="collection.building.enabled">
201 <not>
[20464]202 <istrue value="${disable.collection.building}"/>
[15124]203 </not>
204 </condition>
[19878]205
[15124]206 <condition property="collection.building.enabled.windows">
207 <and>
[20464]208 <istrue value="${collection.building.enabled}"/>
[15124]209 <isset property="current.os.iswindows"/>
210 </and>
211 </condition>
212
213 <condition property="collection.building.enabled.unix">
214 <and>
[20464]215 <istrue value="${collection.building.enabled}"/>
[15124]216 <isset property="current.os.isunix"/>
217 </and>
218 </condition>
[22847]219
[20085]220 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
[19931]221 <isset property="compile.static"/>
222 </condition>
[22184]223
[22845]224 <!-- If building a release then we want to adjust environment variables so that the support library can be see during compilation -->
225 <if><bool><isset property="use.support.lib"/></bool>
[23599]226 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
[22845]227
[23599]228 <if><bool><isset property="env.CFLAGS"/></bool>
229 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
230 <else>
231 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
232 </else>
233 </if>
[22845]234
[23599]235 <if><bool><isset property="env.CPPFLAGS"/></bool>
236 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
237 <else>
238 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
239 </else>
240 </if>
[22847]241
[23599]242 <if><bool><isset property="env.CXXFLAGS"/></bool>
243 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
244 <else>
245 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
246 </else>
247 </if>
248
249 <if><bool><isset property="env.LDFLAGS"/></bool>
250 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
251 <else>
252 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
253 </else>
254 </if>
255
256 <if><bool><isset property="env.PATH"/></bool>
257 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
258 <else>
259 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
260 </else>
261 </if>
262
263 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
264 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
265 <else>
266 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
267 </else>
268 </if>
269
[23611]270 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
271 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
272 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
273 <else>
274 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
275 </else>
276 </if>
[23599]277 <else>
[23611]278 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
279 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
280 <else>
281 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
282 </else>
283 </if>
[23599]284 </else>
285 </if>
286
287 <else>
288 <if><bool><isset property="env.CFLAGS"/></bool>
289 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
290 <else>
291 <property name="cflags.arg" value=" "/>
292 </else>
293 </if>
294
295 <if><bool><isset property="env.CPPFLAGS"/></bool>
296 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
297 <else>
298 <property name="cppflags.arg" value=" "/>
299 </else>
300 </if>
301
302 <if><bool><isset property="env.CXXFLAGS"/></bool>
303 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
304 <else>
305 <property name="cxxflags.arg" value=" "/>
306 </else>
307 </if>
308
309 <if><bool><isset property="env.LDFLAGS"/></bool>
310 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
311 <else>
312 <property name="ldflags.arg" value=" "/>
313 </else>
314 </if>
315
316 <if><bool><isset property="env.PATH"/></bool>
317 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
318 <else>
319 <property name="path.arg" value=" "/>
320 </else>
321 </if>
322
323 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
324 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
325 <else>
326 <property name="pcpath.arg" value=" "/>
327 </else>
328 </if>
329
[23611]330 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
331 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
332 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
333 <else>
334 <property name="ldlpath.arg" value=" "/>
335 </else>
336 </if>
[23599]337 <else>
[23611]338 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
339 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
340 <else>
341 <property name="ldlpath.arg" value=" "/>
342 </else>
343 </if>
344 </else>
[23599]345 </if>
346 </else>
[22868]347 </if>
[23611]348 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
[22868]349
[22184]350 <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
351 <istrue value="${with.jni}"/>
352 </condition>
353 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
354 <istrue value="${with.jni}"/>
355 </condition>
356 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
357 <istrue value="${with.jni}"/>
358 </condition>
359 <condition property="gs2.windows.enablejni" value="1" else="0">
360 <istrue value="${with.jni}"/>
361 </condition>
[22976]362 <condition property="gs2.windows.enablemg" value="1" else="0">
363 <istrue value="${with.jni}"/>
364 </condition>
365 <condition property="gs2.windows.enablemgpp" value="1" else="0">
366 <istrue value="${with.jni}"/>
367 </condition>
368 <!-- Should accent folding not also be set here ?? -->
369 <condition property="gs2.windows.usegdbm" value="1" else="0">
370 <istrue value="${with.jni}"/>
371 </condition>
372 <condition property="gs2.windows.usesqlite" value="1" else="0">
373 <istrue value="${with.jni}"/>
374 </condition>
[19931]375
[15799]376 <!-- where is search4j tool -->
[20085]377 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
[15799]378 <isset property="current.os.iswindows"/>
[15136]379 </condition>
380
[15799]381
[15124]382 <!-- ============= Base dirs for each package and component ============ -->
383 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
384 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
385 <property name="gli.home" value="${basedir}/gli"/>
386 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
387
[21347]388 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
[20464]389 <istrue value="${disable.collection.building}"/>
[19871]390 </condition>
[19931]391
392 <property name="build.src.home" value="${gs2build.home}/build-src"/>
[19871]393 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
394 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
395 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
396 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
397
[15799]398 <!-- ==================== Compilation Control Options ==================== -->
[15124]399
[15799]400 <!--
[15124]401
402 These properties control option settings on the Javac compiler when it
403 is invoked using the <javac> task.
404
405 compile.debug Should compilation include the debug option?
406
407 compile.deprecation Should compilation include the deprecation option?
408
409 compile.optimize Should compilation include the optimize option?
410
[15799]411 -->
[15124]412
413 <property name="compile.debug" value="true"/>
414 <property name="compile.deprecation" value="true"/>
415 <property name="compile.optimize" value="true"/>
416
[15799]417 <!--
[15124]418
419 Rather than relying on the CLASSPATH environment variable, Ant includes
420 features that makes it easy to dynamically construct the classpath you
421 need for each compilation. The example below constructs the compile
422 classpath to include the servlet.jar file, as well as the other components
423 that Tomcat makes available to web applications automatically, plus anything
424 that you explicitly added.
425
[15799]426 -->
[20079]427
428 <!-- All elements that Tomcat 5 exposes to applications -->
429 <path id="tomcat5">
[20085]430 <pathelement location="${catalina.home}/common/classes"/>
431 <fileset dir="${catalina.home}/common/endorsed">
432 <include name="*.jar"/>
433 </fileset>
434 <fileset dir="${catalina.home}/common/lib">
435 <include name="*.jar"/>
436 </fileset>
437 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
438 <pathelement location="${catalina.home}/shared/classes"/>
439 <fileset dir="${catalina.home}/shared/lib">
440 <include name="*.jar"/>
441 </fileset>
[20079]442 </path>
443
444 <!-- All elements that Tomcat 6 exposes to applications -->
445 <path id="tomcat6">
[20085]446 <fileset dir="${catalina.home}/lib">
447 <include name="*.jar"/>
448 </fileset>
[20079]449 </path>
450
[15124]451 <path id="compile.classpath">
452 <!-- Include all jar files and libraries in our jni lib directory -->
453 <pathelement location="${lib.jni}"/>
454 <fileset dir="${lib.jni}">
455 <include name="*.jar"/>
456 </fileset>
457 <!-- Include all jar files in our web lib directory -->
458 <pathelement location="${web.lib}"/>
459 <fileset dir="${web.lib}">
460 <include name="*.jar"/>
461 </fileset>
462
[18110]463 <pathelement location="${lib.java}"/>
464 <fileset dir="${lib.java}">
465 <include name="*.jar"/>
466 </fileset>
[15124]467
468 <!-- include the jar files from the source packages -->
469 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
470 so we add them in by name -->
[22184]471 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
[15124]472 <pathelement location="${lib.jni}/mg.jar"/>
473 <pathelement location="${lib.jni}/mgpp.jar"/>
474
[20085]475 <!-- Include all elements that Tomcat exposes to applications -->
476 <path refid="tomcat${tomcat.version.major}"/>
477
[15124]478 </path>
479
480 <path id="local.tomcat.classpath">
481 <!-- explicitly include the jni java wrappers in the classpath -->
482 <pathelement location="${lib.jni}"/>
483 <fileset dir="${lib.jni}">
484 <include name="*.jar"/>
485 </fileset>
486 </path>
487
488 <path id="local.tomcat.path">
489 <pathelement location="${basedir}/bin/script"/>
490 <pathelement location="${basedir}/bin"/>
491 <pathelement location="${lib.jni}"/>
492 <pathelement path="${env.PATH}"/>
493 <pathelement path="${env.Path}"/>
494 <pathelement path="${wn.home}/bin"/>
495 </path>
496
497 <target name="test-setup">
498 <echo>ant java version=${ant.java.version}</echo>
499 <echo>is unix : ${current.os.isunix}</echo>
500 <echo>is mac : ${current.os.ismac}</echo>
501 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
502 <echo>is windows : ${current.os.iswindows}</echo>
503 <echo>os.unix: ${os.unix}</echo>
504 </target>
[20085]505
[15799]506 <!-- ==================== Primary and Global Targets ============================= -->
[15124]507
[19873]508 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
[15124]509 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.">
510
511 <!-- make sure .sh files are executable -->
512 <chmod dir="${basedir}" perm="ugo+rx"
513 includes="*.sh"/>
514 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
515 includes="*.sh,*.pl"/>
516 </target>
[16936]517
[19871]518 <!-- 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 -->
[19878]519 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
[19843]520 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
521
[19931]522 <target name="install-common-src" depends="init"
523 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
[19894]524 <antcall target="configure-common-src"/>
525 <antcall target="compile-common-src"/>
526 <antcall target="install-auxiliary-jar-files"/>
527 <antcall target="install-jni-files"/>
528 </target>
[19878]529
[19894]530 <target name="install-collection-building" depends="init" if="collection.building.enabled"
531 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
532 <antcall target="configure-collection-building"/>
[19931]533 <antcall target="tweak-makefiles" />
[19894]534 <antcall target="compile-collection-building"/>
535 </target>
536
[19878]537
[20209]538 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
[19878]539 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
540
541 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
[15124]542 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
543
544 <target name="configure" depends="init,configure-tomcat,configure-web"
[23855]545 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."/>
[15124]546
[20209]547 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
[19878]548 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
[15124]549
[20209]550 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
[19878]551 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
[15799]552
[19878]553 <target name="update" depends="init,svnupdate,clean,install"
554 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'"/>
[15124]555
[23854]556
557 <target name="perl-for-building" depends="init">
558 <!-- uses perl.path if set in build.properties, otherwise try for
559 environment variable PERLPATH, and failing that assumes 'perl'
560 is on environment PATH -->
[23856]561 <!-- 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 -->
[23857]562 <if><bool><available file="${gs2build.home}"/></bool>
[23854]563
564 <if><bool><not><isset property="perl.path"/></not></bool>
565
566 <if>
567 <bool>
568 <and>
569 <isset property="env.PERLPATH"/>
570 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
571 </and>
572 </bool>
573 <property name="perl.path" value="${env.PERLPATH}"/>
574 <else>
575 <echo>
[23896]576 Using PATH environment variable to locate Perl.
[23854]577 </echo>
578 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
579 <arg value="perl" />
580 </exec>
581
[23941]582 <exec executable="${gs2build.home}/bin/windows/which" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
583 <arg value="perl" />
584 </exec>
[23896]585
[23854]586 <stringutil string="${full.perl.path}" property="perl.path">
[23896]587 <replace regex="\/[^\/]*$" replacement="" />
[23854]588 </stringutil>
[23896]589 <if><bool><istrue value="${current.os.isunix}"/></bool>
590
591 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
592 <echo>
[23854]593 Non-standard location of Perl found: ${full.perl.path}
594 Set the environment variable PERLPATH or the perl.path property in
595 build.properties to explicitly control the version of Perl used.
[23896]596 </echo>
597 </if>
[23854]598 </if>
599 </else>
600 </if>
601 </if>
602
603 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
604 <if><bool><isset property="perl.path"/></bool>
605 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
606 <else>
607 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
608 </else>
609 </if>
[23857]610
611 <!-- gs2build not available, perl.path -->
612 <else>
613 <property name="perl.path" value=""/>
614 </else>
615 </if>
[23854]616 </target>
617
618 <target name="start" depends="init,configure-web,start-tomcat"
[15124]619 description="Startup the Tomcat server." >
[15799]620 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
[16936]621 <echo>Tomcat: ${catalina.home}</echo>
622 <echo>Java : ${java.home}</echo>
[23849]623 <if><bool><available file="${build.src.home}"/></bool>
624 <echo>Perl : ${full.perl.path}</echo>
625 </if>
[23936]626 <if><bool><isset property="install.flax"/></bool>
627 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
628 <else>
629 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
630 </else>
631 </if>
632 <echo>URL : ${url}</echo>
[15799]633 <!-- assuming that index.html is not needed here -->
[15124]634 </target>
635
636 <target name="stop" depends="init,stop-tomcat"
637 description="Shutdown the Tomcat server."/>
638
639 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
640
641
[15799]642 <!-- =========== Help targets =================================== -->
[15124]643
644 <property name="install-command" value="ant [options] prepare install"/>
645
646 <target name="usage" description="Print a help message">
647 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
648 <echo message=" Execute 'ant -help' for Ant help."/>
[23849]649 <echo>
650 To install Greenstone3, run '${install-command}'.
651 There are properties defined in build.properties. The install
652 process will ask you if these properties are set correctly.
653 To avoid this prompt, use the '-Dproperties.accepted=yes'
654 option.
655 To log the output, use the '-logfile build.log' option.
656 The README.txt file has more information about the ant targets
657 and install process.
[15124]658 </echo>
659 </target>
660
661 <target name="help" depends="usage" description="Print a help message"/>
662
663 <target name="debug" depends="init" description="Display all the currently used properties">
664 <echoproperties/>
665 </target>
666
[15799]667 <!-- ====== initialization and setup targets ================== -->
[15124]668
669 <target name="accept-properties" unless="properties.accepted">
670 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
[15799]671 tomcat.server=${tomcat.server}
672 tomcat.port=${tomcat.port}
673 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
674 proxy.host=${proxy.host}
675 proxy.port=${proxy.port}
[19878]676 disable.collection.building=${disable.collection.building}
[19910]677 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
[15124]678 </input>
679 <condition property="do.abort">
680 <equals arg1="n" arg2="${properties.ok}"/>
681 </condition>
682 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
683 </target>
[20085]684
[15124]685 <!-- this sets up some initial properties -->
686 <target name="init">
687
[20085]688 <!-- has the gs3-setup script been run?? -->
689 <condition property="gs3-setup-not-done">
690 <not>
691 <isset property="env.GSDL3HOME"/>
692 </not>
693 </condition>
694
[20092]695 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
[20085]696
[15124]697 <condition property="java.too.old">
698 <or>
[16936]699 <equals arg1="1.1" arg2="${ant.java.version}"/>
700 <equals arg1="1.2" arg2="${ant.java.version}"/>
701 <equals arg1="1.3" arg2="${ant.java.version}"/>
[15124]702 </or>
703 </condition>
[20208]704 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
[15124]705
706 <available file="${basedir}/gli" property="gli.present"/>
[19878]707 <available file="${basedir}/common-src" property="common.src.present"/>
[15124]708 <available file="${basedir}/gs2build" property="gs2build.present"/>
709
710 <condition property="tomcat.islocal">
711 <or>
[16936]712 <not><isset property="tomcat.installed.path"/></not>
713 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]714 </or>
715 </condition>
716
[15799]717 <echo>tomcat.port = ${tomcat.port}</echo>
[15124]718
719 <condition property="proxy.present">
720 <and>
[16936]721 <isset property="proxy.host"/>
722 <not><equals arg1="" arg2="${proxy.host}"/></not>
[15124]723 </and>
724 </condition>
725
[20235]726 <!--
[20290]727 the next block checks if the bundled tomcat is present in the 'packages' directory,
728 and checks for the lethal combination of tomcat 6 and java 1.4. Test for
729 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
730 download, as there is no other surefire way to check tomcat version under java 1.4
[20235]731 -->
732 <condition property="packages.tomcat.ispresent" value="true" else="false">
733 <available file="packages/tomcat"/>
734 </condition>
[20290]735 <condition property="packages.tomcat.istomcat6" value="true" else="false">
736 <available file="packages/tomcat/tomcat6.txt"/>
737 </condition>
[20235]738 <if>
739 <bool>
[20290]740 <and>
741 <istrue value="${packages.tomcat.ispresent}"/>
742 <istrue value="${packages.tomcat.istomcat6}"/>
743 <equals arg1="1.4" arg2="${ant.java.version}"/>
744 </and>
[20235]745 </bool>
[20290]746 <fail>Your Java (version 1.4) is too old to work with the bundled Apache Tomcat (version 6). Please upgrade to Java version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
[20235]747 </if>
748
[15124]749 </target>
750
751 <target name="setup-proxy" depends="init" if="proxy.present">
752 <condition property="ask.user">
753 <or>
[16936]754 <equals arg1="" arg2="${proxy.user}"/>
755 <equals arg1="" arg2="${proxy.password}"/>
[15124]756 </or>
757 </condition>
[19878]758
[15124]759 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
760 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
761 </target>
762
[15799]763 <!-- ========== Web app Targets ================================ -->
764
[20089]765 <target name="prepare-web" depends="init">
[15124]766 <mkdir dir="${web.home}/applet"/>
767 <mkdir dir="${web.home}/logs"/>
768 </target>
769
[24607]770 <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib, but if we are using java 1.4, we can't have it there.
771 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
[15124]772 <target name="configure-java-version" depends="init"
[15139]773 description="Activates or deactivates some jar libraries as needed depending on your java version">
[15136]774
[15799]775 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
[15124]776 <condition property="need.xalan.jar">
[15799]777 <or>
[24607]778 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
[15799]779 </or>
780 </condition>
[15136]781
[15799]782 <!-- if they have xalan.jar but dont need it -->
783 <if>
784 <bool>
[16936]785 <and>
786 <isset property="have.xalan.jar"/>
787 <not><isset property="need.xalan.jar"/></not>
788 </and>
[15799]789 </bool>
790 <antcall target="deactivate-xalan-jar"/>
791 </if>
[15136]792
[15799]793 <!-- if they need xalan.jar but dont have it -->
794 <if>
795 <bool>
[16936]796 <and>
797 <not><isset property="have.xalan.jar"/></not>
798 <isset property="need.xalan.jar"/>
799 </and>
[15799]800 </bool>
801 <antcall target="activate-xalan-jar"/>
802 </if>
[15136]803
[15124]804 </target>
805
[15139]806 <target name="activate-xalan-jar">
[15799]807 <echo>activating xalan.jar</echo>
[15124]808 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
[20085]809 <if>
810 <bool>
811 <and>
812 <isset property="current.os.ismac"/>
813 <available file="${catalina.home}/common/endorsed" type="dir"/>
814 </and>
815 </bool>
816 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
[15799]817 </if>
[15124]818 </target>
[15035]819
[15139]820 <target name="deactivate-xalan-jar">
[15799]821 <echo>deactivating xalan.jar</echo>
[15124]822 <delete file="${web.lib}/xalan.jar"/>
[20089]823 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
[15124]824 </target>
825
[15837]826
[16936]827 <target name="prepare-collections" depends="init">
828 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[17008]829 <property name="index.zip" value="index.zip"/>
[15799]830
[16936]831 <echo message="installing collections..."/>
832 <antcall target="gs2mgdemo-install"/>
833 <antcall target="gs2mgppdemo-install"/>
834 <antcall target="gberg-install"/>
835 </target>
[15837]836
[16936]837 <target name="gs2mgdemo-prepare" if="collect.dir">
838 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
[15799]839
[16936]840 <condition property="gs2mgdemo.present">
841 <and>
[15837]842 <available file="${gs2mgdemo.dir}/${index.zip}"/>
[16936]843 </and>
844 </condition>
845 </target>
[15799]846
[17008]847 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
[16936]848 <echo> installing gs2mgdemo</echo>
[17008]849 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
[16936]850 <echo>collection gs2mgdemo installed</echo>
851 </target>
[15799]852
[16936]853 <target name="gs2mgppdemo-prepare" if="collect.dir">
854 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
[15837]855
[16936]856 <condition property="gs2mgppdemo.present">
857 <and>
[15837]858 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
[16936]859 </and>
860 </condition>
861 </target>
[15799]862
[16936]863 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
[17008]864 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
[16936]865 <echo>collection gs2mgppdemo installed</echo>
866 </target>
[15799]867
[16936]868 <target name="gberg-prepare" if="collect.dir">
869 <property name="gberg.dir" value="${collect.dir}/gberg"/>
[17008]870 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
[16936]871 </target>
[15799]872
[16936]873 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
[19878]874 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
[16936]875 <echo>collection gberg installed</echo>
876 </target>
[15799]877
[23854]878 <target name="configure-web" depends="init,perl-for-building"
[15124]879 description="Configure only the web app config files">
880 <!-- we want a unix path in the global.properties file -->
881 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
882 <path path="${web.home}"/>
883 </pathconvert>
[24868]884 <stringutil string="${perl.path}" property="escaped.perl.path">
885 <replace regex="\\" replacement="\\\\" />
886 </stringutil>
887
[15124]888 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
889 <filter token="gsdl3version" value="${app.version}"/>
890 <filter token="tomcat.server" value="${tomcat.server}"/>
891 <filter token="tomcat.port" value="${tomcat.port}"/>
[24868]892 <filter token="perlpath" value="${escaped.perl.path}"/>
[15124]893 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
894 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
895 <chmod file="${web.classes}/global.properties" perm="600"/>
896 <chmod file="${web.classes}/log4j.properties" perm="600"/>
897 </target>
898
899 <target name="compile-web" depends="init">
900 <javac srcdir="${web.classes}"
901 destdir="${web.classes}"
902 debug="${compile.debug}"
903 deprecation="${compile.deprecation}"
904 optimize="${compile.optimize}">
[16936]905 <classpath><path refid="compile.classpath"/></classpath>
[15124]906 </javac>
907 </target>
908
[20209]909 <target name="compile-classpath-jars" depends="init">
910 <if><bool><available file="admin/cp.mf"/></bool>
911 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
912 </if>
913 <if><bool><available file="${lib.java}/cp.mf"/></bool>
914 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
915 </if>
916 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
917 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
918 </if>
919 <if><bool><available file="${web.lib}/cp.mf"/></bool>
920 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
921 </if>
922 <jar destfile="cp.jar">
923 <manifest>
[20211]924 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
[20209]925 </manifest>
926 </jar>
927 </target>
928
929 <target name="clean-classpath-jars" depends="init">
930 <delete file="admin/cp.jar"/>
931 <delete file="${lib.java}/cp.jar"/>
932 <delete file="${lib.jni}/cp.jar"/>
933 <delete file="${web.lib}/cp.jar"/>
934 <delete file="cp.jar"/>
935 </target>
936
937
[15799]938 <target name="svnupdate-web" unless="nosvn.mode">
[20930]939 <exec executable="svn">
940 <arg value="update"/>
941 <arg value="${web.home}"/>
942 <arg value="-r"/><arg value="${branch.revision}"/>
943 </exec>
[15799]944 </target>
[15124]945
946 <target name="update-web" depends="init,svnupdate-web,configure-web"
947 description="update only the web stuff (config files)"/>
948
[15799]949 <!-- ======================= Tomcat Targets ========================== -->
[15124]950
951 <!-- this target downloads and installs Tomcat -->
[20089]952 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
953 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
954 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 6 if using Java 1.5 or higher). If you want to change which version of Java you are using between 1.4 and 1.5/6 then you need to run prepare-tomcat">
[16951]955 <if>
956 <bool>
957 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
958 </bool>
959
960 <!-- check that packages dir is there -->
961 <mkdir dir="${packages.home}"/>
962 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
963 dest="${packages.home}/${tomcat.version}.zip"
964 usetimestamp="true"/>
965 <unzip src="${packages.home}/${tomcat.version}.zip"
966 dest="${packages.home}"/>
[20085]967
968 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
969 we would need to have the tomcat compat package to work with Java 1.4-->
970 <if>
971 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
972 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
973 dest="${packages.home}/${tomcat.version}-compat.zip"
974 usetimestamp="true"/>
975 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
976 dest="${packages.home}"/>
977 </if>
978
[16951]979 <!-- delete any existing tomcat -->
980 <delete dir="${packages.home}/tomcat"/>
981 <move todir="${packages.home}/tomcat">
982 <fileset dir="${packages.home}/${tomcat.version}"/>
983 </move>
984 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
985 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
986 overwrite="true"/>
987 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
988 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
989 overwrite="true"/>
990 <!-- make sure we have execute permission for the .sh files -->
991 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
992 includes="*.sh"/>
993
994 <echo file="${packages.home}/tomcat/.flagfile">
995 the timestamp of this file is the time that tomcat was extracted from the zip files.
996 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
997 </echo>
998
[20089]999 <!-- this is not strictly a prepare tomcat thing, but if one changes
1000 Java, then they need to change tomcat as well, so might as well call
1001 it here -->
1002 <antcall target="configure-java-version"/>
[16951]1003 <else>
1004 <echo>Tomcat has been prepared, will not prepare</echo>
1005 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1006 </else>
1007
1008 </if>
1009
[15124]1010 </target>
1011
1012 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1013
1014 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
1015 <!-- re-setup the server.xml file -->
[20079]1016 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1017 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
[15124]1018 <filterset>
[16936]1019 <filter token="port" value="${tomcat.port}"/>
1020 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
[15124]1021 </filterset>
1022 </copy>
1023 <!-- set up the greenstone3 context -->
1024 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1025 <filterset>
[16936]1026 <filter token="gsdl3webhome" value="${web.home}"/>
[22320]1027 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
[15124]1028 </filterset>
1029 </copy>
1030 </target>
1031
1032 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1033 <!-- re-setup the server.xml file -->
1034 <!-- need to edit the config file, or do we get the user to do this???-->
1035 </target>
[22551]1036
[23854]1037
1038
[22551]1039<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
[20089]1040 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
[15799]1041 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
[15124]1042 <property name="tomcat.path" refid="local.tomcat.path"/>
1043 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
[21351]1044 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]1045 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1046 <env key="GSDL3HOME" value="${basedir}"/>
1047 <env key="PATH" path="${tomcat.path}"/>
1048 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1049 <env key="CATALINA_HOME" value="${catalina.home}"/>
1050 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1051 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
[22184]1052 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
[15124]1053 <env key="WNHOME" path="${wn.home}"/>
1054 </exec>
[21351]1055 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
[15124]1056 <env key="GSDLOS" value="windows"/>
1057 <env key="GSDL3HOME" value="${basedir}"/>
1058 <env key="Path" path="${tomcat.path}"/>
1059 <env key="PATH" path="${tomcat.path}"/>
1060 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
[16628]1061 <env key="CATALINA_HOME" value="${catalina.home}"/>
[15124]1062 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1063 </exec>
1064 <!-- wait for the server to startup in case other targets need it running -->
1065 <waitfor maxwait="5" maxwaitunit="second">
1066 <and>
[16936]1067 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1068 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
[15124]1069 </and>
1070 </waitfor>
1071 </target>
1072
[22551]1073 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1074 <target name="reconfigure" description="Reconfigure the message router">
1075 <waitfor maxwait="5" maxwaitunit="second">
1076 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1077 </waitfor>
1078 </target>
1079
1080 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1081 <target name="reconfigure-collection" description="Reconfigure the collection">
1082 <waitfor maxwait="5" maxwaitunit="second">
1083 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1084 </waitfor>
1085 </target>
1086
[15124]1087 <!-- windows: do we want to launch a webrowser?? -->
1088 <!-- shouldn't this test whether anything is running first? -->
1089 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
[21351]1090 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]1091 <env key="CATALINA_HOME" value="${catalina.home}"/>
1092 </exec>
[21351]1093 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
[16628]1094 <env key="CATALINA_HOME" value="${catalina.home}"/>
1095 </exec>
[15124]1096 </target>
1097
1098 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1099
1100 <target name="setup-catalina-ant-tasks">
1101 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1102 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1103 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1104 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1105 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1106 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1107 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1108 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1109 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1110 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1111 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1112 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1113 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1114 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1115 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1116 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1117 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1118 </target>
1119
1120
[15799]1121 <!-- ======================= ant Targets ============================ -->
[15124]1122 <target name="prepare-ant" depends="init">
[16951]1123 <if>
1124 <bool>
1125 <not><available file="${packages.home}/ant/.flagfile"/></not>
1126 </bool>
1127
1128 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1129 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1130 usetimestamp="true"/>
1131 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1132 dest="${packages.home}"/>
1133 <move todir="${packages.home}/ant">
1134 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1135 </move>
1136 <echo file="${packages.home}/ant/.flagfile">
1137 the timestamp of this file is the time that ant was extracted from the zip files.
1138 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1139 </echo>
1140
1141 <else>
1142 <echo>Ant has been prepared, will not prepare</echo>
1143 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1144 </else>
1145
1146 </if>
[15124]1147 </target>
1148
[20079]1149 <!-- ======================= Axis Targets ============================ -->
1150
[15124]1151 <target name="prepare-axis" depends="init">
[16951]1152
1153 <if>
1154 <bool>
1155 <not><available file="${packages.home}/axis/.flagfile"/></not>
1156 </bool>
1157
1158 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1159 dest="${packages.home}/${axis.zip.version}"
1160 usetimestamp="true"/>
1161 <unzip src="${packages.home}/${axis.zip.version}"
1162 dest="${packages.home}"/>
1163 <move todir="${packages.home}/axis">
1164 <fileset dir="${packages.home}/${axis.dir.version}"/>
1165 </move>
1166 <!-- install axis into greenstone web app -->
1167 <copy todir="${web.lib}">
1168 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1169 <include name="*.jar"/>
1170 </fileset>
1171 </copy>
1172 <copy todir="${web.home}">
1173 <fileset dir="${packages.home}/axis/webapps/axis/">
1174 <include name="*.jsp"/>
1175 <include name="*.jws"/>
1176 </fileset>
1177 </copy>
1178 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1179 <copy todir="${web.classes}">
1180 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1181 <include name="*.properties"/>
1182 </fileset>
1183 </copy>
1184 <echo file="${packages.home}/axis/.flagfile">
1185 the timestamp of this file is the time that axis was extracted from the zip files.
1186 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1187 </echo>
1188
1189 <else>
1190 <echo>Axis has been prepared, will not prepare</echo>
1191 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1192 </else>
1193
1194 </if>
[15124]1195 </target>
1196
[15229]1197 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
[15124]1198 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
[15799]1199
1200 <target name="deploy-site">
[15124]1201 <java classname="org.apache.axis.client.AdminClient">
1202 <classpath refid="compile.classpath"/>
1203 <arg value="-l"/>
1204 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]1205 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1206 </java>
1207 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
[15124]1208 </target>
1209
[15229]1210 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
[15124]1211 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
[15229]1212 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1213 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1214 tofile="${basedir}/resources/soap/undeploy.wsdd"
1215 filtering="true"
1216 overwrite="true"/>
[15124]1217 <java classname="org.apache.axis.client.AdminClient">
1218 <classpath refid="compile.classpath"/>
1219 <arg value="-l"/>
1220 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]1221 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
[15124]1222 </java>
[15229]1223 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
[15799]1224 </target>
[15124]1225
[16936]1226 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1227 with the default servicename of localsite-->
[15124]1228 <target name="deploy-localsite" depends="init"
1229 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1230 <antcall target="start-tomcat"/>
[15235]1231 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
[15229]1232 <antcall target="create-deployment-files">
1233 <param name="axis.sitename" value="localsite"/>
[15235]1234 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1235 <param name="axis.siteuri" value="localsite"/>
1236 </antcall>
[15124]1237 <antcall target="deploy-site">
1238 <param name="axis.sitename" value="localsite"/>
[15235]1239 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1240 <param name="axis.siteuri" value="localsite"/>
[15124]1241 </antcall>
[15369]1242 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
[15124]1243 </target>
[15799]1244
[16936]1245 <target name="get-sitename" unless="axis.sitename">
[15229]1246 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
[15235]1247Press Enter for default:localsite</input>
[15124]1248 </target>
1249
[15229]1250 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1251 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1252To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
[20209]1253Or press Enter for undeploying the default:localsite /&gt;</input>
[15229]1254 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
[15124]1255 </target>
1256
[15229]1257 <target name="get-webservices" unless="axis.servicesname">
[15235]1258 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
[15229]1259Choose from: ${web.services.list}
[20209]1260Or press Enter for default:${base.webservice.name} /&gt;</input>
[15229]1261 <echo>${axis.servicesname}</echo>
1262 </target>
1263
1264 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
[15235]1265 <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
[15229]1266 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1267 </target>
1268
1269 <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC" if="axis.servicesname">
1270 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
[15235]1271 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15124]1272 </condition>
[15229]1273
1274 <!--everything else defaults to java:RPC at present-->
1275 <condition property="soap.method" value="provider='java:RPC'">
1276 <not>
[15235]1277 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15229]1278 </not>
1279 </condition>
[16936]1280 </target>
[15799]1281
[16936]1282 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
[15124]1283 <filter token="sitename" value="${axis.sitename}"/>
1284 <filter token="siteuri" value="${axis.siteuri}"/>
[15229]1285 <filter token="servicesname" value="${axis.servicesname}"/>
1286 <filter token="soapmethod" value="${soap.method}"/>
[15124]1287 <copy file="${basedir}/resources/soap/site.wsdd.template"
[15229]1288 tofile="${basedir}/resources/soap/deploy.wsdd"
1289 filtering="true"
1290 overwrite="true"/>
[15124]1291 <!-- create the java files and compile them -->
[15229]1292 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1293 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1294 filtering="true"
1295 overwrite="true"/>
[15124]1296 <mkdir dir="${build.home}"/>
1297 <javac srcdir="${src.home}"
1298 destdir="${build.home}"
1299 debug="${compile.debug}"
1300 deprecation="${compile.deprecation}"
1301 optimize="${compile.optimize}">
1302 <classpath refid="compile.classpath"/>
[15229]1303 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
[15124]1304 </javac>
1305 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
[15799]1306 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1307 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1308 overwrite="true" />
[15124]1309 </target>
[15799]1310
[15124]1311
[15799]1312 <!-- ====================== Core targets ============================== -->
1313 <!-- core targets refer to the core gsdl3 java src -->
[15124]1314
[19878]1315 <target name="prepare-core"/>
[15124]1316
1317 <target name="configure-core"/>
1318
1319 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1320 description="Update only the Greenstone core" />
1321
[15799]1322 <target name="svnupdate-core" unless="nosvn.mode">
[20930]1323 <exec executable="svn">
1324 <arg value="update"/>
1325 <arg value="${basedir}"/>
1326 <arg value="-r"/><arg value="${branch.revision}"/>
1327 </exec>
[15124]1328 </target>
1329
1330 <target name="clean-core"
1331 description="Clean only the Greenstone core">
[19878]1332 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
[15124]1333 <delete dir="${build.home}"/>
1334 </target>
1335
[15799]1336 <target name="compile-core" depends="init"
[15124]1337 description="Compile only the Greenstone core">
1338 <mkdir dir="${build.home}"/>
[23803]1339 <if><bool><isset property="with.jni"/></bool>
1340 <javac srcdir="${src.home}"
1341 destdir="${build.home}"
1342 debug="${compile.debug}"
1343 deprecation="${compile.deprecation}"
1344 optimize="${compile.optimize}">
1345 <classpath>
1346 <path refid="compile.classpath"/>
1347 </classpath>
1348 </javac>
1349 <else>
1350 <property name="gsprefix" value=""/>
1351 <javac srcdir="${src.home}"
1352 destdir="${build.home}"
1353 debug="${compile.debug}"
1354 deprecation="${compile.deprecation}"
1355 optimize="${compile.optimize}">
1356 <classpath>
1357 <path refid="compile.classpath"/>
1358 </classpath>
1359 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1360 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1361 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1362 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1363 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1364 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1365 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1366 </javac>
1367 </else>
1368 </if>
[15124]1369 <jar destfile="${build.home}/gsdl3.jar">
1370 <fileset dir="${build.home}">
[16936]1371 <include name="org/greenstone/gsdl3/**"/>
[15124]1372 <include name="org/flax/**"/>
[16936]1373 <exclude name="**/Test.class"/>
[15124]1374 </fileset>
1375 <manifest>
[16936]1376 <attribute name="Built-By" value="${user.name}" />
[15124]1377 </manifest>
1378 </jar>
1379 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
[22101]1380
1381 <jar destfile="${build.home}/gutil.jar">
1382 <fileset dir="${build.home}">
1383 <include name="org/greenstone/util/**"/>
1384 </fileset>
1385 <manifest>
1386 <attribute name="Built-By" value="${user.name}" />
1387 </manifest>
1388 </jar>
1389 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1390
[15124]1391 <!-- copy the localsite server in case we need it -->
[15235]1392 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
[15124]1393
[17918]1394 <!-- Greenstone Administrator Interface -->
[15124]1395 <jar destfile="${build.home}/GAI.jar">
1396 <fileset dir="${build.home}">
[16936]1397 <include name="org/greenstone/admin/**"/>
[15124]1398 </fileset>
1399 <manifest>
[16936]1400 <attribute name="Built-By" value="${user.name}" />
[15124]1401 </manifest>
1402 </jar>
[17917]1403 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
[18124]1404 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
[15124]1405 <jar destfile="${build.home}/phind.jar">
1406 <fileset dir="${build.home}">
[16936]1407 <include name="org/greenstone/applet/phind/**"/>
[15124]1408 </fileset>
1409 <manifest>
[16936]1410 <attribute name="Built-By" value="${user.name}" />
[15124]1411 </manifest>
1412 </jar>
1413 <mkdir dir="${web.applet}"/>
1414 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1415 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
[18515]1416 <if>
1417 <bool><istrue value="${tomcat.islocal}"/></bool>
[20085]1418 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1419 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
[18515]1420 </if>
1421
1422
[17116]1423 <!-- skip anttasks for now
[15124]1424 <jar destfile="${build.home}/anttasks.jar">
1425 <fileset dir="${build.home}">
[16936]1426 <include name="org/greenstone/anttasks/**"/>
[15124]1427 </fileset>
1428 <manifest>
[16936]1429 <attribute name="Built-By" value="${user.name}" />
[15124]1430 </manifest>
1431 </jar>
[17116]1432 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
[15124]1433 <jar destfile="${build.home}/gsdl3test.jar">
1434 <fileset dir="${build.home}">
[16936]1435 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1436 <include name="org/greenstone/testing/**"/>
[15124]1437 </fileset>
1438 <manifest>
[16936]1439 <attribute name="Built-By" value="${user.name}" />
[15124]1440 </manifest>
1441 </jar>
1442 <jar destfile="${build.home}/server.jar">
1443 <fileset dir="${build.home}">
[16936]1444 <include name="org/greenstone/server/**"/>
[22634]1445 <include name="org/greenstone/util/**"/>
[15124]1446 </fileset>
1447 <fileset file="${basedir}/resources/java/server.properties"/>
1448 <manifest>
[16936]1449 <attribute name="Built-By" value="${user.name}"/>
[15124]1450 </manifest>
1451 </jar>
1452 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1453 </target>
[15799]1454
1455 <!-- ================== Packages targets ================================ -->
[15124]1456 <!-- these targets refer to the greenstone source packages - these need
1457 updating less often, so are in separate targets to the core -->
[19871]1458 <target name="prepare-packages" depends="init"/>
[15124]1459
1460 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1461 description="Update only the source packages"/>
1462
[15799]1463 <target name="svnupdate-packages" unless="nosvn.mode">
[20930]1464 <exec executable="svn">
1465 <arg value="update"/>
1466 <arg value="${src.packages.home}"/>
1467 <arg value="-r"/><arg value="${branch.revision}"/>
1468 </exec>
[15124]1469 </target>
[19931]1470
[15124]1471
[19871]1472 <target name="configure-packages" depends="init,configure-javagdbm"
[15124]1473 description="Configure only the packages."/>
1474
[22184]1475 <target name="configure-javagdbm" if="with.jni">
[15124]1476 <echo>
1477 Configuring JavaGDBM
1478 </echo>
[18417]1479
[19904]1480 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15124]1481 <arg value="--prefix=${basedir}"/>
1482 <arg value="--libdir=${lib.jni}"/>
[19873]1483 <arg value="--with-gdbm=${gdbm.home}"/>
[15124]1484 </exec>
1485 </target>
1486
[19871]1487 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
[15124]1488
1489 <target name="clean-javagdbm" depends="init">
1490 <exec executable="make" os="${os.unix}"
[19904]1491 dir="${javagdbm.home}" failonerror="true">
[15124]1492 <arg value="clean"/>
1493 </exec>
1494 </target>
1495
[19871]1496 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
[15185]1497
[15799]1498 <target name="distclean-javagdbm" depends="init">
1499 <exec executable="make" os="${os.unix}"
[19904]1500 dir="${javagdbm.home}" failonerror="true">
[15799]1501 <arg value="distclean"/>
1502 </exec>
1503 </target>
1504
1505 <target name="compile-packages" description="Compile only the source packages">
[22184]1506 <!-- javagdbm -->
1507 <antcall target="compile-javagdbm"/>
1508 <!-- Search4j -->
1509 <antcall target="compile-search4j"/>
1510 </target>
1511
1512 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
[15799]1513
[19878]1514 <!-- unix: -->
[15799]1515 <echo>compile javagdbm</echo>
[19904]1516 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1517 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15799]1518 <arg value="install"/>
1519 </exec>
[15098]1520
[23852]1521 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1522 "all" which will then perform both the compile AND link targets in jni/win32.mak
1523 (thereby also generating gdbmjava.dll). Then we run the same command with
1524 the "install" argument to copy the gdbmjava.dll into the correct location. -->
[23849]1525 <echo>Windows: compile javagdbm</echo>
[24076]1526 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1527 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23852]1528 </exec>
1529 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
[24076]1530 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23847]1531 <arg value="install"/>
[15799]1532 </exec>
[15124]1533
[15799]1534 <!-- install the jar file -->
[23847]1535 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
[15799]1536 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1537 </target>
1538
[17491]1539 <target name="compile-search4j">
[17509]1540
[19996]1541 <!-- windows -->
[19997]1542 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[19996]1543 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1544 <arg value="/f"/>
1545 <arg value="win32.mak"/>
1546 <arg value='BINDIR="${basedir}\bin"'/>
1547 </exec>
1548 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1549 <arg value="/f"/>
1550 <arg value="win32.mak"/>
1551 <arg value="install"/>
1552 <arg value='BINDIR="${basedir}\bin"'/>
1553 </exec>
[17509]1554
[19996]1555 <!-- unix -->
[19997]1556 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
[19996]1557 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1558 <arg value="--bindir=${basedir}/bin"/>
1559 <arg value="${static.arg}"/>
1560 </exec>
1561 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1562 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1563 <arg value="install"/>
1564 </exec>
[17509]1565
[19996]1566 <!-- else warn -->
1567 <else>
1568 <fail>this target does not support the current os</fail>
[17509]1569
[19996]1570 </else></if></else></if>
1571
[17491]1572 </target>
1573
[19871]1574 <target name="install-auxiliary-jar-files" depends="init">
[22184]1575
1576 <if>
1577 <bool><available file="${mg.home}/mg.jar"/></bool>
1578 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1579 </if>
1580
1581 <if>
[22199]1582 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
[22184]1583 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1584 </if>
1585
[24744]1586 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
[19871]1587 </target>
1588
[22976]1589 <target name="install-jni-files" depends="init" if="with.jni">
1590 <antcall target="install-jni-files-linux"/>
1591 <antcall target="install-jni-files-windows"/>
1592 <antcall target="install-jni-files-macos"/>
1593 </target>
[15124]1594
[15799]1595 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
[15124]1596 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1597 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
[15799]1598 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
[15124]1599 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1600 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
[15799]1601 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1602 </target>
1603 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
[15124]1604 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1605 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
[15799]1606 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
[15124]1607 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1608 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
[15799]1609 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1610 </target>
1611 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
[15124]1612 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1613 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1614 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
[15124]1615 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1616 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1617 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1618 </target>
1619
[19871]1620 <!-- ========common-src targets =================================-->
1621 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1622 collection building is not enabled -->
1623
1624 <target name="update-common-src" depends="init" if="collection.building.disabled">
1625 </target>
[19931]1626
[19871]1627 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
[20930]1628 <exec executable="svn">
1629 <arg value="update"/>
1630 <arg value="${common.src.home}"/>
1631 <arg value="-r"/><arg value="${branch.revision}"/>
1632 </exec>
[19871]1633 </target>
1634
[19878]1635 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
[19871]1636 <antcall target="checkout-common-src"/>
1637 <antcall target="unzip-windows-packages"/>
1638 </target>
1639
1640 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1641 <echo>checking out common-src</echo>
[20930]1642 <exec executable="svn">
1643 <arg value="checkout"/>
[21196]1644 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
[20930]1645 <arg value="common-src"/>
1646 <arg value="-r"/><arg value="${branch.revision}"/>
1647 </exec>
[19871]1648 </target>
1649
[19931]1650 <target name="configure-common-src" depends="init">
[19871]1651 <exec executable="${common.src.home}/configure" os="${os.unix}"
[19904]1652 dir="${common.src.home}" failonerror="true">
[19931]1653 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
[19933]1654 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
[22184]1655 <arg line="${gs2.opt.args}"/>
[22854]1656 <arg line="${static.arg}"/>
[23611]1657 <arg line="${allargs}"/>
[19871]1658 </exec>
1659 </target>
1660
[19931]1661 <target name="clean-common-src" depends="init">
[19871]1662 <!-- unix: -->
[19904]1663 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1664 <arg value="clean"/>
1665 </exec>
1666 <!-- windows: -->
[19904]1667 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1668 <arg value="/f"/>
1669 <arg value="win32.mak"/>
1670 <arg value="clean"/>
[19960]1671 <arg value="GSDLHOME=${gs2build.home}"/>
[19871]1672 </exec>
1673 </target>
[19931]1674 <target name="distclean-common-src" depends="init">
[19960]1675 <!-- unix: -->
[19904]1676 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1677 <arg value="distclean"/>
1678 </exec>
[19960]1679 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1680 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1681 <arg value="/f"/>
1682 <arg value="win32.mak"/>
1683 <arg value="clean"/>
1684 <arg value="GSDLHOME=${gs2build.home}"/>
1685 </exec>
[19871]1686 </target>
[19931]1687 <target name="compile-common-src" depends="init">
[19871]1688 <!-- unix: -->
[19904]1689 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1690 <arg value="${gs2.compile.target}"/>
[19871]1691 </exec>
1692 <!-- windows: -->
[19904]1693 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1694 <arg value="/f"/>
1695 <arg value="win32.mak"/>
[19934]1696 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]1697 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[22976]1698 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1699 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1700 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1701 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
[19871]1702 </exec>
1703 </target>
1704
[19843]1705 <!-- ======= collection-building targets ===========================-->
[15124]1706
[19843]1707 <target name="update-collection-building" if="collection.building.enabled"
[19931]1708 depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
[19843]1709 description="Update (SVN update, configure, compile etc) only the collection building components"/>
[15124]1710
[19843]1711 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1712 description="SVN update the collection building components">
1713 </target>
[15124]1714
[19843]1715 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
[15124]1716 </target>
1717
[19931]1718 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1719 description="Configure the collection building components">
[19843]1720 </target>
[15098]1721
[19948]1722 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
[19843]1723 description="Clean only the collection building components"
1724 if="collection.building.enabled"/>
[18495]1725
[19948]1726 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
[19843]1727 description="Distclean only the collection building components"
1728 if="collection.building.enabled"/>
1729
[19931]1730 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
[19843]1731 description="Compile only the collection building components">
[19931]1732 <!-- make install for common-src -->
1733 <!-- unix: -->
1734 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1735 <arg value="${gs2.install.target}"/>
[19931]1736 </exec>
1737
1738 <!-- windows: -->
1739 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1740 <arg value="/f"/>
1741 <arg value="win32.mak"/>
[21370]1742 <arg value="install"/>
[23837]1743 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]1744 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[23837]1745 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1746 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1747 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1748 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1749 <!--
1750 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1751 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
[19931]1752 </exec>
1753
1754 <!-- install gs2build indexers for windows -->
1755 <if>
1756 <bool><istrue value="${current.os.iswindows}"/></bool>
1757 <copy todir="${gs2build.home}/bin/windows">
1758 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1759 <include name="*.*"/>
1760 </fileset>
1761 </copy>
1762 </if>
1763
1764 <!-- LuceneWrapper jar file not installed by default -->
1765 <mkdir dir="${gs2build.home}/bin/java"/>
[24744]1766 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
[19931]1767
[15124]1768 </target>
[19843]1769
1770 <!-- ============== gli targets ================================= -->
[15799]1771 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
[19929]1772
[20930]1773 <exec executable="svn">
1774 <arg value="update"/>
1775 <arg value="${gli.home}"/>
1776 <arg value="-r"/><arg value="${branch.revision}"/>
1777 </exec>
1778
[21196]1779 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]1780 <arg value="export"/>
1781 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]1782 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
[20930]1783 </exec>
[21196]1784 <exec executable="svn" dir="web/WEB-INF/cgi">
1785 <arg value="export"/>
1786 <arg value="-r"/><arg value="${branch.revision}"/>
1787 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gsdlCGI.pm"/>
1788 </exec>
[20930]1789
[15124]1790 </target>
1791
[19843]1792 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
[19911]1793 <!-- checkout -->
[23808]1794 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
[19929]1795
[20930]1796 <exec executable="svn">
1797 <arg value="checkout"/>
[21196]1798 <arg value="${svn.root}/main/${branch.path}/gli"/>
[20930]1799 <arg value="-r"/><arg value="${branch.revision}"/>
1800 </exec>
1801
[21196]1802 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]1803 <arg value="export"/>
1804 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]1805 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
[20930]1806 </exec>
[21196]1807 <exec executable="svn" dir="web/WEB-INF/cgi">
1808 <arg value="export"/>
1809 <arg value="-r"/><arg value="${branch.revision}"/>
1810 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gsdlCGI.pm"/>
1811 </exec>
[20930]1812
[19911]1813 </if>
[15124]1814 </target>
[19843]1815
1816 <target name="clean-gli" depends="init" if="collection.building.enabled">
1817 <!-- gli -->
1818 <property name="gli.home" value="${basedir}/gli"/>
1819 <!-- linux -->
1820 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
[20826]1821 resolveExecutable="true" failonerror="true"/>
[19843]1822 <!-- windows -->
1823 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
[20826]1824 resolveExecutable="true" failonerror="true"/>
[19843]1825 </target>
1826
1827 <target name="compile-gli" depends="init" if="collection.building.enabled">
[23808]1828 <if><bool><isset property="with.gli.and.gems"/></bool>
[23807]1829 <!-- gli -->
1830 <property name="gli.home" value="${basedir}/gli"/>
[15098]1831
[23807]1832 <!-- linux -->
1833 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
1834 <!--remote gli-->
1835 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1836 resolveExecutable="true" failonerror="true"/>
1837 <!-- windows -->
1838 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
1839 <!--remote gli-->
1840 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1841 resolveExecutable="true" failonerror="true"/>
1842 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1843 </if>
[19843]1844 </target>
[15124]1845
[19843]1846 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
[21351]1847 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
[19843]1848 <env key="gsdl3path" path="${basedir}"/>
[19871]1849 <env key="gsdlpath" path="${gs2build.home}"/>
[19843]1850 </exec>
[21351]1851 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
[19843]1852 <env key="gsdl3path" path="${basedir}"/>
[19871]1853 <env key="gsdlpath" path="${gs2build.home}"/>
[19873]1854 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
[19843]1855 </exec>
[21351]1856 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
[19843]1857 <env key="GSDL3PATH" path="${basedir}"/>
[19871]1858 <env key="GSDLPATH" path="${gs2build.home}"/>
[19843]1859 </exec>
1860 <echo>Running GLI from Ant means that you don't get to see any of the terminal output. If you have problems with GLI and want to see the output, please run the script gli.sh/bat from the greenstone3/gli directory.
1861 </echo>
1862 </target>
1863
1864 <!-- ================ gs2build targets =========================== -->
1865
1866 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1867 <echo>svn updating gs2build</echo>
[20930]1868 <exec executable="svn">
1869 <arg value="update"/>
1870 <arg value="${gs2build.home}"/>
1871 <arg value="-r"/><arg value="${branch.revision}"/>
1872 </exec>
[15799]1873 </target>
[19843]1874
[15124]1875 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1876 <antcall target="checkout-gs2build"/>
1877 <antcall target="unzip-windows-packages"/>
1878 <antcall target="checkout-winbin"/>
1879 <antcall target="get-windows-binaries"/>
1880 <antcall target="delete-winbin"/>
1881 </target>
1882
[19843]1883 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1884 <echo>checking out gs2build</echo>
[20930]1885 <exec executable="svn">
1886 <arg value="checkout"/>
[21196]1887 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
[20930]1888 <arg value="-r"/><arg value="${branch.revision}"/>
1889 </exec>
1890
[21196]1891
[19843]1892 </target>
1893
[15124]1894 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
[15799]1895 unless="nosvn.mode">
[20930]1896
1897 <exec executable="svn">
1898 <arg value="checkout"/>
[21196]1899 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
[20930]1900 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]1901 <arg value="winbin"/>
[20930]1902 </exec>
1903
[15124]1904 </target>
1905
[15799]1906 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
[20930]1907 <exec executable="svn">
1908 <arg value="update"/>
1909 <arg value="winbin"/>
1910 <arg value="-r"/><arg value="${branch.revision}"/>
1911 </exec>
1912
[15799]1913 </target>
[15124]1914
1915 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1916 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1917 <fileset dir="${basedir}/winbin/bin"/>
1918 </move>
1919 </target>
[19843]1920
[15124]1921 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1922 <delete dir="${basedir}/winbin"/>
1923 </target>
1924
[19871]1925 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1926 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1927 dest="${common.src.home}/packages/windows/crypt"/>
[18179]1928 <untar compression="gzip"
[19871]1929 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1930 dest="${common.src.home}/packages/sqlite"/>
1931 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1932 dest="${common.src.home}/indexers/packages/windows/iconv"/>
[15799]1933 </target>
[19878]1934
[15124]1935 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1936 <!-- we want a windows path in the setup.bat file -->
1937 <pathconvert targetos="windows" property="gs2build.home.windows">
1938 <path path="${gs2build.home}"/>
1939 </pathconvert>
1940 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1941 <filterset>
[16620]1942 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
[15799]1943 </filterset>
[15124]1944 </move>
1945 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1946 </target>
1947
[19843]1948
[19948]1949 <target name="clean-build-src" depends="init" if="collection.building.enabled">
[19871]1950 <!-- unix: -->
[19948]1951 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]1952 <arg value="clean"/>
1953 </exec>
1954 <!-- windows: -->
[19948]1955 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[15799]1956 <arg value="/f"/>
1957 <arg value="win32.mak"/>
1958 <arg value="clean"/>
[19960]1959 <arg value="GSDLHOME=${gs2build.home}"/>
[15124]1960 </exec>
1961 </target>
1962
[19948]1963
1964 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
[19960]1965 <!-- unix: -->
[19948]1966 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]1967 <arg value="distclean"/>
1968 </exec>
[19960]1969 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1970 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1971 <arg value="/f"/>
1972 <arg value="win32.mak"/>
1973 <arg value="clean"/>
1974 <arg value="GSDLHOME=${gs2build.home}"/>
1975 </exec>
[15124]1976 </target>
[19843]1977
[19931]1978 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1979 description="Configure the build-src component">
1980 <exec executable="${build.src.home}/configure" os="${os.unix}"
1981 dir="${build.src.home}" failonerror="true">
1982 <arg value="--prefix=${gs2build.home}"/>
[23611]1983 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
[19931]1984 </exec>
1985 </target>
[19910]1986
[19931]1987 <!-- common-src is done separately and needs to be compiled first -->
1988 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1989
1990 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[23611]1991 <arg line="${ldlpath.arg}"/>
[22845]1992 </exec>
1993
1994 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[19931]1995 <arg value="install"/>
1996 </exec>
[19910]1997
[19931]1998 <!-- run the setup script -->
[20826]1999 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
[19910]2000 <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
[19931]2001 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]2002 <arg value="/f"/>
2003 <arg value="win32.mak"/>
[19934]2004 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]2005 </exec>
[19931]2006 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]2007 <arg value="/f"/>
2008 <arg value="win32.mak"/>
2009 <arg value="install"/>
[19934]2010 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]2011 </exec>
[15124]2012 </target>
2013
2014
[15799]2015 <!-- ======================== TESTING Targets ========================= -->
[15124]2016
2017 <target name="test" description="Run the (incomplete) JUnit test suite "
2018 depends="init">
2019 <mkdir dir="${basedir}/test"/>
2020 <junit printsummary="withOutAndErr"
2021 errorproperty="test.failed"
2022 failureproperty="test.failed"
2023 fork="${junit.fork}">
2024 <formatter type="plain"/>
2025 <classpath>
[16936]2026 <pathelement location="${build.home}/gsdl3test.jar"/>
2027 <path refid="compile.classpath"/>
[15124]2028 </classpath>
2029 <test name="${testcase}" if="testcase"/>
2030 <batchtest todir="${basedir}/test" unless="testcase">
[18505]2031 <fileset dir="${build.home}" includes="**/*Test.class" />
[15124]2032 </batchtest>
2033 </junit>
2034 <echo>
2035 *********************************************
[15799]2036 Test output can be found in directory 'test'
[15124]2037 *********************************************
2038 </echo>
2039 </target>
[15799]2040
[20950]2041 <!-- ======================== FLAX Targets ========================= -->
2042 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2043 <echo>checking out flax ...</echo>
2044 <mkdir dir="${basedir}/src/java/org/flax"/>
2045 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
[22198]2046 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
[20950]2047 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2048 <mkdir dir="${web.home}/interfaces/flax"/>
2049 <mkdir dir="${web.home}/sites/flax"/>
2050 <mkdir dir="${basedir}/flax-resources"/>
2051 <mkdir dir="${basedir}/flax-lib"/>
[21272]2052 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2053 <arg value="src/java/org/flax"/></exec>
2054 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2055 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
[22198]2056 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2057 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2058 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
[21272]2059 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2060 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2061 <arg value="${web.home}/interfaces/flax"/></exec>
2062 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2063 <arg value="${web.home}/sites/flax"/></exec>
2064 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2065 <arg value="flax-resources"/></exec>
2066 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2067 <arg value="flax-lib"/></exec>
[20950]2068 <antcall target="flax-copy-files" />
2069 </target>
[23442]2070
2071 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
2072 <echo>copying flax files ...</echo>
2073 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2074 <!-- A configuration file containing web service binding information for the axis engine -->
2075 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
2076 <!-- A static web service wsdl file which is queried by soap client. The reason this file is used (instead of the dynamically generated version) is in case any redirects are used in the Apache configuration (e.g., flax.nzdl.org:80 redirects to harakeke:8080) -->
[23696]2077 <copy file="${basedir}/flax-resources/FlaxWebService.wsdl" tofile="${web.home}/FlaxWebService.wsdl" overwrite="true"/>
[23442]2078 <copy todir="${web.home}/WEB-INF/lib">
2079 <fileset dir="${basedir}/flax-lib">
[23443]2080 <include name="*.jar"/>
[23442]2081 </fileset>
2082 </copy>
2083 </target>
[23681]2084 <target name="configure-flax-wsdl" description="Configure flax webservice with tomcat server/port">
[23986]2085 <copy file="${basedir}/flax-resources/FlaxWebService.wsdl" tofile="${web.home}/FlaxWebService.wsdl" overwrite="true"/>
[23696]2086 <rsr file="${web.home}/FlaxWebService.wsdl" pattern="@flaxpublicserver@:@flaxpublicport@" replacement="${tomcat.server}:${tomcat.port}"/>
[23936]2087 <echo>FLAX server for Moodle module is configured to: http://${tomcat.server}:${tomcat.port}.</echo>
[23681]2088 </target>
[20950]2089
2090 <target name="update-flax" description="update flax from repository">
2091 <echo>updating flax ...</echo>
[21272]2092 <exec executable="svn"><arg value="update"/>
2093 <arg value="src/java/org/flax"/></exec>
2094 <exec executable="svn"><arg value="update"/>
[22198]2095 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2096 <exec executable="svn"><arg value="update"/>
[21272]2097 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2098 <exec executable="svn"><arg value="update"/>
2099 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2100 <exec executable="svn"><arg value="update"/>
2101 <arg value="${web.home}/interfaces/flax"/></exec>
2102 <exec executable="svn"><arg value="update"/>
[24366]2103 <arg value="${web.home}/web/sites/flax"/></exec>
2104 <exec executable="svn"><arg value="update"/>
[21272]2105 <arg value="flax-resources"/></exec>
2106 <exec executable="svn"><arg value="update"/>
2107 <arg value="flax-lib"/></exec>
[24098]2108 <antcall target="compile-core" />
[20950]2109 </target>
2110
[20963]2111
[19354]2112 <target name="compile-javadocs">
2113 <javadoc packagenames="org.greenstone.*"
2114 sourcepath="src/java"
2115 defaultexcludes="yes"
2116 destdir="docs/javadoc"
2117 author="true"
2118 version="true"
2119 use="true"
2120 windowtitle="Greenstone3 API">
2121 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2122 </javadoc>
2123 </target>
2124
[20089]2125<!-- ========== Some distribution targets ======================== -->
[19972]2126 <target name="remove-source">
[23809]2127 <if><bool><isset property="with.gli.and.gems"/></bool>
[19975]2128 <delete includeEmptyDirs="true">
2129 <fileset dir="." defaultexcludes="false">
2130 <patternset refid="greenstone3.source.component"/>
2131 </fileset>
2132 </delete>
[23809]2133
2134 <else>
2135 <delete includeEmptyDirs="true">
2136 <fileset dir="." defaultexcludes="false">
2137 <patternset refid="greenstone3.source.no.gli.component"/>
2138 </fileset>
2139 </delete>
2140 </else>
2141 </if>
[19972]2142 </target>
2143
[19903]2144 <target name="dist-tidy"
2145 description="'tidies-up' a greenstone3 installation for distribution.">
2146
2147 <!-- delete unneeded things -->
2148 <delete dir="${packages.home}/axis"/>
2149 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2150 <delete file="README-SVN.txt"/>
[20215]2151 <delete file="build.properties.in"/>
[19903]2152
[19961]2153 <!-- delete source files -->
[19972]2154 <antcall target="remove-source"/>
[19903]2155
2156 <!-- create empty directories -->
2157 <mkdir dir="${web.home}/applet"/>
2158 <mkdir dir="${web.home}/logs"/>
2159
2160 <!-- os specific tidy-ups -->
[20051]2161 <!-- linux, mac -->
2162 <if><bool><istrue value="${current.os.isunix}"/></bool>
[19903]2163 <delete><fileset dir="." includes="*.bat"/></delete>
[23809]2164 <if><bool><isset property="with.gli.and.gems"/></bool>
2165 <delete><fileset dir="gli" includes="*.bat"/></delete>
2166 </if>
[19903]2167 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2168 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
[19946]2169 <delete file="${basedir}/gs2build/win32cfg.h"/>
[19939]2170 <delete file="${basedir}/gs2build/win32.mak"/>
[20051]2171 <delete dir="${basedir}/winutil"/>
[19903]2172 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2173
[20051]2174 <!-- windows -->
2175 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2176 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
[23809]2177 <if><bool><isset property="with.gli.and.gems"/></bool>
2178 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2179 </if>
[20051]2180 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2181 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2182 </if></else></if>
2183
[19903]2184 </target>
2185
[20089]2186 <!-- fix up executable permissions for binary release -->
2187 <target name="fix-execute-permissions">
2188 <echo>Setting binaries to executable</echo>
[20127]2189 <chmod perm="775">
2190 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2191 </chmod>
[20089]2192 </target>
2193
2194 <!-- fix up executable permissions for source code release -->
2195 <target name="fix-execute-permissions-source">
[20127]2196 <chmod perm="775">
2197 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2198 </chmod>
[20089]2199 </target>
2200
2201
[19931]2202 <!-- ============= tweaks for making compilation static ========== -->
2203 <target name="tweak-makefiles" depends="init" if="compile.static">
2204 <antcall target="rtftohtml-add-static" />
2205 </target>
2206
2207 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2208 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2209 </target>
2210
[15028]2211</project>
[22184]2212
Note: See TracBrowser for help on using the repository browser.