source: trunk/gsdl3/build.xml@ 13402

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

changed the cvs command line 1004 to match others

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