source: trunk/gsdl3/build.xml@ 10685

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

moved the mysql set password bit into the install target (instead of prepare target, so only get prompted for password once. prepare-for-dist and install-for-dist can now use the modified prepare-mysql and configure-mysql

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