source: greenstone3/trunk/build.xml@ 17140

Last change on this file since 17140 was 17140, checked in by oranfry, 16 years ago

Added vista to the list of windows versions

File size: 71.6 KB
Line 
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=".">
10
11 <!-- ============ classpath =================== -->
12 <path id="project.classpath">
13 <fileset dir="lib/java">
14 <include name="**/*.jar"/>
15 </fileset>
16 </path>
17
18 <!-- ============ self defined tasks =================== -->
19 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
20 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
21 <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
22 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
23 <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
24
25 <!-- ===================== Property Definitions =========================== -->
26
27 <!--
28
29 Each of the following properties are used in the build script.
30 Values for these properties are set by the first place they are
31 defined, from the following list:
32
33 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
34
35 * Definitions from a "build.properties" file in the top level
36 source directory of this application.
37
38 * Definitions from a "build.properties" file in the user's
39 home directory.
40
41 * Default definitions in this build.xml file.
42
43 You will note below that property values can be composed based on the
44 contents of previously defined properties. This is a powerful technique
45 that helps you minimize the number of changes required when your development
46 environment is modified. Note that property composition is allowed within
47 "build.properties" files as well as in the "build.xml" script.
48
49 -->
50
51 <!--the first three properties have to be put on the top to be used by build.properties-->
52 <property name="src.packages.home" value="${basedir}/src/packages"/>
53 <property name="gdbm.home" value="${src.packages.home}/gdbm-1.8.3"/>
54 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
55 <property file="build.properties"/>
56 <if><bool><available file="${user.home}/build.properties"/></bool>
57 <property file="${user.home}/build.properties"/>
58 </if>
59
60 <!-- get properties from the environment -->
61 <property environment="env"/>
62
63
64 <!-- version properties for external packages -->
65 <property name="tomcat.version" value="apache-tomcat-5.5.25"/>
66 <property name="axis.zip.version" value="axis-bin-1_2_1.zip"/>
67 <property name="axis.dir.version" value="axis-1_2_1"/>
68 <property name="gdbm.version" value="gdbm-1.8.3"/>
69
70 <property name="build.home" value="${basedir}/build"/>
71 <property name="src.home" value="${basedir}/src/java"/>
72 <property name="packages.home" value="${basedir}/packages"/>
73 <!-- this may be set in build.properties, eg if you move the web dir to
74 tomcats webapps directory -->
75 <property name="web.home" value="${basedir}/web"/>
76 <!-- jar files needed by applets go here -->
77 <property name="web.applet" value="${web.home}/applet"/>
78 <!-- jar files needed by the servlet (and extra ones) go here -->
79 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
80 <!-- other files needed by the servlet go here -->
81 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
82 <!--- flax: the WordNet home -->
83 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
84
85 <!-- jni libraries and java wrappers go here -->
86 <property name="lib.jni" value="${basedir}/lib/jni"/>
87
88 <property name="javadocs" value="${basedir}/docs/javadoc"/>
89
90 <property name="app.name" value="greenstone3"/>
91 <property name="app.path" value="/${app.name}"/>
92
93
94 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
95 <property name="app.version" value="trunk"/>
96 <property name="branch.path" value="trunk"/>
97 <property name="branch.revision" value="HEAD"/>
98
99 <!--constants -->
100 <property name="svn.root" value="http://svn.greenstone.org"/>
101
102 <!-- <property name="cvs.root" value=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src"/> -->
103 <!-- catalina home is set to tomcat basedir is already installed, otherwise
104 use greenstone's tomcat -->
105 <condition property="catalina.home" value="${tomcat.installed.path}">
106 <and>
107 <isset property="tomcat.installed.path"/>
108 <not>
109 <equals arg1="" arg2="${tomcat.installed.path}"/>
110 </not>
111 </and>
112 </condition>
113 <property name="catalina.home" value="${packages.home}/tomcat"/>
114
115 <property name="os.linux" value="Linux"/>
116 <property name="os.mac" value="Mac OS X"/>
117 <property name="os.solaris" value="SunOS"/>
118 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
119 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista"/> <!-- check this!!!-->
120
121 <!-- this is true for linux and macs -->
122 <condition property="current.os.isunix">
123 <os family="unix"/>
124 </condition>
125
126 <condition property="current.os.isunixnotmac">
127 <and>
128 <os family="unix"/>
129 <not>
130 <os family="mac"/>
131 </not>
132 </and>
133 </condition>
134 <condition property="current.os.ismac">
135 <os family="mac"/>
136 </condition>
137
138 <condition property="current.os.iswindows">
139 <os family="windows"/>
140 </condition>
141
142 <condition property="collection.building.enabled">
143 <not>
144 <isset property="disable.collection.building"/>
145 </not>
146 </condition>
147
148 <condition property="collection.building.enabled.windows">
149 <and>
150 <isset property="collection.building.enabled"/>
151 <isset property="current.os.iswindows"/>
152 </and>
153 </condition>
154
155 <condition property="collection.building.enabled.unix">
156 <and>
157 <isset property="collection.building.enabled"/>
158 <isset property="current.os.isunix"/>
159 </and>
160 </condition>
161
162 <condition property="independent-indexers">
163 <isset property="disable.collection.building"/>
164 </condition>
165
166 <!-- where is search4j tool -->
167 <condition property="search4j.exec" value="bin/search4j.exe">
168 <isset property="current.os.iswindows"/>
169 </condition>
170 <property name="search4j.exec" value="bin/search4j"/>
171
172
173 <!-- ============= Base dirs for each package and component ============ -->
174 <property name="src.applet.home" value="${src.home}/org/greenstone/applet"/>
175 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
176 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
177 <property name="gs2build.home" value="${basedir}/gs2build"/>
178 <property name="gli.home" value="${basedir}/gli"/>
179 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
180
181 <!--<property name="indexers.home" value="${basedir}/src/packages/indexers">-->
182 <condition property="indexers.home" value="${basedir}/src/packages/indexers">
183 <isset property="disable.collection.building"/>
184 </condition>
185 <condition property="indexers.home" value="${gs2build.home}/common-src/indexers">
186 <not>
187 <isset property="disable.collection.building"/>
188 </not>
189 </condition>
190
191 <property name="mg.home" value="${indexers.home}/mg"/>
192 <property name="mgpp.home" value="${indexers.home}/mgpp"/>
193 <property name="lucene.home" value="${indexers.home}/lucene-gs"/>
194
195 <!-- ==================== Compilation Control Options ==================== -->
196
197 <!--
198
199 These properties control option settings on the Javac compiler when it
200 is invoked using the <javac> task.
201
202 compile.debug Should compilation include the debug option?
203
204 compile.deprecation Should compilation include the deprecation option?
205
206 compile.optimize Should compilation include the optimize option?
207
208 -->
209
210 <property name="compile.debug" value="true"/>
211 <property name="compile.deprecation" value="true"/>
212 <property name="compile.optimize" value="true"/>
213
214 <!--
215
216 Rather than relying on the CLASSPATH environment variable, Ant includes
217 features that makes it easy to dynamically construct the classpath you
218 need for each compilation. The example below constructs the compile
219 classpath to include the servlet.jar file, as well as the other components
220 that Tomcat makes available to web applications automatically, plus anything
221 that you explicitly added.
222
223 -->
224
225 <path id="compile.classpath">
226 <!-- Include all jar files and libraries in our jni lib directory -->
227 <pathelement location="${lib.jni}"/>
228 <fileset dir="${lib.jni}">
229 <include name="*.jar"/>
230 </fileset>
231 <!-- Include all jar files in our web lib directory -->
232 <pathelement location="${web.lib}"/>
233 <fileset dir="${web.lib}">
234 <include name="*.jar"/>
235 </fileset>
236
237 <!-- Include the axis jar files -->
238 <!--<fileset dir="${basedir}/comms/soap/axis/lib">
239 <include name="*.jar"/>
240 </fileset>-->
241
242 <!-- include the jar files from the source packages -->
243 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
244 so we add them in by name -->
245 <pathelement location="${lib.jni}/mg.jar"/>
246 <pathelement location="${lib.jni}/mgpp.jar"/>
247
248 <!-- Include all elements that Tomcat exposes to applications -->
249 <pathelement location="${catalina.home}/common/classes"/>
250 <fileset dir="${catalina.home}/common/endorsed">
251 <include name="*.jar"/>
252 </fileset>
253 <fileset dir="${catalina.home}/common/lib">
254 <include name="*.jar"/>
255 </fileset>
256 <pathelement location="${catalina.home}/shared/classes"/>
257 <fileset dir="${catalina.home}/shared/lib">
258 <include name="*.jar"/>
259 </fileset>
260 </path>
261
262 <path id="local.tomcat.classpath">
263 <!-- explicitly include the jni java wrappers in the classpath -->
264 <pathelement location="${lib.jni}"/>
265 <fileset dir="${lib.jni}">
266 <include name="*.jar"/>
267 </fileset>
268 </path>
269
270 <path id="local.tomcat.path">
271 <pathelement location="${basedir}/bin/script"/>
272 <pathelement location="${basedir}/bin"/>
273 <pathelement location="${lib.jni}"/>
274 <pathelement path="${env.PATH}"/>
275 <pathelement path="${env.Path}"/>
276 <pathelement path="${wn.home}/bin"/>
277 </path>
278
279 <target name="test-setup">
280 <echo>ant java version=${ant.java.version}</echo>
281 <echo>is unix : ${current.os.isunix}</echo>
282 <echo>is mac : ${current.os.ismac}</echo>
283 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
284 <echo>is windows : ${current.os.iswindows}</echo>
285 <echo>os.unix: ${os.unix}</echo>
286 </target>
287 <!-- ==================== Primary and Global Targets ============================= -->
288
289 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
290
291 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections,prepare-gdbm, prepare-flax"
292 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.">
293 <!-- <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
294 description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional cvs checkouts and downloads, so you need to be online to run this.">-->
295
296 <!-- make sure .sh files are executable -->
297 <chmod dir="${basedir}" perm="ugo+rx"
298 includes="*.sh"/>
299 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
300 includes="*.sh,*.pl"/>
301 </target>
302
303 <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile"
304 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare install'."/>
305
306 <!-- <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building,cvsupdate-web"
307 description="Do a cvs update for all sources. Doesn't recompile the code. You need to be online to run this."/>-->
308 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-gs2building,svnupdate-web"
309 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
310
311 <target name="configure-c++" depends="init,configure-packages,configure-core,configure-gs2building"
312 description="Configure any C/C+/+ package code and gs2building code if necessary"/>
313
314 <target name="configure" depends="init,configure-tomcat,configure-web"
315 description="Configure the installation. Includes setting up config files. Should be re-run if you change the build.properties file."/>
316
317 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building,clean-gdbm"
318 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
319
320 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-gs2building,distclean-gdbm"
321 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes core, packages, gs2building as necessary"/>
322
323 <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
324 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
325
326 <target name="update" depends="init,svnupdate,clean,configure,configure-c++,compile"
327 description="Update (thru Subversion) all the source (including core, packages and gs2building), then clean, configure and recompile. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
328
329 <target name="start" depends="init,start-tomcat"
330 description="Startup the Tomcat server." >
331 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
332 <echo>Tomcat: ${catalina.home}</echo>
333 <echo>Java : ${java.home}</echo>
334 <echo>URL : http://${tomcat.server}:${tomcat.port}${app.path}/</echo>
335 <!-- assuming that index.html is not needed here -->
336 </target>
337
338 <target name="stop" depends="init,stop-tomcat"
339 description="Shutdown the Tomcat server."/>
340
341 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
342
343
344 <!-- =========== Help targets =================================== -->
345
346 <property name="install-command" value="ant [options] prepare install"/>
347
348 <target name="usage" description="Print a help message">
349 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
350 <echo message=" Execute 'ant -help' for Ant help."/>
351 <echo>To install Greenstone3, run '${install-command}'.
352 There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option.
353 To log the output, use the '-logfile build.log' option.
354 The README.txt file has more information about the ant targets and install process.
355 </echo>
356 </target>
357
358 <target name="help" depends="usage" description="Print a help message"/>
359
360 <target name="debug" depends="init" description="Display all the currently used properties">
361 <echoproperties/>
362 </target>
363
364 <!-- ====== initialization and setup targets ================== -->
365
366 <target name="accept-properties" unless="properties.accepted">
367 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
368 tomcat.server=${tomcat.server}
369 tomcat.port=${tomcat.port}
370 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
371 proxy.host=${proxy.host}
372 proxy.port=${proxy.port}
373 If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
374 </input>
375 <condition property="do.abort">
376 <equals arg1="n" arg2="${properties.ok}"/>
377 </condition>
378 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
379 </target>
380
381
382 <!-- this sets up some initial properties -->
383 <target name="init">
384
385 <condition property="java.too.old">
386 <or>
387 <equals arg1="1.1" arg2="${ant.java.version}"/>
388 <equals arg1="1.2" arg2="${ant.java.version}"/>
389 <equals arg1="1.3" arg2="${ant.java.version}"/>
390 </or>
391 </condition>
392 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
393
394 <available file="${indexers.home}" property="indexers.present"/>
395 <available file="${basedir}/gli" property="gli.present"/>
396 <available file="${basedir}/gs2build" property="gs2build.present"/>
397
398 <condition property="tomcat.islocal">
399 <or>
400 <not><isset property="tomcat.installed.path"/></not>
401 <equals arg1="" arg2="${tomcat.installed.path}"/>
402 </or>
403 </condition>
404
405 <echo>tomcat.port = ${tomcat.port}</echo>
406 <echo>gli.present = ${gli.present}</echo>
407 <echo>gs2build.present = ${gs2build.present}</echo>
408 <!-- gsdl2.installed.path appears not to be set, so wrap in if block -->
409 <if>
410 <bool><isset property="gsdl2.installed.path"/></bool>
411 <echo>gsdl2.installed.path = ${gsdl2.installed.path}</echo>
412 </if>
413
414 <condition property="proxy.present">
415 <and>
416 <isset property="proxy.host"/>
417 <not><equals arg1="" arg2="${proxy.host}"/></not>
418 </and>
419 </condition>
420
421 <condition property="need.macos.extra">
422 <and>
423 <isset property="current.os.ismac"/>
424 <not><isset property="disable.collection.building"/></not>
425 </and>
426 </condition>
427 </target>
428
429 <target name="setup-proxy" depends="init" if="proxy.present">
430 <condition property="ask.user">
431 <or>
432 <equals arg1="" arg2="${proxy.user}"/>
433 <equals arg1="" arg2="${proxy.password}"/>
434 </or>
435 </condition>
436 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
437 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
438 </target>
439
440 <!-- ========== Web app Targets ================================ -->
441
442 <target name="prepare-web" depends="init,configure-java-version">
443 <mkdir dir="${web.home}/applet"/>
444 <mkdir dir="${web.home}/logs"/>
445 </target>
446
447 <!-- 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 -->
448 <target name="configure-java-version" depends="init"
449 description="Activates or deactivates some jar libraries as needed depending on your java version">
450
451 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
452 <condition property="need.xalan.jar">
453 <or>
454 <equals arg1="1.5" arg2="${ant.java.version}"/>
455 <equals arg1="1.6" arg2="${ant.java.version}"/>
456 </or>
457 </condition>
458
459 <!-- if they have xalan.jar but dont need it -->
460 <if>
461 <bool>
462 <and>
463 <isset property="have.xalan.jar"/>
464 <not><isset property="need.xalan.jar"/></not>
465 </and>
466 </bool>
467 <antcall target="deactivate-xalan-jar"/>
468 </if>
469
470 <!-- if they need xalan.jar but dont have it -->
471 <if>
472 <bool>
473 <and>
474 <not><isset property="have.xalan.jar"/></not>
475 <isset property="need.xalan.jar"/>
476 </and>
477 </bool>
478 <antcall target="activate-xalan-jar"/>
479 </if>
480
481 </target>
482
483 <target name="activate-xalan-jar">
484 <echo>activating xalan.jar</echo>
485 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
486 <if><bool><isset property="current.os.ismac"/></bool>
487 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
488 </if>
489 </target>
490
491 <!-- to delete -->
492 <target name="copy-xalan-for-mac"></target>
493
494 <target name="deactivate-xalan-jar">
495 <echo>deactivating xalan.jar</echo>
496 <delete file="${web.lib}/xalan.jar"/>
497 </target>
498
499
500 <target name="prepare-collections" depends="init">
501 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
502 <property name="import.zip" value="import.zip"/>
503 <property name="metadata.zip" value="metadata.zip"/>
504 <property name="index.zip" value="index.zip"/>
505
506 <echo message="installing collections..."/>
507 <antcall target="gs2mgdemo-install"/>
508 <antcall target="gs2mgppdemo-install"/>
509 <antcall target="gberg-install"/>
510 </target>
511
512 <target name="gs2mgdemo-prepare" if="collect.dir">
513 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
514 <fileset id="gs2mgdemofiles" dir="${gs2mgdemo.dir}">
515 <include name="${import.zip}"/>
516 <include name="${metadata.zip}"/>
517 <include name="${index.zip}"/>
518 </fileset>
519
520 <condition property="gs2mgdemo.present">
521 <and>
522 <available file="${gs2mgdemo.dir}/${import.zip}"/>
523 <available file="${gs2mgdemo.dir}/${metadata.zip}"/>
524 <available file="${gs2mgdemo.dir}/${index.zip}"/>
525 </and>
526 </condition>
527 </target>
528
529 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
530 <echo> installing gs2mgdemo</echo>
531 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${import.zip}" />
532 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${metadata.zip}" />
533 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
534 <!--Don't delete the zips, else doing an svn update will get them all over again.-->
535 <!--<delete><fileset refid="gs2mgdemofiles"/></delete>-->
536 <echo>collection gs2mgdemo installed</echo>
537 </target>
538
539 <target name="gs2mgppdemo-prepare" if="collect.dir">
540 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
541
542 <fileset id="gs2mgppdemofiles" dir="${gs2mgppdemo.dir}">
543 <include name="${import.zip}"/>
544 <include name="${metadata.zip}"/>
545 <include name="${index.zip}"/>
546 </fileset>
547
548 <condition property="gs2mgppdemo.present">
549 <and>
550 <available file="${gs2mgppdemo.dir}/${import.zip}"/>
551 <available file="${gs2mgppdemo.dir}/${metadata.zip}"/>
552 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
553 </and>
554 </condition>
555 </target>
556
557 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
558 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${import.zip}" />
559 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${metadata.zip}" />
560 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
561 <!--<delete><fileset refid="gs2mgppdemofiles"/></delete>-->
562 <echo>collection gs2mgppdemo installed</echo>
563 </target>
564
565 <target name="gberg-prepare" if="collect.dir">
566 <property name="gberg.dir" value="${collect.dir}/gberg"/>
567 <fileset id="gbergfiles" dir="${gberg.dir}">
568 <include name="index/${index.zip}"/>
569 </fileset>
570 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
571 </target>
572
573 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
574 <unzip dest="${gberg.dir}/index">
575 <fileset refid="gbergfiles"/>
576 </unzip>
577 <!--<delete><fileset refid="gbergfiles"/></delete>-->
578 <echo>collection gberg installed</echo>
579 </target>
580
581 <!--
582 <target name="prepare-collections" depends="init">
583 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
584 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
585 dest="${collect.dir}/gs2mgdemo"/>
586 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
587 dest="${collect.dir}/gs2mgdemo"/>
588 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
589 dest="${collect.dir}/gs2mgdemo/index"/>
590 <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
591 <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
592 <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
593
594 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
595 dest="${collect.dir}/gs2mgppdemo"/>
596 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
597 dest="${collect.dir}/gs2mgppdemo"/>
598 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
599 dest="${collect.dir}/gs2mgppdemo/index"/>
600 <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
601 <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
602 <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
603
604 <unzip src="${collect.dir}/gberg/index/index.zip"
605 dest="${collect.dir}/gberg/index"/>
606 <delete file="${collect.dir}/gberg/index/index.zip"/>
607 </target>
608 -->
609
610 <target name="configure-web" depends="init"
611 description="Configure only the web app config files">
612 <!-- we want a unix path in the global.properties file -->
613 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
614 <path path="${web.home}"/>
615 </pathconvert>
616 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
617 <filter token="gsdl3version" value="${app.version}"/>
618 <filter token="tomcat.server" value="${tomcat.server}"/>
619 <filter token="tomcat.port" value="${tomcat.port}"/>
620 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
621 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
622 <chmod file="${web.classes}/global.properties" perm="600"/>
623 <chmod file="${web.classes}/log4j.properties" perm="600"/>
624 </target>
625
626 <target name="compile-web" depends="init">
627 <javac srcdir="${web.classes}"
628 destdir="${web.classes}"
629 debug="${compile.debug}"
630 deprecation="${compile.deprecation}"
631 optimize="${compile.optimize}">
632 <classpath><path refid="compile.classpath"/></classpath>
633 </javac>
634 </target>
635
636 <target name="svnupdate-web" unless="nosvn.mode">
637 <svn>
638 <update dir="${web.home}" revision="${branch.revision}"/>
639 </svn>
640 </target>
641
642 <target name="update-web" depends="init,svnupdate-web,configure-web"
643 description="update only the web stuff (config files)"/>
644
645 <!-- ======================= Tomcat Targets ========================== -->
646
647 <!-- this target downloads and installs Tomcat -->
648 <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
649 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
650
651 <if>
652 <bool>
653 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
654 </bool>
655
656 <!-- check that packages dir is there -->
657 <mkdir dir="${packages.home}"/>
658 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
659 dest="${packages.home}/${tomcat.version}.zip"
660 usetimestamp="true"/>
661 <unzip src="${packages.home}/${tomcat.version}.zip"
662 dest="${packages.home}"/>
663 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
664 dest="${packages.home}/${tomcat.version}-compat.zip"
665 usetimestamp="true"/>
666 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
667 dest="${packages.home}"/>
668 <!-- delete any existing tomcat -->
669 <delete dir="${packages.home}/tomcat"/>
670 <move todir="${packages.home}/tomcat">
671 <fileset dir="${packages.home}/${tomcat.version}"/>
672 </move>
673 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
674 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
675 overwrite="true"/>
676 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
677 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
678 overwrite="true"/>
679 <!-- make sure we have execute permission for the .sh files -->
680 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
681 includes="*.sh"/>
682
683 <echo file="${packages.home}/tomcat/.flagfile">
684 the timestamp of this file is the time that tomcat was extracted from the zip files.
685 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
686 </echo>
687
688 <else>
689 <echo>Tomcat has been prepared, will not prepare</echo>
690 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
691 </else>
692
693 </if>
694
695 </target>
696
697 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
698
699 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
700 <!-- re-setup the server.xml file -->
701 <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
702 <filterset>
703 <filter token="port" value="${tomcat.port}"/>
704 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
705 </filterset>
706 </copy>
707 <!-- set up the greenstone3 context -->
708 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
709 <filterset>
710 <filter token="gsdl3webhome" value="${web.home}"/>
711 </filterset>
712 </copy>
713 </target>
714
715 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
716 <!-- re-setup the server.xml file -->
717 <!-- need to edit the config file, or do we get the user to do this???-->
718 </target>
719
720 <target name="start-tomcat" description="Startup only Tomcat" depends="init,configure-java-version" if="tomcat.islocal">
721 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
722 <property name="tomcat.path" refid="local.tomcat.path"/>
723 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
724 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
725 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
726 <env key="GSDL3HOME" value="${basedir}"/>
727 <env key="PATH" path="${tomcat.path}"/>
728 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
729 <env key="CATALINA_HOME" value="${catalina.home}"/>
730 <env key="CLASSPATH" path="${tomcat.classpath}"/>
731 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
732 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
733 <env key="WNHOME" path="${wn.home}"/>
734 </exec>
735 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
736 <env key="GSDLOS" value="windows"/>
737 <env key="GSDL3HOME" value="${basedir}"/>
738 <env key="Path" path="${tomcat.path}"/>
739 <env key="PATH" path="${tomcat.path}"/>
740 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
741 <env key="CATALINA_HOME" value="${catalina.home}"/>
742 <env key="CLASSPATH" path="${tomcat.classpath}"/>
743 </exec>
744 <!-- wait for the server to startup in case other targets need it running -->
745 <waitfor maxwait="5" maxwaitunit="second">
746 <and>
747 <socket server="${tomcat.server}" port="${tomcat.port}"/>
748 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
749 </and>
750 </waitfor>
751 </target>
752
753 <!-- windows: do we want to launch a webrowser?? -->
754 <!-- shouldn't this test whether anything is running first? -->
755 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
756 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
757 <env key="CATALINA_HOME" value="${catalina.home}"/>
758 </exec>
759 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
760 <env key="CATALINA_HOME" value="${catalina.home}"/>
761 </exec>
762 </target>
763
764 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
765
766 <target name="setup-catalina-ant-tasks">
767 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
768 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
769 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
770 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
771 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
772 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
773 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
774 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
775 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
776 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
777 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
778 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
779 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
780 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
781 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
782 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
783 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
784 </target>
785
786
787 <!-- ======================= ant Targets ============================ -->
788 <target name="prepare-ant" depends="init">
789 <if>
790 <bool>
791 <not><available file="${packages.home}/ant/.flagfile"/></not>
792 </bool>
793
794 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
795 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
796 usetimestamp="true"/>
797 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
798 dest="${packages.home}"/>
799 <move todir="${packages.home}/ant">
800 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
801 </move>
802 <echo file="${packages.home}/ant/.flagfile">
803 the timestamp of this file is the time that ant was extracted from the zip files.
804 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
805 </echo>
806
807 <else>
808 <echo>Ant has been prepared, will not prepare</echo>
809 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
810 </else>
811
812 </if>
813 </target>
814
815 <!-- ======================= Axis Targets ============================ -->
816
817 <target name="prepare-axis" depends="init">
818
819 <if>
820 <bool>
821 <not><available file="${packages.home}/axis/.flagfile"/></not>
822 </bool>
823
824 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
825 dest="${packages.home}/${axis.zip.version}"
826 usetimestamp="true"/>
827 <unzip src="${packages.home}/${axis.zip.version}"
828 dest="${packages.home}"/>
829 <move todir="${packages.home}/axis">
830 <fileset dir="${packages.home}/${axis.dir.version}"/>
831 </move>
832 <!-- install axis into greenstone web app -->
833 <copy todir="${web.lib}">
834 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
835 <include name="*.jar"/>
836 </fileset>
837 </copy>
838 <copy todir="${web.home}">
839 <fileset dir="${packages.home}/axis/webapps/axis/">
840 <include name="*.jsp"/>
841 <include name="*.jws"/>
842 </fileset>
843 </copy>
844 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
845 <copy todir="${web.classes}">
846 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
847 <include name="*.properties"/>
848 </fileset>
849 </copy>
850 <echo file="${packages.home}/axis/.flagfile">
851 the timestamp of this file is the time that axis was extracted from the zip files.
852 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
853 </echo>
854
855 <else>
856 <echo>Axis has been prepared, will not prepare</echo>
857 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
858 </else>
859
860 </if>
861 </target>
862
863 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
864 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
865
866 <target name="deploy-site">
867 <java classname="org.apache.axis.client.AdminClient">
868 <classpath refid="compile.classpath"/>
869 <arg value="-l"/>
870 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
871 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
872 </java>
873 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
874 </target>
875
876 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
877 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
878 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
879 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
880 tofile="${basedir}/resources/soap/undeploy.wsdd"
881 filtering="true"
882 overwrite="true"/>
883 <java classname="org.apache.axis.client.AdminClient">
884 <classpath refid="compile.classpath"/>
885 <arg value="-l"/>
886 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
887 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
888 </java>
889 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
890 </target>
891
892 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
893 with the default servicename of localsite-->
894 <target name="deploy-localsite" depends="init"
895 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
896 <antcall target="start-tomcat"/>
897 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
898 <antcall target="create-deployment-files">
899 <param name="axis.sitename" value="localsite"/>
900 <param name="axis.servicesname" value="${base.webservice.name}"/>
901 <param name="axis.siteuri" value="localsite"/>
902 </antcall>
903 <antcall target="deploy-site">
904 <param name="axis.sitename" value="localsite"/>
905 <param name="axis.servicesname" value="${base.webservice.name}"/>
906 <param name="axis.siteuri" value="localsite"/>
907 </antcall>
908 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
909 </target>
910
911 <target name="get-sitename" unless="axis.sitename">
912 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
913Press Enter for default:localsite</input>
914 </target>
915
916 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
917 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
918To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
919Or press Enter for undeploying the default:localsite /></input>
920 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
921 </target>
922
923 <target name="get-webservices" unless="axis.servicesname">
924 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
925Choose from: ${web.services.list}
926Or press Enter for default:${base.webservice.name} /></input>
927 <echo>${axis.servicesname}</echo>
928 </target>
929
930 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
931 <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>
932 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
933 </target>
934
935 <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">
936 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
937 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
938 </condition>
939
940 <!--everything else defaults to java:RPC at present-->
941 <condition property="soap.method" value="provider='java:RPC'">
942 <not>
943 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
944 </not>
945 </condition>
946 </target>
947
948 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
949 <filter token="sitename" value="${axis.sitename}"/>
950 <filter token="siteuri" value="${axis.siteuri}"/>
951 <filter token="servicesname" value="${axis.servicesname}"/>
952 <filter token="soapmethod" value="${soap.method}"/>
953 <copy file="${basedir}/resources/soap/site.wsdd.template"
954 tofile="${basedir}/resources/soap/deploy.wsdd"
955 filtering="true"
956 overwrite="true"/>
957 <!-- create the java files and compile them -->
958 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
959 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
960 filtering="true"
961 overwrite="true"/>
962 <mkdir dir="${build.home}"/>
963 <javac srcdir="${src.home}"
964 destdir="${build.home}"
965 debug="${compile.debug}"
966 deprecation="${compile.deprecation}"
967 optimize="${compile.optimize}">
968 <classpath refid="compile.classpath"/>
969 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
970 </javac>
971 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
972 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
973 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
974 overwrite="true" />
975 </target>
976
977
978 <!-- ====================== Core targets ============================== -->
979 <!-- core targets refer to the core gsdl3 java src -->
980
981 <target name="prepare-core" unless="nosvn.mode">
982 <!-- just get rid of empty directories-->
983 <svn>
984 <update dir="." revision="${branch.revision}"/>
985 </svn>
986 </target>
987
988 <target name="configure-core"/>
989
990 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
991 description="Update only the Greenstone core" />
992
993 <target name="svnupdate-core" unless="nosvn.mode">
994
995 <svn>
996 <update dir="." recurse="false" revision="${branch.revision}"/>
997 </svn>
998
999 <svn>
1000 <update dir="bin" revision="${branch.revision}"/>
1001 <update dir="comms" revision="${branch.revision}"/>
1002 <update dir="dist-resources" revision="${branch.revision}"/>
1003 <update dir="docs" revision="${branch.revision}"/>
1004 <update dir="lib" revision="${branch.revision}"/>
1005 <update dir="resources" revision="${branch.revision}"/>
1006 <update dir="src" revision="${branch.revision}"/>
1007 <update dir="winutil" revision="${branch.revision}"/>
1008 </svn>
1009
1010 </target>
1011
1012 <target name="clean-core"
1013 description="Clean only the Greenstone core">
1014 <delete dir="${build.home}"/>
1015 </target>
1016
1017 <target name="compile-core" depends="init"
1018 description="Compile only the Greenstone core">
1019 <mkdir dir="${build.home}"/>
1020 <javac srcdir="${src.home}"
1021 destdir="${build.home}"
1022 debug="${compile.debug}"
1023 deprecation="${compile.deprecation}"
1024 optimize="${compile.optimize}">
1025 <classpath>
1026 <path refid="compile.classpath"/>
1027 </classpath>
1028 </javac>
1029 <jar destfile="${build.home}/gsdl3.jar">
1030 <fileset dir="${build.home}">
1031 <include name="org/greenstone/gsdl3/**"/>
1032 <include name="org/flax/**"/>
1033 <exclude name="**/Test.class"/>
1034 </fileset>
1035 <manifest>
1036 <attribute name="Built-By" value="${user.name}" />
1037 </manifest>
1038 </jar>
1039 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1040 <!-- copy the localsite server in case we need it -->
1041 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1042
1043 <jar destfile="${build.home}/GAI.jar">
1044 <fileset dir="${build.home}">
1045 <include name="org/greenstone/admin/**"/>
1046 </fileset>
1047 <manifest>
1048 <attribute name="Built-By" value="${user.name}" />
1049 </manifest>
1050 </jar>
1051
1052 <jar destfile="${build.home}/phind.jar">
1053 <fileset dir="${build.home}">
1054 <include name="org/greenstone/applet/phind/**"/>
1055 </fileset>
1056 <manifest>
1057 <attribute name="Built-By" value="${user.name}" />
1058 </manifest>
1059 </jar>
1060 <mkdir dir="${web.applet}"/>
1061 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1062 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1063 <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
1064 <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
1065 <!-- skip anttasks for now
1066 <jar destfile="${build.home}/anttasks.jar">
1067 <fileset dir="${build.home}">
1068 <include name="org/greenstone/anttasks/**"/>
1069 </fileset>
1070 <manifest>
1071 <attribute name="Built-By" value="${user.name}" />
1072 </manifest>
1073 </jar>
1074 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1075 <jar destfile="${build.home}/gsdl3test.jar">
1076 <fileset dir="${build.home}">
1077 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1078 <include name="org/greenstone/testing/**"/>
1079 </fileset>
1080 <manifest>
1081 <attribute name="Built-By" value="${user.name}" />
1082 </manifest>
1083 </jar>
1084 <jar destfile="${build.home}/server.jar">
1085 <fileset dir="${build.home}">
1086 <include name="org/greenstone/server/**"/>
1087 </fileset>
1088 <fileset file="${basedir}/resources/java/server.properties"/>
1089 <manifest>
1090 <attribute name="Built-By" value="${user.name}"/>
1091 </manifest>
1092 </jar>
1093 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1094 </target>
1095
1096 <!-- ================== Packages targets ================================ -->
1097 <!-- these targets refer to the greenstone source packages - these need
1098 updating less often, so are in separate targets to the core -->
1099 <target name="prepare-packages" depends="init,prepare-indexers"/>
1100
1101 <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nosvn.mode">
1102 <svn>
1103 <checkout url="${svn.root}/indexers/${branch.path}" dest="${src.packages.home}/indexers" revision="${branch.revision}"/>
1104 </svn>
1105 </target>
1106
1107 <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
1108 <antcall target="checkout-indexers"/>
1109 </target>
1110
1111 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1112 description="Update only the source packages"/>
1113
1114 <target name="svnupdate-packages" unless="nosvn.mode">
1115 <svn>
1116 <update dir="${src.packages.home}" revision="${branch.revision}"/>
1117 </svn>
1118 </target>
1119
1120 <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
1121 description="Configure only the packages."/>
1122
1123 <target name="configure-javagdbm">
1124 <echo>
1125 Configuring JavaGDBM
1126 </echo>
1127 <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
1128 dir="${javagdbm.home}">
1129 <arg value="--prefix=${basedir}"/>
1130 <arg value="--libdir=${lib.jni}"/>
1131 </exec>
1132 <exec executable="${javagdbm.home}/configure" os="${os.mac}"
1133 dir="${javagdbm.home}">
1134 <arg value="--prefix=${basedir}"/>
1135 <arg value="--libdir=${lib.jni}"/>
1136 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1137 </exec>
1138 </target>
1139
1140 <!-- Message from oran. I removed the condition from this line becuase it meant
1141 the indexers would only be configured if collection building was DISabled.
1142 Shouldn't they be configured when collection building is ENabled? -->
1143
1144 <!-- <target name="configure-indexers" depends="init" if="independent-indexers"> -->
1145 <target name="configure-indexers" depends="init">
1146 <echo>Configuring Indexers</echo>
1147 <exec executable="${indexers.home}/configure" os="${os.unix}" dir="${indexers.home}">
1148 <arg value="--prefix=${basedir}"/>
1149 <arg value="--libdir=${lib.jni}"/>
1150 </exec>
1151 </target>
1152
1153 <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
1154
1155 <target name="clean-javagdbm" depends="init">
1156 <exec executable="make" os="${os.unix}"
1157 dir="${javagdbm.home}">
1158 <arg value="clean"/>
1159 </exec>
1160 </target>
1161
1162 <target name="clean-indexers" depends="init" if="independent-indexers">
1163 <exec executable="make" os="${os.unix}"
1164 dir="${indexers.home}">
1165 <arg value="clean"/>
1166 </exec>
1167 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
1168 dir="${indexers.home}">
1169 <arg value="clean"/>
1170 </exec>
1171 </target>
1172
1173 <target name="distclean-packages" depends="init,distclean-javagdbm,distclean-indexers" description="Distclean only the packages"/>
1174
1175 <target name="distclean-javagdbm" depends="init">
1176 <exec executable="make" os="${os.unix}"
1177 dir="${javagdbm.home}">
1178 <arg value="distclean"/>
1179 </exec>
1180 </target>
1181
1182 <target name="distclean-indexers" depends="init" if="independent-indexers">
1183 <exec executable="make" os="${os.unix}"
1184 dir="${indexers.home}">
1185 <arg value="distclean"/>
1186 </exec>
1187 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
1188 dir="${indexers.home}">
1189 <arg value="clean"/>
1190 </exec>
1191 </target>
1192
1193 <target name="compile-packages" description="Compile only the source packages">
1194
1195 <!-- javagdbm -->
1196 <echo>compile javagdbm</echo>
1197 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}"/>
1198 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}">
1199 <arg value="install"/>
1200 </exec>
1201
1202 <!-- windows: just the java stuff. -->
1203 <echo>Windows: compile javagdbm (java only)</echo>
1204 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}">
1205 <arg value="compile"/>
1206 <arg value="javaonly"/>
1207 </exec>
1208
1209 <!-- install the jar file -->
1210 <echo>Install the javagdbm jar file</echo>
1211 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1212
1213 <!-- Indexers -->
1214
1215 <!-- this may be in gs2build - we will be recompiling, but never mind -->
1216 <echo>Indexers: make (from ${indexers.home})</echo>
1217 <exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
1218 <echo>Indexers: make install</echo>
1219 <exec executable="make" os="${os.unix}" dir="${indexers.home}">
1220 <arg value="install"/>
1221 </exec>
1222
1223 <echo>Indexers: make</echo>
1224 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1225 <arg value="all"/>
1226 </exec>
1227 <echo>Indexers: make install</echo>
1228 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1229 <arg value="install"/>
1230 </exec>
1231
1232 <!-- install the jar and jni files -->
1233 <echo>Install the indexers' jar and jni files</echo>
1234 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1235 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1236 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1237 <antcall target="install-jni-files"/>
1238 </target>
1239
1240 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1241
1242 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1243 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1244 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1245 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1246 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1247 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1248 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1249 </target>
1250 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1251 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1252 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1253 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1254 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1255 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1256 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1257 </target>
1258 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1259 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1260 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1261 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1262 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1263 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1264 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1265 </target>
1266
1267 <!-- ================== gs2building targets ===============-->
1268
1269
1270 <target name="update-gs2building" if="collection.building.enabled"
1271 depends="init,svnupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1272 description="Update only the Greenstone 2 building components"/>
1273
1274 <target name="svnupdate-gs2building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode">
1275 </target>
1276
1277 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1278 <!-- please keep this function in sync with checkout-gs2build -->
1279
1280 <echo>updating gs2build</echo>
1281 <!-- svn updates -->
1282 <svn>
1283 <!-- perllib -->
1284 <update dir="gs2build" revision="${branch.revision}"/>
1285 </svn>
1286 </target>
1287
1288 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1289 <svn>
1290 <update dir="${gli.home}" revision="${branch.revision}"/>
1291 </svn>
1292 </target>
1293
1294 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1295 </target>
1296 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1297 <!-- please keep this function in sync with update-gs2build -->
1298 <echo>checking out gs2build</echo>
1299
1300 <!-- this has to be created first to avoid errors when trying to export to it later -->
1301 <mkdir dir="${basedir}/gs2build/src/lib"/>
1302
1303 <!-- svn checkouts -->
1304 <svn>
1305 <!-- perllib -->
1306 <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1307
1308 </svn>
1309 </target>
1310
1311 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1312 <antcall target="checkout-gs2build"/>
1313 <antcall target="unzip-windows-packages"/>
1314 <antcall target="checkout-winbin"/>
1315 <antcall target="get-windows-binaries"/>
1316 <antcall target="delete-winbin"/>
1317 <antcall target="get-macos-extra"/>
1318 </target>
1319
1320 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1321 unless="nosvn.mode">
1322 <svn>
1323 <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1324 </svn>
1325 </target>
1326
1327 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1328 <svn>
1329 <update dir="winbin" revision="${branch.revision}"/>
1330 </svn>
1331 </target>
1332
1333 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1334 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1335 <fileset dir="${basedir}/winbin/bin"/>
1336 </move>
1337 </target>
1338 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1339 <delete dir="${basedir}/winbin"/>
1340 </target>
1341
1342 <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">
1343 <unzip src="${gs2build.home}/common-src/packages/windows/gdbm/gdbm.zip"
1344 dest="${gs2build.home}/common-src/packages/windows/gdbm"/>
1345 <unzip src="${gs2build.home}/common-src/packages/windows/crypt/crypt.zip"
1346 dest="${gs2build.home}/common-src/packages/windows/crypt"/>
1347 <unzip src="${gs2build.home}/common-src/packages/windows/expat/expat.zip"
1348 dest="${gs2build.home}/common-src/packages/windows/expat"/>
1349 <unzip src="${gs2build.home}/common-src/indexers/packages/windows/iconv/iconv.zip"
1350 dest="${gs2build.home}/common-src/indexers/packages/windows/iconv"/>
1351 </target>
1352
1353 <!-- downloads a good XML-Parser -->
1354 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1355 <!--
1356 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1357 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1358 usetimestamp="true"/>
1359 -->
1360 <echo>Nothing extra currently needed for MacOs prepare</echo>
1361 </target>
1362
1363 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1364 <target name="install-macos-extra" depends="init,get-macos-extra" if="need.macos.extra">
1365 <!-- make sure these directories are present, otherwise chmod craps out
1366 this chmod is needed in case we are unpacking for a second time -->
1367 <!--
1368 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1369 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1370 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1371 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1372 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1373 dest="${gs2build.home}/perllib/cpan/"
1374 compression="gzip"/>
1375 -->
1376 <echo>Nothing extra currently needed for MacOs install</echo>
1377 </target>
1378
1379 <target name="install-indexer-files" depends="init" unless="indexers.present">
1380 <copy todir="${indexers.home}">
1381 <fileset dir="${gs2build.home}/common-src/indexers" />
1382 </copy>
1383 <chmod file="${indexers.home}/configure" perm="a+x"/>
1384 </target>
1385
1386 <target name="rename-gs2build-files" depends="gs2build-edit-setup-bat" if="collection.building.enabled"/>
1387
1388 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1389 <!-- we want a windows path in the setup.bat file -->
1390 <pathconvert targetos="windows" property="gs2build.home.windows">
1391 <path path="${gs2build.home}"/>
1392 </pathconvert>
1393 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1394 <filterset>
1395 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1396 </filterset>
1397 </move>
1398 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1399 </target>
1400
1401 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1402 <antcall target="checkout-gli"/>
1403 </target>
1404
1405 <target name="checkout-gli" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1406 <echo>checking out gli</echo>
1407 <svn>
1408 <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1409 </svn>
1410 </target>
1411
1412 <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1413 description="Configure only the Greenstone 2 building components">
1414 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1415 dir="${gs2build.home}">
1416 <arg value="--prefix=${gs2build.home}"/>
1417 </exec>
1418 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1419 dir="${gs2build.home}">
1420 <arg value="--prefix=${gs2build.home}"/>
1421 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1422 </exec>
1423 </target>
1424
1425 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1426 description="Clean only the Greenstone 2 building components"
1427 if="collection.building.enabled"/>
1428
1429 <target name="clean-gli" depends="init" if="collection.building.enabled">
1430 <!-- gli -->
1431 <property name="gli.home" value="${basedir}/gli"/>
1432 <!-- linux -->
1433 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1434 resolveExecutable="true"/>
1435 <!-- windows -->
1436 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1437 resolveExecutable="true"/>
1438 </target>
1439
1440 <target name="clean-gs2build" depends="init" if="collection.building.enabled">
1441 <!-- gs2build -->
1442 <!--linux: -->
1443 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1444 <arg value="clean"/>
1445 </exec>
1446 <!-- windows: -->
1447 <!-- run the setup script -->
1448 <!--<exec executable="${compile.windows.c++.setup}" os="${os.windows}" />-->
1449 <!--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-->
1450 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}" >
1451 <arg value="/f"/>
1452 <arg value="win32.mak"/>
1453 <arg value="clean"/>
1454 </exec>
1455 </target>
1456
1457 <target name="distclean-gs2building" depends="init,clean-gli,clean-gs2build,distclean-gs2build"
1458 description="Distclean only the Greenstone 2 building components"
1459 if="collection.building.enabled"/>
1460
1461 <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1462 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1463 <arg value="distclean"/>
1464 </exec>
1465 </target>
1466
1467 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1468 description="Compile only the Greenstone 2 building components">
1469 </target>
1470
1471 <target name="compile-gli" depends="init" if="collection.building.enabled">
1472 <!-- gli -->
1473 <property name="gli.home" value="${basedir}/gli"/>
1474
1475 <!-- linux -->
1476 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1477 <!--remote gli-->
1478 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1479 resolveExecutable="true"/>
1480 <!-- windows -->
1481 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1482 <!--remote gli-->
1483 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1484 resolveExecutable="true"/>
1485 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1486 </target>
1487
1488 <target name="compile-gs2build" depends="init" if="collection.building.enabled">
1489 <!-- gs2build -->
1490 <!--linux: make, make install -->
1491 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1492 </exec>
1493 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1494 <arg value="install"/>
1495 </exec>
1496 <!-- run the setup script -->
1497 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1498 <!--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-->
1499 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1500 <arg value="/f"/>
1501 <arg value="win32.mak"/>
1502 </exec>
1503 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1504 <arg value="/f"/>
1505 <arg value="win32.mak"/>
1506 <arg value="install"/>
1507 </exec>
1508 <!-- LuceneWrapper jar file not installed by default -->
1509 <mkdir dir="${gs2build.home}/bin/java"/>
1510 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1511 <antcall target="install-gs2build-indexers-windows"/>
1512 <antcall target="install-macos-extra"/>
1513 </target>
1514
1515 <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
1516 <copy todir="${gs2build.home}/bin/windows">
1517 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1518 <include name="*.*"/>
1519 </fileset>
1520 </copy>
1521 </target>
1522
1523 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1524 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1525 <env key="gsdl3path" path="${basedir}"/>
1526 <env key="gsdlpath" path="${basedir}/gs2build"/>
1527 </exec>
1528 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1529 <env key="gsdl3path" path="${basedir}"/>
1530 <env key="gsdlpath" path="${basedir}/gs2build"/>
1531 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1532 </exec>
1533 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1534 <env key="GSDL3PATH" path="${basedir}"/>
1535 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1536 </exec>
1537 <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 gli4gs3.sh/bat from the greenstone3/gli directory.
1538 </echo>
1539 </target>
1540
1541
1542 <!-- ======================== TESTING Targets ========================= -->
1543
1544 <target name="test" description="Run the (incomplete) JUnit test suite "
1545 depends="init">
1546 <mkdir dir="${basedir}/test"/>
1547 <junit printsummary="withOutAndErr"
1548 errorproperty="test.failed"
1549 failureproperty="test.failed"
1550 fork="${junit.fork}">
1551 <formatter type="plain"/>
1552 <classpath>
1553 <pathelement location="${build.home}/gsdl3test.jar"/>
1554 <path refid="compile.classpath"/>
1555 </classpath>
1556 <test name="${testcase}" if="testcase"/>
1557 <batchtest todir="${basedir}/test" unless="testcase">
1558 <fileset dir="${build.home}" ncludes="**/*Test.class" />
1559 </batchtest>
1560 </junit>
1561 <echo>
1562 *********************************************
1563 Test output can be found in directory 'test'
1564 *********************************************
1565 </echo>
1566 </target>
1567
1568 <!-- ======================== FLAX Targets ========================= -->
1569 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1570 <echo>checking out flax ...</echo>
1571 <mkdir dir="${basedir}/src/java/org/flax"/>
1572 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1573 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1574 <mkdir dir="${web.home}/interfaces/flax"/>
1575 <mkdir dir="${web.home}/sites/flax"/>
1576 <mkdir dir="${basedir}/flax-resources"/>
1577 <mkdir dir="${basedir}/flax-lib"/>
1578 <svn>
1579 <checkout url="${flax.checkout.path}/src/java/org/flax/"
1580 destPath="${basedir}/src/java/org/flax"/>
1581 <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1582 destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1583 <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1584 destPath="${web.home}/WEB-INF/classes/flax"/>
1585 <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1586 destPath="${web.home}/interfaces/flax"/>
1587 <checkout url="${flax.checkout.path}/web/sites/flax/"
1588 destPath="${web.home}/sites/flax"/>
1589 <checkout url="${flax.checkout.path}/flax-resources"
1590 destPath="${basedir}/flax-resources"/>
1591 <checkout url="${flax.checkout.path}/lib"
1592 destPath="${basedir}/flax-lib"/>
1593 </svn>
1594 <echo>prepare flax files...</echo>
1595 <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1596 <antcall target="flax-copy-files" />
1597 <antcall target="unzip-flax-collections" />
1598 <antcall target="unzip-flax-resources" />
1599 </target>
1600
1601 <target name="update-flax" description="update flax from repository">
1602 <echo>updating flax ...</echo>
1603 <svn>
1604 <update dir="${basedir}/src/java/org/flax"/>
1605 <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1606 <update dir="${web.home}/WEB-INF/classes/flax"/>
1607 <update dir="${web.home}/interfaces/flax"/>
1608 <update dir="${web.home}/sites/flax"/>
1609 </svn>
1610 <antcall target="flax-copy-files" />
1611 <antcall target="unzip-flax-collections" />
1612 </target>
1613
1614 <target name="unzip-flax-collections" >
1615 <property name="coll.dir" value="${web.home}/sites/flax/collect"/>
1616 <unzip dest="${coll.dir}">
1617 <fileset dir="${coll.dir}">
1618 <include name="*.zip"/>
1619 </fileset>
1620 </unzip>
1621 <delete>
1622 <fileset dir="${coll.dir}" includes="*.zip"/>
1623 </delete>
1624 </target>
1625
1626 <target name="unzip-flax-resources" >
1627 <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1628 <unzip dest="${classes.dir}">
1629 <fileset dir="${classes.dir}">
1630 <include name="*.zip"/>
1631 </fileset>
1632 </unzip>
1633 <delete>
1634 <fileset dir="${classes.dir}" includes="*.zip"/>
1635 </delete>
1636 </target>
1637
1638 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1639 <echo>copying flax files ...</echo>
1640 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1641 <!-- A configuration file containing web service binding information for the axis engine -->
1642 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1643 <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1644 <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />
1645 </target>
1646
1647
1648 <!-- ======================== GDBM Targets ========================= -->
1649
1650 <target name="prepare-gdbm" depends="init" if="install.gdbm">
1651
1652 <if>
1653 <bool>
1654 <not><available file="${src.packages.home}/${gdbm.version}/.flagfile"/></not>
1655 </bool>
1656
1657 <get src="http://www.greenstone.org/gs3files/${gdbm.version}.tar.gz"
1658 dest="${src.packages.home}/${gdbm.version}.tar.gz" usetimestamp="true"/>
1659 <untar compression= "gzip" src="${src.packages.home}/${gdbm.version}.tar.gz" dest="${src.packages.home}" />
1660 <echo file="${src.packages.home}/${gdbm.version}/.flagfile">
1661 the timestamp of this file is the time that gdbm was extracted from the tar files.
1662 it is used to figure out whether the files need to be refreshed or not in `ant prepare-gdbm`
1663 </echo>
1664 <chmod dir="${src.packages.home}/${gdbm.version}" perm="ugo+wrx" includes="**" />
1665 <antcall target="configure-gdbm" />
1666 <antcall target="compile-gdbm" />
1667
1668 <else>
1669 <echo>GDBM has been prepared, will not prepare</echo>
1670 <echo>Delete ${src.packages.home}/${gdbm.version}/.flagfile to force a fresh prepare</echo>
1671 </else>
1672
1673 </if>
1674
1675 </target>
1676
1677 <target name="configure-gdbm" if="install.gdbm">
1678 <echo>
1679 Configuring GDBM
1680 </echo>
1681 <exec executable="${gdbm.home}/configure" os="${os.mac},${os.unix}"
1682 dir="${gdbm.home}">
1683 <arg value="--prefix=${gdbm.home}"/>
1684 </exec>
1685 </target>
1686
1687 <target name="clean-gdbm" depends="init" if="install.gdbm">
1688 <echo>clean GDBM</echo>
1689 <exec executable="make" os="${os.unix}" dir="${gdbm.home}" >
1690 <arg value="clean"/>
1691 </exec>
1692 </target>
1693
1694
1695 <target name="distclean-gdbm" depends="init" if="install.gdbm">
1696 <echo>distclean GDBM</echo>
1697 <exec executable="make" os="${os.unix}" dir="${gdbm.home}" >
1698 <arg value="distclean"/>
1699 </exec>
1700 </target>
1701
1702 <target name="compile-gdbm" depends="init" if="install.gdbm">
1703 <echo>compile GDBM</echo>
1704 <exec executable="groups" os="${os.unix}" outputproperty="usergroups"/>
1705 <exec executable="awk" os="${os.unix}" inputstring="${usergroups}" outputproperty="firstgroup">
1706 <arg line="'{print $1}'"/>
1707 </exec>
1708
1709 <exec executable="make" os="${os.unix}" dir="${gdbm.home}"/>
1710 <exec executable="make" os="${os.unix}" dir="${gdbm.home}">
1711 <arg value="BINOWN=${env.USER}"/>
1712 <arg value="BINGRP=${firstgroup}"/>
1713 <arg value="install"/>
1714 </exec>
1715 </target>
1716
1717</project>
Note: See TracBrowser for help on using the repository browser.