source: greenstone3/trunk/build.xml@ 18158

Last change on this file since 18158 was 18124, checked in by cc108, 15 years ago

add a statement to copy GAI.jar to admin directory

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