source: trunk/gsdl3/build.xml@ 13206

Last change on this file since 13206 was 13206, checked in by kjdon, 18 years ago

removed a vishnu path, added a filter for tomcat.shutdown.port, jar up the new server code into its own jar file and copy it to web.lib - is that the right place? also it will need gsdl3.jar - should the needed classes go into the jar too?

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