source: trunk/gsdl3/build.xml@ 10680

Last change on this file since 10680 was 10680, checked in by kjdon, 19 years ago

a new configure for gs2build for mac - needs --with-gdbm option

  • 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,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,set-mysql-account-passwords,stop-mysql"/>
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="get-mysql-root-password" depends="init,init-mysql-vars" if="mysql.islocal.usepassword">
636 <condition property="ask.root.password">
637 <or>
638 <not>
639 <isset property="mysql.root.password"/>
640 </not>
641 <equals arg1="" arg2="${mysql.root.password}"/>
642 </or>
643 </condition>
644 <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"/>
645 </target>
646
647 <target name="get-mysql-gsdl3-passwords" depends="init,init-mysql-vars" if="mysql.islocal.usepassword">
648 <condition property="ask.admin.password">
649 <or>
650 <not>
651 <isset property="mysql.admin.password"/>
652 </not>
653 <equals arg1="" arg2="${mysql.admin.password}"/>
654 </or>
655 </condition>
656 <condition property="ask.reader.password">
657 <or>
658 <not>
659 <isset property="mysql.reader.password"/>
660 </not>
661 <equals arg1="" arg2="${mysql.reader.password}"/>
662 </or>
663 </condition>
664 <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"/>
665 <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"/>
666 </target>
667
668 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows,install-mysql-mac"/>
669
670 <!-- install the database : linux-->
671 <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present">
672 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
673 dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
674 usetimestamp="true"/>
675 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
676 dest="${packages.home}"
677 compression="gzip"/>
678 <move todir="${packages.home}/mysql">
679 <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/>
680 </move>
681 <!-- file permissions are screwed up, so make executables executable -->
682 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
683 <chmod perm="a+x">
684 <fileset dir="${mysql.home}/bin" />
685 </chmod>
686 <mkdir dir="${mysql.home}/var/"/>
687 <mkdir dir="${mysql.home}/var/log/"/>
688 <chmod file="${mysql.home}/var/" perm="777"/>
689 <chmod file="${mysql.home}/var/log/" perm="777"/>
690
691 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
692 <arg value="--datadir=./data"/>
693 <arg value="--basedir=."/>
694 <arg value="--user=root"/>
695 <arg value="--force"/>
696 </exec>
697 </target>
698
699
700 <!-- install the database : mac-->
701 <target name="install-mysql-mac" depends="init,init-mysql-vars" if="mysql.islocal.mac" unless="mysql.present">
702 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
703 dest="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
704 usetimestamp="true"/>
705 <untar src="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
706 dest="${packages.home}"
707 compression="gzip"/>
708 <move todir="${packages.home}/mysql">
709 <fileset dir="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc"/>
710 </move>
711 <!-- file permissions are screwed up, so make executables executable -->
712 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
713 <chmod perm="a+x">
714 <fileset dir="${mysql.home}/bin" />
715 </chmod>
716 <mkdir dir="${mysql.home}/var/"/>
717 <mkdir dir="${mysql.home}/var/log/"/>
718 <chmod file="${mysql.home}/var/" perm="777" type="dir"/>
719 <chmod file="${mysql.home}/var/log/" perm="777" type="dir"/>
720 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
721 <arg value="--datadir=./data"/>
722 <arg value="--basedir=."/>
723 <!--<arg value="- -user=root"/>
724 <arg value="- -force"/>-->
725 </exec>
726 </target>
727
728 <!-- install the database : windows -->
729 <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present">
730 <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip"
731 dest="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
732 usetimestamp="true"/>
733 <!-- can we run the installer?? -->
734 <unzip src="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
735 dest="${packages.home}"/>
736 <move todir="${packages.home}/mysql">
737 <fileset dir="${packages.home}/mysql-4.1.11-win32"/>
738 </move>
739 </target>
740
741 <target name="setup-mysql" depends="init" if="mysql.islocal">
742 <!-- setup the gsdl3 accounts -->
743 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
744 <arg value="--user=root"/>
745 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost"/>
746 </exec>
747 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
748 <arg value="--user=root"/>
749 <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost"/>
750 </exec>
751 <!--<exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
752 <arg value="- -user=root"/>
753 <arg value="- -execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%';"/>
754 </exec>-->
755
756 <!-- remove the anonymous user -->
757 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
758 <arg value="--user=root"/>
759 <arg value="--execute=delete from mysql.user where Host='localhost' and User='';"/>
760 </exec>
761 <!-- load in the demo collection database -->
762 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
763 <arg value="--user=root"/>
764 <arg value="--execute=create database localsite_gs3mgdemo;"/>
765 </exec>
766 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
767 input="${web.home}/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql">
768 <arg value="--user=root"/>
769 <arg value="localsite_gs3mgdemo"/>
770 </exec>
771 </target>
772
773 <target name="set-mysql-account-passwords" depends="init,init-mysql-vars,get-mysql-root-password,get-mysql-gsdl3-passwords" if="mysql.islocal.usepassword">
774 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
775 <arg value="--user=root"/>
776 <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;"/>
777 </exec>
778 </target>
779
780 <target name="start-mysql" depends="init,init-mysql-vars" if="mysql.islocal"
781 description="Startup only mysql">
782 <echo>Starting up the mysql server</echo>
783 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
784 spawn="true" os="${os.linux},${os.mac}">
785 <arg value="--datadir=./data"/>
786 <arg value="--basedir=."/>
787 <arg value="--pid_file=gsdl3.pid"/>
788 <arg value="--socket=/tmp/mysql.sock"/>
789 <arg value="--port=${mysql.port}"/>
790 <arg value="--err-log=./var/log/mysql.log"/>
791 </exec>
792 <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
793 <arg value="--port=${mysql.port}"/>
794 </exec>
795 <sleep seconds="2"/>
796 </target>
797
798 <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"
799 description="Shutdown only mysql">
800 <echo>MYSQL database server shutdown successfully</echo>
801 </target>
802
803 <target name="stop-mysql-no-password" depends="init" if="mysql.islocal.nopassword">
804 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
805 failonerror="true" os="${os.linux},{os.mac}">
806 <arg value="--user=root"/>
807 <arg value="--socket=/tmp/mysql.sock"/>
808 <arg value="shutdown"/>
809 </exec>
810 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
811 failonerror="true" os="${os.windows}">
812 <arg value="--user=root"/>
813 <arg value="shutdown"/>
814 </exec>
815 </target>
816
817 <target name="stop-mysql-use-password-linux" depends="init" if="mysql.islocal.usepassword.unix">
818 <echo>At the password prompt, enter the mysql root password.</echo>
819 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
820 failonerror="true" os="${os.linux},{os.mac}">
821 <arg value="--user=root"/>
822 <arg value="-p"/>
823 <arg value="--socket=/tmp/mysql.sock"/>
824 <arg value="shutdown"/>
825 </exec>
826 </target>
827
828 <target name="stop-mysql-use-password-windows" depends="init" if="mysql.islocal.usepassword.windows">
829 <!--<antcall target="get-mysql-root-password"/>
830 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.-->
831 <condition property="ask.root.password">
832 <or>
833 <not>
834 <isset property="mysql.root.password"/>
835 </not>
836 <equals arg1="" arg2="${mysql.root.password}"/>
837 </or>
838 </condition>
839 <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"/>
840 <!-- on windows it doesn't work unless the password is specified here -->
841 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
842 failonerror="true" os="${os.windows}">
843 <arg value="--user=root"/>
844 <arg value="-p${mysql.root.password}"/>
845 <arg value="shutdown"/>
846 </exec>
847 </target>
848
849 <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,stop-mysql,start-mysql"/>
850
851
852<!-- ======================= Axis Targets ============================ -->
853
854 <target name="prepare-axis" depends="init">
855 <mkdir dir="${basedir}/comms/soap"/>
856 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
857 dest="${basedir}/comms/soap/axis-bin-1_2_1.zip"
858 usetimestamp="true"/>
859 <delete dir="${basedir}/comms/soap/axis.bak"/>
860 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false">
861 <fileset dir="${basedir}/comms/soap/axis"/>
862 </move>
863 <unzip src="${basedir}/comms/soap/axis-bin-1_2_1.zip"
864 dest="${basedir}/comms/soap/"/>
865 <move todir="${basedir}/comms/soap/axis">
866 <fileset dir="${basedir}/comms/soap/axis-1_2_1"/>
867 </move>
868 <!-- install axis into greenstone web app -->
869 <copy todir="${web.lib}">
870 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/WEB-INF/lib">
871 <include name="*.jar"/>
872 </fileset>
873 </copy>
874 <copy todir="${web.home}">
875 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/">
876 <include name="*.jsp"/>
877 <include name="*.jws"/>
878 </fileset>
879 </copy>
880 <copy tofile="${web.home}/axis.html" file="${basedir}/comms/soap/axis/webapps/axis/index.html"/>
881 <copy todir="${web.classes}">
882 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/WEB-INF/classes">
883 <include name="*.properties"/>
884 </fileset>
885 </copy>
886 </target>
887
888 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files"
889 description="Deploy a SOAP web service for a local Greenstone site">
890 <java classname="org.apache.axis.client.AdminClient">
891 <classpath refid="compile.classpath"/>
892 <arg value="-l"/>
893 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
894 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
895 </java>
896 </target>
897
898 <target name="soap-undeploy-site" depends="get-sitename"
899 description="Undeploy a SOAP web service for a local Greenstone site">
900 <java classname="org.apache.axis.client.AdminClient">
901 <classpath refid="compile.classpath"/>
902 <arg value="-l"/>
903 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
904 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
905 </java>
906 </target>
907
908 <!-- this target used to deploy the localsite server for the default installation -->
909 <target name="deploy-localsite" depends="init">
910 <antcall target="start-tomcat"/>
911 <antcall target="soap-deploy-site">
912 <param name="axis.sitename" value="localsite"/>
913 <param name="axis.siteuri" value="localsite"/>
914 </antcall>
915 <antcall target="stop-tomcat"/>
916 </target>
917
918 <target name="get-sitename" unless="axis.sitename">
919 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
920 </target>
921
922 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
923 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
924 <echo>${axis.sitename}, ${axis.siteuri}</echo>
925 </target>
926 <target name="check-deployment-files" depends="get-sitename">
927 <condition property="deploy.exists">
928 <and>
929 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
930 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
931 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
932 </and>
933 </condition>
934 </target>
935
936 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
937 if="axis.sitename" unless="deploy.exists">
938 <filter token="sitename" value="${axis.sitename}"/>
939 <filter token="siteuri" value="${axis.siteuri}"/>
940 <copy file="${basedir}/resources/soap/site.wsdd.template"
941 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
942 filtering="true"/>
943 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
944 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
945 filtering="true"/>
946 <!-- create the java files and compile them -->
947 <copy file="${gsdl3.home}/SOAPServer.java.in"
948 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
949 filtering="true"/>
950 <javac srcdir="${src.home}"
951 destdir="${build.home}"
952 debug="${compile.debug}"
953 deprecation="${compile.deprecation}"
954 optimize="${compile.optimize}">
955 <classpath refid="compile.classpath"/>
956 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
957 </javac>
958 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
959 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
960 </target>
961
962
963<!-- ====================== Core targets ============================== -->
964<!-- core targets refer to the core gsdl3 java src -->
965
966 <target name="prepare-core" unless="nocvs.mode">
967 <!-- just get rid of empty directories-->
968 <cvs command="update -P"/>
969 </target>
970
971 <target name="configure-core"/>
972
973 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
974 description="Update only the Greenstone core" />
975
976 <target name="cvsupdate-core" unless="nocvs.mode">
977 <cvs command="update -l"/>
978 <cvs command="update -dP bin comms dist-resources docs lib resources src winutil"/>
979 </target>
980
981 <target name="clean-core"
982 description="Clean only the Greenstone core">
983 <delete dir="${build.home}"/>
984 </target>
985
986 <target name="compile-core"
987 description="Compile only the Greenstone core">
988 <mkdir dir="${build.home}"/>
989 <javac srcdir="${src.home}"
990 destdir="${build.home}"
991 debug="${compile.debug}"
992 deprecation="${compile.deprecation}"
993 optimize="${compile.optimize}">
994 <classpath>
995 <path refid="compile.classpath"/>
996 </classpath>
997 </javac>
998 <jar destfile="${build.home}/gsdl3.jar">
999 <fileset dir="${build.home}">
1000 <include name="org/greenstone/gsdl3/**"/>
1001 <exclude name="**/Test.class"/>
1002 </fileset>
1003 <manifest>
1004 <attribute name="Built-By" value="${user.name}" />
1005 </manifest>
1006 </jar>
1007 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1008 <jar destfile="${build.home}/phind.jar">
1009 <fileset dir="${build.home}">
1010 <include name="org/greenstone/applet/phind/**"/>
1011 </fileset>
1012 <manifest>
1013 <attribute name="Built-By" value="${user.name}" />
1014 </manifest>
1015 </jar>
1016 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1017 <jar destfile="${build.home}/anttasks.jar">
1018 <fileset dir="${build.home}">
1019 <include name="org/greenstone/anttasks/**"/>
1020 </fileset>
1021 <manifest>
1022 <attribute name="Built-By" value="${user.name}" />
1023 </manifest>
1024 </jar>
1025 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
1026 <jar destfile="${build.home}/gsdl3test.jar">
1027 <fileset dir="${build.home}">
1028 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1029 <include name="org/greenstone/testing/**"/>
1030 </fileset>
1031 <manifest>
1032 <attribute name="Built-By" value="${user.name}" />
1033 </manifest>
1034 </jar>
1035 </target>
1036
1037<!-- ================== Packages targets ================================ -->
1038 <!-- these targets refer to the greenstone packages - these need updating
1039 less often, so are in separate targets to the core -->
1040 <target name="prepare-packages" depends="init,prepare-mgpp,prepare-windows"/>
1041
1042 <target name="prepare-windows" depends="init" if="current.os.iswindows">
1043 <!-- need to download precompiled binaries for mg and mgpp -->
1044 </target>
1045
1046 <target name="checkout-mgpp" depends="check-cvsroot,init" unless="nocvs.mode">
1047 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
1048 </target>
1049
1050 <target name="prepare-mgpp" depends="init" unless="mgpp.present">
1051 <antcall target="checkout-mgpp"/>
1052 </target>
1053
1054 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
1055 description="Update only the packages"/>
1056
1057 <target name="cvsupdate-packages" unless="nocvs.mode">
1058 <cvs command="update -dP" dest="${packages.home}"/>
1059 </target>
1060
1061 <target name="configure-packages" description="Configure only the packages.">
1062 <echo>
1063 Configuring MG
1064 </echo>
1065 <exec executable="${mg.home}/configure" os="${os.linux},${os.mac}"
1066 dir="${mg.home}">
1067 <arg value="--prefix=${basedir}"/>
1068 <arg value="--libdir=${lib.jni}"/>
1069 </exec>
1070 <echo>
1071 Configuring MGPP
1072 </echo>
1073 <exec executable="${mgpp.home}/configure" os="${os.linux},${os.mac}"
1074 dir="${mgpp.home}">
1075 <arg value="--prefix=${basedir}"/>
1076 <arg value="--libdir=${lib.jni}"/>
1077 </exec>
1078 </target>
1079
1080 <target name="clean-packages"
1081 description="Clean only the packages">
1082 <!-- mg : just call the make target -->
1083 <exec executable="make" os="${os.linux},${os.mac}"
1084 dir="${mg.home}">
1085 <arg value="clean"/>
1086 </exec>
1087 <!-- mgpp -->
1088 <exec executable="make" os="${os.linux},${os.mac}"
1089 dir="${mg.home}">
1090 <arg value="clean"/>
1091 </exec>
1092 <!-- vishnu : just call the ant target -->
1093 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
1094 inheritall="false" target="clean">
1095 <property name="catalina.home" value="${catalina.home}"/>
1096 </ant>
1097 <!-- gsdl-as : just call the ant target-->
1098 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
1099 inheritall="false" target="clean">
1100 <property name="catalina.home" value="${catalina.home}"/>
1101 </ant>
1102 </target>
1103
1104 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
1105 description="Clean only the C/C++ packages">
1106 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1107 <arg value="clean"/>
1108 </exec>
1109 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1110 <arg value="clean"/>
1111 </exec>
1112 </target>
1113
1114 <target name="compile-packages"
1115 description="Compile only the packages">
1116 <echo>Compiling MG</echo>
1117 <exec executable="make" os="${os.linux},${os.mac}"
1118 dir="${mg.home}">
1119 </exec>
1120 <exec executable="make" os="${os.linux},${os.mac}"
1121 dir="${mg.home}">
1122 <arg value="install"/>
1123 </exec>
1124 <!-- windows: just the java stuff. -->
1125 <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
1126 dir="${mg.home}">
1127 <arg value="compile"/>
1128 <arg value="javaonly"/>
1129 </exec>
1130 <!-- install the jar file -->
1131 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1132
1133 <!-- mgpp -->
1134 <echo>Compiling MGPP</echo>
1135 <exec executable="make" os="${os.linux},${os.mac}"
1136 dir="${mgpp.home}">
1137 </exec>
1138 <exec executable="make" os="${os.linux},${os.mac}"
1139 dir="${mgpp.home}">
1140 <arg value="install"/>
1141 </exec>
1142 <!-- windows: just the java stuff. -->
1143 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
1144 dir="${mgpp.home}">
1145 <arg value="compile"/>
1146 <arg value="javaonly"/>
1147 </exec>
1148 <!-- install the jar file -->
1149 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1150
1151 <!-- vishnu -->
1152 <echo>Compiling Vishnu</echo>
1153 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
1154 inheritall="false" target="compile">
1155 <property name="catalina.home" value="${catalina.home}"/>
1156 </ant>
1157
1158 <!-- gsdl-as -->
1159 <echo>Compiling GSDL-AS</echo>
1160 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
1161 inheritall="false" target="compile">
1162 <property name="catalina.home" value="${catalina.home}"/>
1163 </ant>
1164 </target>
1165
1166 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
1167 description="Compile only the C/C++ packages">
1168 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"/>
1169 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1170 <arg value="install"/>
1171 <env key="GSDL3HOME" value="${basedir}"/>
1172 </exec>
1173 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"/>
1174 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1175 <arg value="install"/>
1176 <env key="GSDL3HOME" value="${basedir}"/>
1177 </exec>
1178 </target>
1179
1180 <!-- ================== gs2building targets ===============-->
1181
1182
1183 <target name="update-gs2building" if="gsdl2.islocal"
1184 depends="init,cvsupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1185 description="Update only the Greenstone 2 building components"/>
1186
1187 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init" unless="nocvs.mode">
1188 <cvs command="update -dP" dest="${gli.home}"/>
1189 <!-- Note: can't do a -d update here cos it will get all of gsdl
1190 also, an update doesn't get new files, so we do a checkout instead. -->
1191 <cvs command="co gs2build" dest="${basedir}"/>
1192 </target>
1193
1194 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
1195 </target>
1196
1197 <target name="checkout-gs2build" depends="check-cvsroot,init" unless="nocvs.mode">
1198 <echo>checking out gs2build</echo>
1199 <cvs command="checkout -P" package="gs2build"/>
1200 </target>
1201
1202 <target name="prepare-gs2build" depends="init" if="gsdl2.islocal" unless="gs2build.present">
1203 <antcall target="checkout-gs2build"/>
1204 <!-- rename the .gs2build files -->
1205 <antcall target="rename-gs2build-files"/>
1206 <antcall target="unzip-windows-packages"/>
1207 <antcall target="get-windows-binaries"/>
1208 </target>
1209
1210 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1211 unless="nocvs.mode">
1212 <cvs command="checkout -P" package="winbin"/>
1213 </target>
1214
1215 <target name="get-windows-binaries" depends="init,checkout-winbin" if="current.os.iswindows">
1216 <copy todir="${basedir}/bin">
1217 <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/>
1218 </copy>
1219 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1220 <fileset dir="${basedir}/winbin/bin"/>
1221 </move>
1222 <delete dir="${basedir}/winbin"/>
1223 </target>
1224
1225 <target name="unzip-windows-packages" depends="init">
1226 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1227 dest="${gs2build.home}/packages/windows/gdbm"/>
1228 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1229 dest="${gs2build.home}/packages/windows/crypt"/>
1230 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1231 dest="${gs2build.home}/packages/windows/expat"/>
1232 </target>
1233
1234 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows"/>
1235
1236 <target name="rename-gs2build-files-windows" if="current.os.iswindows">
1237 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1238 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1239 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1240 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1241 <filterset>
1242 <filter token="gsdlhome" value="${gs2build.home}"/>
1243 </filterset>
1244 </copy>
1245 </target>
1246 <target name="rename-gs2build-files-unix" if="current.os.isunix">
1247 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1248 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1249 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1250 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1251 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1252 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1253 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1254 <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/>
1255 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1256
1257 </target>
1258 <target name="prepare-gli" depends="init" if="gsdl2.islocal" unless="gli.present">
1259 <antcall target="checkout-gli"/>
1260 </target>
1261
1262 <target name="checkout-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="nocvs.mode">
1263 <echo>checking out gli</echo>
1264 <cvs command="checkout -P" package="gli"/>
1265 </target>
1266
1267 <target name="configure-gs2building" depends="init" if="gsdl2.islocal"
1268 description="Configure only the Greenstone 2 building components">
1269 <exec executable="${gs2build.home}/configure" os="${os.linux}"
1270 dir="${gs2build.home}">
1271 <arg value="--prefix=${gs2build.home}"/>
1272 </exec>
1273 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1274 dir="${gs2build.home}">
1275 <arg value="--prefix=${gs2build.home}"/>
1276 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1277 </exec>
1278 </target>
1279
1280 <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
1281 description="Clean only the Greenstone 2 building components">
1282 <!-- gli -->
1283 <property name="gli.home" value="${basedir}/gli"/>
1284 <!-- linux -->
1285 <exec executable="clean.sh" os="${os.linux},${os.mac}" dir="${gli.home}"
1286 resolveExecutable="true"/>
1287 <!-- windows -->
1288 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1289 resolveExecutable="true"/>
1290 <!-- gs2build -->
1291 <!--linux: -->
1292 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
1293 <arg value="clean"/>
1294 </exec>
1295 <!-- windows: -->
1296 </target>
1297
1298 <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1299 description="remove all object files and executables">
1300 <!-- run the setup script -->
1301 <exec executable="${compile.windows.c++.setup}"/>
1302 <exec executable="nmake" dir="${gs2build.home}">
1303 <arg value="/f"/>
1304 <arg value="win32.mak"/>
1305 <arg value="clean"/>
1306 </exec>
1307 </target>
1308
1309 <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
1310 description="Compile only the Greenstone 2 building components">
1311 <!-- gli -->
1312 <property name="gli.home" value="${basedir}/gli"/>
1313 <!-- linux -->
1314 <exec executable="makegli.sh" os="${os.linux},${os.mac}" dir="${gli.home}"
1315 resolveExecutable="true"/>
1316 <!-- windows -->
1317 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1318 resolveExecutable="true"/>
1319 <!-- gs2build -->
1320 <!--linux: make, make install -->
1321 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
1322 </exec>
1323 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
1324 <arg value="install"/>
1325 </exec>
1326 </target>
1327 <!-- windows: -->
1328 <target name="compile-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1329 description="Use this if you want to compile the C++ code for the gs2build package">
1330 <!-- run the setup script -->
1331 <exec executable="${compile.windows.c++.setup}"/>
1332 <exec executable="nmake" dir="${gs2build.home}">
1333 <arg value="/f"/>
1334 <arg value="win32.mak"/>
1335 </exec>
1336 </target>
1337 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
1338 </target>
1339
1340 <target name="gli-local" depends="init" if="gsdl2.islocal">
1341 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.mac}" dir="${basedir}/gli" spawn="true">
1342 <env key="gsdl3path" path="${basedir}"/>
1343 <env key="gsdlpath" path="${basedir}/gs2build"/>
1344 </exec>
1345 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1346 <env key="GSDL3PATH" path="${basedir}"/>
1347 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1348 </exec>
1349 <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.
1350 </echo>
1351 </target>
1352
1353 <target name="gli-external" depends="init" unless="gsdl2.islocal">
1354 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux},${os.mac}" dir="${gsdl2.installed.path}/gli" spawn="true">
1355 <env key="gsdl3path" path="${basedir}"/>
1356 <env key="gsdlpath" path="${gsdl2.installed.path}"/>
1357 </exec>
1358 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli" spawn="true">
1359 <env key="GSDL3PATH" path="${basedir}"/>
1360 <env key="GSDLPATH" path="${gsdl2.installed.path}"/>
1361 </exec>
1362 <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:
1363 (Linux/Mac OS X / Windows)
1364in gsdl3 directory: source gs3-setup.sh / gs3-setup
1365in gsdl directory: source setup.bash / setup
1366in gli directory: gli4gs3.sh / gli4gs3
1367 </echo>
1368 </target>
1369
1370
1371<!-- ======================== TESTING Targets ========================= -->
1372
1373 <target name="test" description="Run the (incomplete) JUnit test suite "
1374 depends="init">
1375 <mkdir dir="${basedir}/test"/>
1376 <junit printsummary="withOutAndErr"
1377 errorproperty="test.failed"
1378 failureproperty="test.failed"
1379 fork="${junit.fork}">
1380 <formatter type="plain"/>
1381 <classpath>
1382 <pathelement location="${build.home}/gsdl3test.jar"/>
1383 <path refid="compile.classpath"/>
1384 </classpath>
1385 <test name="${testcase}" if="testcase"/>
1386 <batchtest todir="${basedir}/test" unless="testcase">
1387 <fileset dir="${build.home}"
1388 includes="**/*Test.class"
1389 />
1390 </batchtest>
1391 </junit>
1392 <echo>
1393 *********************************************
1394 Test output can be found in directory 'test'
1395 *********************************************
1396 </echo>
1397 </target>
1398
1399
1400<!-- ====================== DISTRIBUTION Targets ========================= -->
1401
1402 <target name="prepare-for-dist" depends="init">
1403 <cvs command="export -D '1 second ago'" package="mgpp"
1404 dest="${basedir}/packages/"
1405 cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
1406 <cvs command="export -D '1 second ago'" package="gs2build"
1407 cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
1408 <cvs command="export -D '1 second ago'" package="gli"
1409 cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
1410 <antcall target="rename-gs2build-files"/>
1411 <antcall target="unzip-windows-packages"/>
1412 <antcall target="get-windows-binaries"/>
1413 <antcall target="install-mysql"/>
1414 <antcall target="start-mysql"/>
1415 <antcall target="setup-mysql"/>
1416 <antcall target="stop-mysql-no-password"/>
1417 <antcall target="prepare-tomcat"/>
1418 <antcall target="configure-tomcat"/>
1419 <antcall target="prepare-axis"/>
1420 <!-- delete old axis dir -->
1421 <delete dir="${basedir}/comms/soap/axis"/>
1422 <antcall target="prepare-web"/>
1423 <antcall target="configure-c++"/>
1424 <antcall target="compile"/>
1425 <antcall target="deploy-localsite"/>
1426 <xslt in="build.xml" out="dist-build.xml" style="dist-resources/convert-build-xml.xsl"/>
1427 <delete dir="${basedir}/dist-resources"/>
1428 </target>
1429
1430 <target name="get-perl-for-windows" if="current.os.iswindows">
1431 <get src="http://www.greenstone.org/gs3files/perl-for-windows.zip"
1432 dest="${gs2build.home}/bin/windows/perl-for-windows.zip"
1433 usetimestamp="true"/>
1434 <unzip src="${gs2build.home}/bin/windows/perl-for-windows.zip"
1435 dest="${gs2build.home}/bin/windows"/>
1436 </target>
1437
1438 <target name="install-for-dist" depends="accept-properties,init,start-mysql,set-mysql-account-passwords,stop-mysql,configure,configure-tomcat">
1439
1440 </target>
1441</project>
1442
1443
Note: See TracBrowser for help on using the repository browser.