source: greenstone3/trunk/build.xml@ 14148

Last change on this file since 14148 was 13926, checked in by kjdon, 17 years ago

turns out we do need xercesImpl.jar and xml-apis.jar in the web/applet dir for the phind applet to work. we'll copy them in using ant, rather than having them in the CVS tree

  • Property svn:keywords set to Author Date Id Revision
File size: 51.3 KB
Line 
1<?xml version="1.0"?>
2
3<!-- ======================================================================
4 March 2005
5
6 Greenstone3 build and install script
7
8 kjdon
9 ====================================================================== -->
10<project name="greenstone3" default="usage" basedir=".">
11
12 <!-- ============ self defined tasks =================== -->
13
14 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpath="${basedir}/lib/java/anttasks.jar"/>
15 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpath="${basedir}/lib/java/anttasks.jar"/>
16
17
18
19<!-- ===================== Property Definitions =========================== -->
20
21<!--
22
23 Each of the following properties are used in the build script.
24 Values for these properties are set by the first place they are
25 defined, from the following list:
26
27 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
28
29 * Definitions from a "build.properties" file in the top level
30 source directory of this application.
31
32 * Definitions from a "build.properties" file in the user's
33 home directory.
34
35 * Default definitions in this build.xml file.
36
37 You will note below that property values can be composed based on the
38 contents of previously defined properties. This is a powerful technique
39 that helps you minimize the number of changes required when your development
40 environment is modified. Note that property composition is allowed within
41 "build.properties" files as well as in the "build.xml" script.
42
43-->
44
45 <property file="build.properties"/>
46 <property file="${user.home}/build.properties"/>
47
48 <!-- get properties from the environment -->
49 <property environment="env"/>
50 <property name="build.home" value="${basedir}/build"/>
51 <property name="src.home" value="${basedir}/src/java"/>
52 <property name="src.packages.home" value="${basedir}/src/packages"/>
53 <property name="packages.home" value="${basedir}/packages"/>
54 <!-- this may be set in build.properties, eg if you move the web dir to
55 tomcats webapps directory -->
56 <property name="web.home" value="${basedir}/web"/>
57 <!-- jar files needed by applets go here -->
58 <property name="web.applet" value="${web.home}/applet"/>
59 <!-- jar files needed by the servlet (and extra ones) go here -->
60 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
61 <!-- other files needed by the servlet go here -->
62 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
63 <!-- jni libraries and java wrappers go here -->
64 <property name="lib.jni" value="${basedir}/lib/jni"/>
65
66 <property name="javadocs" value="${basedir}/docs/javadoc"/>
67
68 <property name="app.name" value="greenstone3"/>
69 <property name="app.path" value="/${app.name}"/>
70 <property name="app.version" value="3.02"/>
71
72 <property name="cvs.root" value=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src"/>
73 <!-- catalina home is set to tomcat basedir is already installed, otherwise
74 use greenstone's tomcat -->
75 <condition property="catalina.home" value="${tomcat.installed.path}">
76 <and>
77 <isset property="tomcat.installed.path"/>
78 <not>
79 <equals arg1="" arg2="${tomcat.installed.path}"/>
80 </not>
81 </and>
82 </condition>
83 <property name="catalina.home" value="${packages.home}/tomcat"/>
84
85 <property name="os.linux" value="Linux"/>
86 <property name="os.mac" value="Mac OS X"/>
87 <property name="os.solaris" value="SunOS"/>
88 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
89 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP,Windows NT,Windows ME"/> <!-- check this!!!-->
90
91 <!-- this is true for linux and macs -->
92 <condition property="current.os.isunix">
93 <os family="unix"/>
94 </condition>
95
96 <condition property="current.os.isunixnotmac">
97 <and>
98 <os family="unix"/>
99 <not>
100 <os family="mac"/>
101 </not>
102 </and>
103 </condition>
104 <condition property="current.os.ismac">
105 <os family="mac"/>
106 </condition>
107
108 <condition property="current.os.iswindows">
109 <os family="windows"/>
110 </condition>
111
112 <condition property="collection.building.enabled">
113 <not>
114 <isset property="disable.collection.building"/>
115 </not>
116 </condition>
117
118 <condition property="collection.building.enabled.windows">
119 <and>
120 <isset property="collection.building.enabled"/>
121 <isset property="current.os.iswindows"/>
122 </and>
123 </condition>
124
125 <condition property="collection.building.enabled.unix">
126 <and>
127 <isset property="collection.building.enabled"/>
128 <isset property="current.os.isunix"/>
129 </and>
130 </condition>
131
132 <condition property="independent-indexers">
133 <isset property="disable.collection.building"/>
134 </condition>
135
136 <!-- ============= Base dirs for each package and component ============ -->
137 <property name="src.applet.home" value="${src.home}/org/greenstone/applet"/>
138 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
139 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
140 <property name="gs2build.home" value="${basedir}/gs2build"/>
141 <property name="gli.home" value="${basedir}/gli"/>
142 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
143
144 <!--<property name="indexers.home" value="${basedir}/src/packages/indexers">-->
145 <condition property="indexers.home" value="${basedir}/src/packages/indexers">
146 <isset property="disable.collection.building"/>
147 </condition>
148 <condition property="indexers.home" value="${gs2build.home}/indexers">
149 <not>
150 <isset property="disable.collection.building"/>
151 </not>
152 </condition>
153
154 <property name="mg.home" value="${indexers.home}/mg"/>
155 <property name="mgpp.home" value="${indexers.home}/mgpp"/>
156 <property name="lucene.home" value="${indexers.home}/lucene-gs"/>
157
158
159<!-- ==================== Compilation Control Options ==================== -->
160
161<!--
162
163 These properties control option settings on the Javac compiler when it
164 is invoked using the <javac> task.
165
166 compile.debug Should compilation include the debug option?
167
168 compile.deprecation Should compilation include the deprecation option?
169
170 compile.optimize Should compilation include the optimize option?
171
172-->
173
174 <property name="compile.debug" value="true"/>
175 <property name="compile.deprecation" value="true"/>
176 <property name="compile.optimize" value="true"/>
177
178<!--
179
180 Rather than relying on the CLASSPATH environment variable, Ant includes
181 features that makes it easy to dynamically construct the classpath you
182 need for each compilation. The example below constructs the compile
183 classpath to include the servlet.jar file, as well as the other components
184 that Tomcat makes available to web applications automatically, plus anything
185 that you explicitly added.
186
187-->
188
189 <path id="compile.classpath">
190 <!-- Include all jar files and libraries in our jni lib directory -->
191 <pathelement location="${lib.jni}"/>
192 <fileset dir="${lib.jni}">
193 <include name="*.jar"/>
194 </fileset>
195 <!-- Include all jar files in our web lib directory -->
196 <pathelement location="${web.lib}"/>
197 <fileset dir="${web.lib}">
198 <include name="*.jar"/>
199 </fileset>
200
201 <!-- Include the axis jar files -->
202 <!--<fileset dir="${basedir}/comms/soap/axis/lib">
203 <include name="*.jar"/>
204 </fileset>-->
205
206 <!-- include the jar files from the source packages -->
207 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
208 so we add them in by name -->
209 <pathelement location="${lib.jni}/mg.jar"/>
210 <pathelement location="${lib.jni}/mgpp.jar"/>
211
212 <!-- Include all elements that Tomcat exposes to applications -->
213 <pathelement location="${catalina.home}/common/classes"/>
214 <fileset dir="${catalina.home}/common/endorsed">
215 <include name="*.jar"/>
216 </fileset>
217 <fileset dir="${catalina.home}/common/lib">
218 <include name="*.jar"/>
219 </fileset>
220 <pathelement location="${catalina.home}/shared/classes"/>
221 <fileset dir="${catalina.home}/shared/lib">
222 <include name="*.jar"/>
223 </fileset>
224 </path>
225
226 <path id="local.tomcat.classpath">
227 <!-- explicitly include the jni java wrappers in the classpath -->
228 <pathelement location="${lib.jni}"/>
229 <fileset dir="${lib.jni}">
230 <include name="*.jar"/>
231 </fileset>
232 </path>
233
234 <path id="local.tomcat.path">
235 <pathelement location="${basedir}/bin/script"/>
236 <pathelement location="${basedir}/bin"/>
237 <pathelement location="${lib.jni}"/>
238 <pathelement path="${env.PATH}"/>
239 <pathelement path="${env.Path}"/>
240 </path>
241
242 <target name="test-setup">
243 <echo>ant java version=${ant.java.version}</echo>
244 <echo>is unix : ${current.os.isunix}</echo>
245 <echo>is mac : ${current.os.ismac}</echo>
246 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
247 <echo>is windows : ${current.os.iswindows}</echo>
248 <echo>os.unix: ${os.unix}</echo>
249 </target>
250<!-- ==================== Primary and Global Targets ============================= -->
251
252 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
253
254 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
255 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.">
256 <!-- make sure .sh files are executable -->
257 <chmod dir="${basedir}" perm="ugo+rx"
258 includes="*.sh"/>
259 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
260 includes="*.sh,*.pl"/>
261 </target>
262 <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile"
263 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare install'."/>
264
265 <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building,cvsupdate-web"
266 description="Do a cvs update for all sources. Doesn't recompile the code. You need to be online to run this."/>
267
268 <target name="configure-c++" depends="init,configure-packages,configure-core,configure-gs2building"
269 description="Configure any C/C++ package code and gs2building code if necessary"/>
270
271 <target name="configure" depends="init,configure-tomcat,configure-web"
272 description="Configure the installation. Includes setting up config files. Should be re-run if you change the build.properties file."/>
273
274 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
275 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
276
277 <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
278 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
279
280 <target name="update" depends="init,cvsupdate,clean,configure,configure-c++,compile"
281 description="Update (thru CVS) all the source (including core, packages and gs2building), then clean, configure and recompile."/>
282
283 <target name="start" depends="init,start-tomcat"
284 description="Startup the Tomcat server." />
285
286 <target name="stop" depends="init,stop-tomcat"
287 description="Shutdown the Tomcat server."/>
288
289 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
290
291
292<!-- =========== Help targets =================================== -->
293
294 <property name="install-command" value="ant [options] prepare install"/>
295
296 <target name="usage" description="Print a help message">
297 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
298 <echo message=" Execute 'ant -help' for Ant help."/>
299 <echo>To install Greenstone3, run '${install-command}'.
300There 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.
301To log the output, use the '-logfile build.log' option.
302The README.txt file has more information about the ant targets and install process.
303 </echo>
304 </target>
305
306 <target name="help" depends="usage" description="Print a help message"/>
307
308 <target name="debug" depends="init" description="Display all the currently used properties">
309 <echoproperties/>
310 </target>
311
312<!-- ====== initialization and setup targets ================== -->
313
314 <target name="accept-properties" unless="properties.accepted">
315 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
316tomcat.server=${tomcat.server}
317tomcat.port=${tomcat.port}
318tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
319proxy.host=${proxy.host}
320proxy.port=${proxy.port}
321If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
322 </input>
323 <condition property="do.abort">
324 <equals arg1="n" arg2="${properties.ok}"/>
325 </condition>
326 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
327 </target>
328
329 <target name="check-cvsroot">
330 <condition property="cvsroot.notset">
331 <or>
332 <not>
333 <isset property="env.CVSROOT"/>
334 </not>
335 <equals arg1="" arg2="${env.CVSROOT}"/>
336 </or>
337 </condition>
338 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
339 </target>
340
341 <!-- this sets up some initial properties -->
342 <target name="init">
343
344 <condition property="java.too.old">
345 <or>
346 <equals arg1="1.1" arg2="${ant.java.version}"/>
347 <equals arg1="1.2" arg2="${ant.java.version}"/>
348 <equals arg1="1.3" arg2="${ant.java.version}"/>
349 </or>
350 </condition>
351 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
352
353 <available file="${indexers.home}" property="indexers.present"/>
354 <available file="${basedir}/gli" property="gli.present"/>
355 <available file="${basedir}/gs2build" property="gs2build.present"/>
356
357 <condition property="tomcat.islocal">
358 <or>
359 <not>
360 <isset property="tomcat.installed.path"/>
361 </not>
362 <equals arg1="" arg2="${tomcat.installed.path}"/>
363 </or>
364 </condition>
365
366 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
367 <condition property="proxy.present">
368 <and>
369 <isset property="proxy.host"/>
370 <not>
371 <equals arg1="" arg2="${proxy.host}"/>
372 </not>
373 </and>
374 </condition>
375
376 <condition property="need.macos.extra">
377 <and>
378 <isset property="current.os.ismac"/>
379 <not>
380 <isset property="disable.collection.building"/>
381 </not>
382 </and>
383 </condition>
384 </target>
385
386 <target name="setup-proxy" depends="init" if="proxy.present">
387 <condition property="ask.user">
388 <or>
389 <equals arg1="" arg2="${proxy.user}"/>
390 <equals arg1="" arg2="${proxy.password}"/>
391 </or>
392 </condition>
393 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
394 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
395 </target>
396
397 <!-- ========== Web app Targets ================================ -->
398
399 <target name="prepare-web" depends="init,configure-java-version">
400 <mkdir dir="${web.home}/applet"/>
401 <mkdir dir="${web.home}/logs"/>
402 </target>
403
404 <!-- 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 -->
405 <target name="configure-java-version" depends="init"
406 description="Run this target if you have changed the default version of java since installing greenstone3">
407 <condition property="need.xalan.jar">
408 <equals arg1="1.5" arg2="${ant.java.version}"/>
409 </condition>
410 <antcall target="activate-xalan-jar"/>
411 <antcall target="deactivate-xalan-jar"/>
412 </target>
413
414 <target name="activate-xalan-jar" if="need.xalan.jar">
415 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
416 </target>
417
418 <target name="deactivate-xalan-jar" unless="need.xalan.jar">
419 <delete file="${web.lib}/xalan.jar"/>
420 </target>
421
422 <target name="prepare-collections" depends="init">
423 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
424 <!-- gs2mgdemo -->
425 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
426 dest="${collect.dir}/gs2mgdemo"/>
427 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
428 dest="${collect.dir}/gs2mgdemo"/>
429 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
430 dest="${collect.dir}/gs2mgdemo/index"/>
431 <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
432 <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
433 <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
434 <!-- gs2mgppdemo -->
435 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
436 dest="${collect.dir}/gs2mgppdemo"/>
437 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
438 dest="${collect.dir}/gs2mgppdemo"/>
439 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
440 dest="${collect.dir}/gs2mgppdemo/index"/>
441 <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
442 <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
443 <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
444 <!-- gberg -->
445 <unzip src="${collect.dir}/gberg/index/index.zip"
446 dest="${collect.dir}/gberg/index"/>
447 <delete file="${collect.dir}/gberg/index/index.zip"/>
448 </target>
449
450
451 <target name="configure-web" depends="init"
452 description="Configure only the web app config files">
453 <!-- we want a unix path in the global.properties file -->
454 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
455 <path path="${web.home}"/>
456 </pathconvert>
457 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
458 <filter token="gsdl3version" value="${app.version}"/>
459 <filter token="tomcat.server" value="${tomcat.server}"/>
460 <filter token="tomcat.port" value="${tomcat.port}"/>
461 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
462 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
463 <chmod file="${web.classes}/global.properties" perm="600"/>
464 <chmod file="${web.classes}/log4j.properties" perm="600"/>
465 </target>
466
467 <target name="compile-web" depends="init">
468 <javac srcdir="${web.classes}"
469 destdir="${web.classes}"
470 debug="${compile.debug}"
471 deprecation="${compile.deprecation}"
472 optimize="${compile.optimize}">
473 <classpath>
474 <path refid="compile.classpath"/>
475 </classpath>
476 </javac>
477 </target>
478
479 <target name="cvsupdate-web" unless="nocvs.mode">
480 <cvs command="update -dP" dest="${web.home}"/>
481 </target>
482
483 <target name="update-web" depends="init,cvsupdate-web,configure-web"
484 description="update only the web stuff (config files)"/>
485
486
487<!-- ======================= Tomcat Targets ========================== -->
488
489 <!-- this target downloads and installs Tomcat -->
490 <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
491 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
492
493 <!-- check that packages dir is there -->
494 <mkdir dir="${packages.home}"/>
495 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.12.zip"
496 dest="${packages.home}/apache-tomcat-5.5.12.zip"
497 usetimestamp="true"/>
498 <unzip src="${packages.home}/apache-tomcat-5.5.12.zip"
499 dest="${packages.home}"/>
500 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.12-compat.zip"
501 dest="${packages.home}/apache-tomcat-5.5.12-compat.zip"
502 usetimestamp="true"/>
503 <unzip src="${packages.home}/apache-tomcat-5.5.12-compat.zip"
504 dest="${packages.home}"/>
505 <!-- delete any existing tomcat -->
506 <delete dir="${packages.home}/tomcat"/>
507 <move todir="${packages.home}/tomcat">
508 <fileset dir="${packages.home}/apache-tomcat-5.5.12"/>
509 </move>
510 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
511 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
512 overwrite="true"/>
513 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
514 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
515 overwrite="true"/>
516 <!-- make sure we have execute permission for the .sh files -->
517 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
518 includes="*.sh"/>
519 </target>
520
521 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
522
523 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
524 <!-- re-setup the server.xml file -->
525 <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
526 <filterset>
527 <filter token="port" value="${tomcat.port}"/>
528 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
529 </filterset>
530 </copy>
531 <!-- set up the greenstone3 context -->
532 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
533 <filterset>
534 <filter token="gsdl3webhome" value="${basedir}/web"/>
535 </filterset>
536 </copy>
537 </target>
538
539 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
540 <!-- re-setup the server.xml file -->
541 <!-- need to edit the config file, or do we get the user to do this???-->
542 </target>
543
544 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
545 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
546 <property name="tomcat.path" refid="local.tomcat.path"/>
547 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
548 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
549 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
550 <env key="GSDL3HOME" value="${basedir}"/>
551 <env key="PATH" path="${tomcat.path}"/>
552 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
553 <env key="CATALINA_HOME" value="${catalina.home}"/>
554 <env key="CLASSPATH" path="${tomcat.classpath}"/>
555 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
556 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
557 </exec>
558 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
559 <env key="GSDLOS" value="windows"/>
560 <env key="GSDL3HOME" value="${basedir}"/>
561 <env key="Path" path="${tomcat.path}"/>
562 <env key="PATH" path="${tomcat.path}"/>
563 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
564 <env key="CLASSPATH" path="${tomcat.classpath}"/>
565 </exec>
566 <!-- wait for the server to startup in case other targets need it running -->
567 <waitfor maxwait="5" maxwaitunit="second">
568 <and>
569 <socket server="${tomcat.server}" port="${tomcat.port}"/>
570 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
571 </and>
572 </waitfor>
573 </target>
574 <!-- windows: do we want to launch a webrowser?? -->
575 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
576 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
577 <env key="CATALINA_HOME" value="${catalina.home}"/>
578 </exec>
579 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
580 </target>
581
582 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
583
584 <target name="setup-catalina-ant-tasks">
585 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
586 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
587 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
588 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
589 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
590 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
591 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
592 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
593 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
594 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
595 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
596 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
597 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
598 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
599 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
600 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
601 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
602 </target>
603
604
605
606
607
608
609<!-- ======================= ant Targets ============================ -->
610 <target name="prepare-ant" depends="init">
611 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
612 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
613 usetimestamp="true"/>
614 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
615 dest="${packages.home}"/>
616 <move todir="${packages.home}/ant">
617 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
618 </move>
619 </target>
620
621<!-- ======================= Axis Targets ============================ -->
622
623 <target name="prepare-axis" depends="init">
624 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
625 dest="${packages.home}/axis-bin-1_2_1.zip"
626 usetimestamp="true"/>
627 <unzip src="${packages.home}/axis-bin-1_2_1.zip"
628 dest="${packages.home}"/>
629 <move todir="${packages.home}/axis">
630 <fileset dir="${packages.home}/axis-1_2_1"/>
631 </move>
632 <!-- install axis into greenstone web app -->
633 <copy todir="${web.lib}">
634 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
635 <include name="*.jar"/>
636 </fileset>
637 </copy>
638 <copy todir="${web.home}">
639 <fileset dir="${packages.home}/axis/webapps/axis/">
640 <include name="*.jsp"/>
641 <include name="*.jws"/>
642 </fileset>
643 </copy>
644 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
645 <copy todir="${web.classes}">
646 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
647 <include name="*.properties"/>
648 </fileset>
649 </copy>
650 </target>
651
652 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,create-deployment-files,deploy-site"
653 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
654
655 <target name="deploy-site">
656 <java classname="org.apache.axis.client.AdminClient">
657 <classpath refid="compile.classpath"/>
658 <arg value="-l"/>
659 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
660 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
661 </java>
662 </target>
663
664 <target name="soap-undeploy-site" depends="get-sitename"
665 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
666 <java classname="org.apache.axis.client.AdminClient">
667 <classpath refid="compile.classpath"/>
668 <arg value="-l"/>
669 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
670 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
671 </java>
672 </target>
673
674 <!-- this target used to deploy the preprepared localsite server -->
675 <target name="deploy-localsite" depends="init"
676 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
677 <antcall target="start-tomcat"/>
678 <antcall target="deploy-site">
679 <param name="axis.sitename" value="localsite"/>
680 </antcall>
681 <antcall target="stop-tomcat"/>
682 </target>
683
684 <target name="get-sitename" unless="axis.sitename">
685 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
686 </target>
687
688 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
689 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
690 <echo>${axis.sitename}, ${axis.siteuri}</echo>
691 </target>
692
693 <target name="check-deployment-files" depends="get-sitename">
694 <condition property="deploy.exists">
695 <and>
696 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
697 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
698 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
699 </and>
700 </condition>
701 </target>
702
703 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
704 if="axis.sitename" unless="deploy.exists">
705 <filter token="sitename" value="${axis.sitename}"/>
706 <filter token="siteuri" value="${axis.siteuri}"/>
707 <copy file="${basedir}/resources/soap/site.wsdd.template"
708 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
709 filtering="true"/>
710 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
711 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
712 filtering="true"/>
713 <!-- create the java files and compile them -->
714 <copy file="${basedir}/resources/java/SOAPServer.java.in"
715 tofile="${src.gsdl3.home}/SOAPServer${axis.sitename}.java"
716 filtering="true"/>
717 <mkdir dir="${build.home}"/>
718 <javac srcdir="${src.home}"
719 destdir="${build.home}"
720 debug="${compile.debug}"
721 deprecation="${compile.deprecation}"
722 optimize="${compile.optimize}">
723 <classpath refid="compile.classpath"/>
724 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
725 </javac>
726 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
727 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
728 </target>
729
730
731<!-- ====================== Core targets ============================== -->
732<!-- core targets refer to the core gsdl3 java src -->
733
734 <target name="prepare-core" unless="nocvs.mode">
735 <!-- just get rid of empty directories-->
736 <cvs command="update -P"/>
737 </target>
738
739 <target name="configure-core"/>
740
741 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
742 description="Update only the Greenstone core" />
743
744 <target name="cvsupdate-core" unless="nocvs.mode">
745 <cvs command="update -l"/>
746 <cvs command="update -dP bin comms dist-resources docs lib resources src winutil"/>
747 </target>
748
749 <target name="clean-core"
750 description="Clean only the Greenstone core">
751 <delete dir="${build.home}"/>
752 </target>
753
754 <target name="compile-core" depends="init"
755 description="Compile only the Greenstone core">
756 <mkdir dir="${build.home}"/>
757 <javac srcdir="${src.home}"
758 destdir="${build.home}"
759 debug="${compile.debug}"
760 deprecation="${compile.deprecation}"
761 optimize="${compile.optimize}">
762 <classpath>
763 <path refid="compile.classpath"/>
764 </classpath>
765 </javac>
766 <jar destfile="${build.home}/gsdl3.jar">
767 <fileset dir="${build.home}">
768 <include name="org/greenstone/gsdl3/**"/>
769 <exclude name="**/Test.class"/>
770 </fileset>
771 <manifest>
772 <attribute name="Built-By" value="${user.name}" />
773 </manifest>
774 </jar>
775 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
776 <!-- copy the localsite server in case we need it -->
777 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServerlocalsite.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServerlocalsite.class" />
778
779 <jar destfile="${build.home}/GAI.jar">
780 <fileset dir="${build.home}">
781 <include name="org/greenstone/admin/**"/>
782 </fileset>
783 <manifest>
784 <attribute name="Built-By" value="${user.name}" />
785 </manifest>
786 </jar>
787
788 <jar destfile="${build.home}/phind.jar">
789 <fileset dir="${build.home}">
790 <include name="org/greenstone/applet/phind/**"/>
791 </fileset>
792 <manifest>
793 <attribute name="Built-By" value="${user.name}" />
794 </manifest>
795 </jar>
796 <mkdir dir="${web.applet}"/>
797 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
798 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
799 <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
800 <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
801 <jar destfile="${build.home}/anttasks.jar">
802 <fileset dir="${build.home}">
803 <include name="org/greenstone/anttasks/**"/>
804 </fileset>
805 <manifest>
806 <attribute name="Built-By" value="${user.name}" />
807 </manifest>
808 </jar>
809 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
810 <jar destfile="${build.home}/gsdl3test.jar">
811 <fileset dir="${build.home}">
812 <include name="org/greenstone/gsdl3/**/*Test.class"/>
813 <include name="org/greenstone/testing/**"/>
814 </fileset>
815 <manifest>
816 <attribute name="Built-By" value="${user.name}" />
817 </manifest>
818 </jar>
819 <jar destfile="${build.home}/server.jar">
820 <fileset dir="${build.home}">
821 <include name="org/greenstone/server/**"/>
822 </fileset>
823 <fileset file="${basedir}/resources/java/server.properties"/>
824 <manifest>
825 <attribute name="Built-By" value="${user.name}"/>
826 </manifest>
827 </jar>
828 <copy file="${build.home}/server.jar" todir="${basedir}"/>
829 </target>
830
831<!-- ================== Packages targets ================================ -->
832 <!-- these targets refer to the greenstone source packages - these need
833 updating less often, so are in separate targets to the core -->
834 <target name="prepare-packages" depends="init,prepare-indexers"/>
835
836 <target name="checkout-indexers" depends="check-cvsroot,init" if="independent-indexers" unless="nocvs.mode">
837 <cvs command="checkout -P" package="indexers" dest="${src.packages.home}"/>
838 </target>
839
840 <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
841 <antcall target="checkout-indexers"/>
842 </target>
843
844 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
845 description="Update only the source packages"/>
846
847 <target name="cvsupdate-packages" unless="nocvs.mode">
848 <cvs command="update -dP" dest="${src.packages.home}"/>
849 </target>
850
851 <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
852 description="Configure only the packages."/>
853
854 <target name="configure-javagdbm">
855 <echo>
856 Configuring JavaGDBM
857 </echo>
858 <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
859 dir="${javagdbm.home}">
860 <arg value="--prefix=${basedir}"/>
861 <arg value="--libdir=${lib.jni}"/>
862 </exec>
863 <exec executable="${javagdbm.home}/configure" os="${os.mac}"
864 dir="${javagdbm.home}">
865 <arg value="--prefix=${basedir}"/>
866 <arg value="--libdir=${lib.jni}"/>
867 <arg value="--with-gdbm=${gdbm.installed.path}"/>
868 </exec>
869
870 </target>
871 <target name="configure-indexers" depends="init" if="independent-indexers">
872 <echo>
873 Configuring Indexers
874 </echo>
875 <exec executable="${indexers.home}/configure" os="${os.unix}"
876 dir="${indexers.home}">
877 <arg value="--prefix=${basedir}"/>
878 <arg value="--libdir=${lib.jni}"/>
879 </exec>
880 </target>
881
882 <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
883
884 <target name="clean-javagdbm" depends="init">
885 <exec executable="make" os="${os.unix}"
886 dir="${javagdbm.home}">
887 <arg value="clean"/>
888 </exec>
889 </target>
890
891 <target name="clean-indexers" depends="init" if="independent-indexers">
892 <exec executable="make" os="${os.unix}"
893 dir="${indexers.home}">
894 <arg value="clean"/>
895 </exec>
896 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
897 dir="${indexers.home}">
898 <arg value="clean"/>
899 </exec>
900
901 </target>
902
903 <target name="compile-packages"
904 description="Compile only the source packages">
905 <!-- javagdbm -->
906 <exec executable="make" os="${os.unix}"
907 dir="${javagdbm.home}">
908 </exec>
909 <exec executable="make" os="${os.unix}"
910 dir="${javagdbm.home}">
911 <arg value="install"/>
912 </exec>
913 <!-- windows: just the java stuff. -->
914 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}"
915 dir="${javagdbm.home}">
916 <arg value="compile"/>
917 <arg value="javaonly"/>
918 </exec>
919 <!-- install the jar file -->
920 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
921
922 <!-- Indexers -->
923 <!-- this may be in gs2build - we will be recompiling, but never mind -->
924 <exec executable="make" os="${os.unix}"
925 dir="${indexers.home}">
926 </exec>
927 <exec executable="make" os="${os.unix}"
928 dir="${indexers.home}">
929 <arg value="install"/>
930 </exec>
931 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
932 dir="${indexers.home}">
933 <arg value="all"/>
934 </exec>
935 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
936 dir="${indexers.home}">
937 <arg value="install"/>
938 </exec>
939 <!-- install the jar and jni files -->
940 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
941 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
942 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
943 <antcall target="install-jni-files"/>
944 </target>
945
946 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
947
948 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
949 <copy file="${mg.home}/jni/libmgjni.so" todir="${lib.jni}"/>
950 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
951 <copy file="${mgpp.home}/jni/libmgppjni.so" todir="${lib.jni}"/>
952 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
953 </target>
954 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
955 <copy file="${mg.home}/jni/mgjni.dll" todir="${lib.jni}"/>
956 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
957 <copy file="${mgpp.home}/jni/mgppjni.dll" todir="${lib.jni}"/>
958 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
959 </target>
960 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
961 <copy file="${mg.home}/jni/libmgjni.jnilib" todir="${lib.jni}"/>
962 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
963 <copy file="${mgpp.home}/jni/libmgppjni.jnilib" todir="${lib.jni}"/>
964 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
965 </target>
966
967 <!-- ================== gs2building targets ===============-->
968
969
970 <target name="update-gs2building" if="collection.building.enabled"
971 depends="init,cvsupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
972 description="Update only the Greenstone 2 building components"/>
973
974 <target name="cvsupdate-gs2building" if="collection.building.enabled" depends="init,cvsupdate-gs2build,cvsupdate-gli" unless="nocvs.mode">
975 </target>
976 <target name="cvsupdate-gs2build" if="collection.building.enabled" depends="init" unless="nocvs.mode">
977 <!-- Note: can't do a -d update here cos it will get all of gsdl
978 also, an update doesn't get new files, so we do a checkout instead. -->
979 <cvs command="checkout -P" package="gs2build" dest="${basedir}"/>
980 </target>
981
982 <target name="cvsupdate-gli" if="collection.building.enabled" depends="init" unless="nocvs.mode">
983 <cvs command="update -dP" dest="${gli.home}"/>
984 </target>
985
986 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
987 </target>
988
989 <target name="checkout-gs2build" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode">
990 <echo>checking out gs2build</echo>
991 <cvs command="checkout -P" package="gs2build"/>
992 </target>
993
994 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
995 <antcall target="checkout-gs2build"/>
996 <antcall target="rename-gs2build-files"/>
997 <antcall target="unzip-windows-packages"/>
998 <antcall target="checkout-winbin"/>
999 <antcall target="get-windows-binaries"/>
1000 <antcall target="delete-winbin"/>
1001 <antcall target="get-macos-extra"/>
1002 </target>
1003
1004 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1005 unless="nocvs.mode">
1006 <cvs command="checkout -P" package="winbin"/>
1007 </target>
1008
1009 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1010 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1011 <fileset dir="${basedir}/winbin/bin"/>
1012 </move>
1013 </target>
1014 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1015 <delete dir="${basedir}/winbin"/>
1016 </target>
1017
1018 <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">
1019 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1020 dest="${gs2build.home}/packages/windows/gdbm"/>
1021 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1022 dest="${gs2build.home}/packages/windows/crypt"/>
1023 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1024 dest="${gs2build.home}/packages/windows/expat"/>
1025 </target>
1026
1027 <!-- downloads a good XML-Parser -->
1028 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1029 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1030 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1031 usetimestamp="true"/>
1032 </target>
1033
1034 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1035 <target name="install-macos-extra" depends="init" if="need.macos.extra">
1036 <!-- make sure these directories are present, otherwise chmod craps out
1037 this chmod is needed in case we are unpacking for a second time -->
1038 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1039 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1040 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1041 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1042 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1043 dest="${gs2build.home}/perllib/cpan/"
1044 compression="gzip"/>
1045 </target>
1046
1047 <target name="install-indexer-files" depends="init" unless="indexers.present">
1048 <copy todir="${indexers.home}">
1049 <fileset dir="${gs2build.home}/indexers" />
1050 </copy>
1051 <chmod file="${indexers.home}/configure" perm="a+x"/>
1052 </target>
1053
1054 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows,gs2build-edit-setup-bat" if="collection.building.enabled"/>
1055
1056 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1057 <!-- we want a windows path in the setup.bat file -->
1058 <pathconvert targetos="windows" property="gs2build.home.windows">
1059 <path path="${gs2build.home}"/>
1060 </pathconvert>
1061 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1062 <filterset>
1063 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1064 </filterset>
1065 </move>
1066 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1067 </target>
1068
1069 <target name="rename-gs2build-files-windows" if="collection.building.enabled.windows">
1070 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1071 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1072 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1073 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"/>
1074 </target>
1075
1076 <target name="rename-gs2build-files-unix" if="collection.building.enabled.unix">
1077 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1078 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1079 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1080 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1081 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1082 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1083 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1084 <copy file="${gs2build-extra.home}/packages.Makefile.in" tofile="${gs2build.home}/packages/Makefile.in"/>
1085 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1086 </target>
1087
1088 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1089 <antcall target="checkout-gli"/>
1090 </target>
1091
1092 <target name="checkout-gli" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode">
1093 <echo>checking out gli</echo>
1094 <cvs command="checkout -P" package="gli"/>
1095 </target>
1096
1097 <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1098 description="Configure only the Greenstone 2 building components">
1099 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1100 dir="${gs2build.home}">
1101 <arg value="--prefix=${gs2build.home}"/>
1102 </exec>
1103 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1104 dir="${gs2build.home}">
1105 <arg value="--prefix=${gs2build.home}"/>
1106 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1107 </exec>
1108 </target>
1109
1110 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1111 description="Clean only the Greenstone 2 building components"
1112 if="collection.building.enabled"/>
1113
1114 <target name="clean-gli" depends="init" if="collection.building.enabled">
1115 <!-- gli -->
1116 <property name="gli.home" value="${basedir}/gli"/>
1117 <!-- linux -->
1118 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1119 resolveExecutable="true"/>
1120 <!-- windows -->
1121 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1122 resolveExecutable="true"/>
1123 </target>
1124
1125 <target name="clean-gs2build" depends="init" if="collection.building.enabled">
1126 <!-- gs2build -->
1127 <!--linux: -->
1128 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1129 <arg value="clean"/>
1130 </exec>
1131 <!-- windows: -->
1132 <!-- run the setup script -->
1133 <exec executable="${compile.windows.c++.setup}"/>
1134 <exec executable="nmake" dir="${gs2build.home}">
1135 <arg value="/f"/>
1136 <arg value="win32.mak"/>
1137 <arg value="clean"/>
1138 </exec>
1139 </target>
1140
1141 <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1142 <!-- gs2build -->
1143 <!--linux: -->
1144 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1145 <arg value="distclean"/>
1146 </exec>
1147 <!-- windows: -->
1148 </target>
1149
1150 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1151 description="Compile only the Greenstone 2 building components">
1152 </target>
1153
1154 <target name="compile-gli" depends="init" if="collection.building.enabled">
1155 <!-- gli -->
1156 <property name="gli.home" value="${basedir}/gli"/>
1157 <!-- linux -->
1158 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}"
1159 resolveExecutable="true"/>
1160 <!-- windows -->
1161 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1162 resolveExecutable="true"/>
1163 </target>
1164
1165 <target name="compile-gs2build" depends="init" if="collection.building.enabled">
1166 <!-- gs2build -->
1167 <!--linux: make, make install -->
1168 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1169 </exec>
1170 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1171 <arg value="install"/>
1172 </exec>
1173 <!-- run the setup script -->
1174 <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>
1175 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1176 <arg value="/f"/>
1177 <arg value="win32.mak"/>
1178 </exec>
1179 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1180 <arg value="/f"/>
1181 <arg value="win32.mak"/>
1182 <arg value="install"/>
1183 </exec>
1184 <!-- LuceneWrapper jar file not installed by default -->
1185 <mkdir dir="${gs2build.home}/bin/java"/>
1186 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1187 <antcall target="install-gs2build-indexers-windows"/>
1188 <antcall target="install-macos-extra"/>
1189 </target>
1190
1191 <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
1192 <copy todir="${gs2build.home}/bin/windows">
1193 <fileset dir="${gs2build.home}/indexers/bin">
1194 <include name="*.*"/>
1195 </fileset>
1196 </copy>
1197 </target>
1198
1199 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1200 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1201 <env key="gsdl3path" path="${basedir}"/>
1202 <env key="gsdlpath" path="${basedir}/gs2build"/>
1203 </exec>
1204 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1205 <env key="gsdl3path" path="${basedir}"/>
1206 <env key="gsdlpath" path="${basedir}/gs2build"/>
1207 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1208 </exec>
1209 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1210 <env key="GSDL3PATH" path="${basedir}"/>
1211 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1212 </exec>
1213 <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.
1214 </echo>
1215 </target>
1216
1217
1218<!-- ======================== TESTING Targets ========================= -->
1219
1220 <target name="test" description="Run the (incomplete) JUnit test suite "
1221 depends="init">
1222 <mkdir dir="${basedir}/test"/>
1223 <junit printsummary="withOutAndErr"
1224 errorproperty="test.failed"
1225 failureproperty="test.failed"
1226 fork="${junit.fork}">
1227 <formatter type="plain"/>
1228 <classpath>
1229 <pathelement location="${build.home}/gsdl3test.jar"/>
1230 <path refid="compile.classpath"/>
1231 </classpath>
1232 <test name="${testcase}" if="testcase"/>
1233 <batchtest todir="${basedir}/test" unless="testcase">
1234 <fileset dir="${build.home}"
1235 includes="**/*Test.class"
1236 />
1237 </batchtest>
1238 </junit>
1239 <echo>
1240 *********************************************
1241 Test output can be found in directory 'test'
1242 *********************************************
1243 </echo>
1244 </target>
1245
1246</project>
1247
1248
Note: See TracBrowser for help on using the repository browser.