source: trunk/gsdl3/build.xml@ 13739

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

made new indexers repository work when coll building is enabled - we set indexers.home to be gs2build/indexers, and copy java and jni files from there to gs3 places

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