source: trunk/gsdl3/build.xml@ 10676

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

new targets to create the binary release, changed the mysql targets around a bit

  • Property svn:keywords set to Author Date Id Revision
File size: 58.9 KB
RevLine 
[8418]1<?xml version="1.0"?>
[9874]2
[8418]3<!-- ======================================================================
[9874]4 March 2005
[8418]5
[9874]6 GSDL3 build and install script
[8418]7
[9874]8 kjdon
[8418]9 ====================================================================== -->
[9874]10<project name="gsdl3" default="usage" basedir=".">
[8418]11
[9874]12 <!-- ============ self defined tasks =================== -->
[8418]13
[9874]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"/>
[8418]16
17
18
[9874]19<!-- ===================== Property Definitions =========================== -->
[8418]20
[9874]21<!--
[8418]22
[9874]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:
[8418]26
[9874]27 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
[8418]28
[9874]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"/>
[10101]53 <!-- this may be set in build.properties, eg if you move the web dir to
54 tomcats webapps directory -->
[9874]55 <property name="web.home" value="${basedir}/web"/>
[10069]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 -->
[9874]61 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
[10069]62 <!-- jni libraries and java wrappers go here -->
63 <property name="lib.jni" value="${basedir}/lib/jni"/>
[9874]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"/>
[10069]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>
[9874]81 <property name="catalina.home" value="${basedir}/comms/jakarta/tomcat"/>
[10069]82
[10195]83 <property name="os.linux" value="Linux"/>
[10147]84 <property name="os.mac" value="Mac OS X"/>
[10116]85 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP,Windows NT,Windows ME"/> <!-- check this!!!-->
[9874]86
[10195]87 <!-- this is true for linux and macs -->
88 <condition property="current.os.isunix">
[9874]89 <os family="unix"/>
90 </condition>
[10235]91
[10197]92 <condition property="current.os.isunixnotmac">
93 <and>
94 <os family="unix"/>
95 <not>
[10235]96 <os family="mac"/>
[10197]97 </not>
98 </and>
99 </condition>
100 <condition property="current.os.ismac">
101 <os family="mac"/>
102 </condition>
[10235]103
[9874]104 <condition property="current.os.iswindows">
105 <os family="windows"/>
106 </condition>
[10197]107
[9874]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">
[10069]151 <!-- Include all jar files and libraries in our jni lib directory -->
152 <pathelement location="${lib.jni}"/>
153 <fileset dir="${lib.jni}">
[9874]154 <include name="*.jar"/>
155 </fileset>
[10069]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>
[9874]161
162 <!-- Include the axis jar files -->
[10676]163 <!--<fileset dir="${basedir}/comms/soap/axis/lib">
[9874]164 <include name="*.jar"/>
[10676]165 </fileset>-->
[9874]166
167 <!-- include the jar files from the packages -->
[10069]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"/>
[9874]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
[10069]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">
[9874]197 <pathelement location="${mysql.home}/bin"/>
198 <pathelement location="${basedir}/bin/script"/>
199 <pathelement location="${basedir}/bin"/>
[10069]200 <pathelement location="${lib.jni}"/>
[9874]201 <pathelement path="${env.PATH}"/>
202 <pathelement path="${env.Path}"/>
203 </path>
204
[10116]205 <target name="test-setup">
206 <echo>ant java version=${ant.java.version}</echo>
[10197]207 <echo>is linux : ${current.os.isunix}</echo>
208 <echo>is mac : ${current.os.ismac}</echo>
209 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
[10116]210 <echo>is windows : ${current.os.iswindows}</echo>
[10069]211 </target>
[9874]212<!-- ==================== Primary and Global Targets ============================= -->
213
214 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
215
[10195]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
[10116]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
[10069]222 <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building,cvsupdate-web"
[10116]223 description="Do a cvs update for all sources. Doesn't recompile the code. You need to be online to run this."/>
[9874]224
[10116]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."/>
[9874]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"/>
[10116]235
[10069]236 <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
[9874]237 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
[10116]238
[9874]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"/>
[10116]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."/>
[9874]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
[10116]251 <target name="restart" description="Shutdown and restart the (local) Greenstone servers" depends="init,stop,start"/>
[9874]252
253
254<!-- =========== Help targets =================================== -->
255
[10676]256 <property name="install-command" value="ant [options] prepare install"/>
257
[9874]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."/>
[10676]261 <echo>To install Greenstone3, run '${install-command}'.
[9874]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.
[10116]264The README.txt file has more information about the ant targets and install process.
[9874]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>
[10116]305
[9874]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>
[10301]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}"/>
[9874]368 </target>
[10676]369
[10069]370 <!-- ========== Web app Targets ================================ -->
[9874]371
[10069]372 <target name="prepare-web">
373 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[9874]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"/>
[10069]398 <mkdir dir="${web.home}/applet"/>
[10235]399
400 <condition property="need.xml.jars">
401 <equals arg1="1.5" arg2="${ant.java.version}"/>
402 </condition>
403 <antcall target="rename-xml-jars"/>
[9874]404 </target>
[10235]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>
[9874]410
[10676]411 <target name="configure-web" depends="init,get-mysql-gsdl3-passwords"
[10301]412 description="Configure only the web app config files">
[10656]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}"/>
[10301]418 <filter token="mysql.port" value="${mysql.port}"/>
419 <filter token="mysql.server" value="${mysql.server}"/>
[10311]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"/>
[9874]426 </target>
427
[10301]428 <target name="compile-web" depends="init">
[10069]429 <javac srcdir="${web.classes}"
430 destdir="${web.classes}"
[9874]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
[10195]440 <target name="cvsupdate-web" unless="nocvs.mode">
[10069]441 <cvs command="update -dP" dest="${web.home}"/>
442 </target>
[9874]443
[10116]444 <target name="update-web" depends="init,cvsupdate-web,configure-web"
445 description="update only the web stuff (config files)"/>
[9874]446
[10116]447
[9874]448<!-- ======================= Tomcat Targets ========================== -->
[10301]449
[9874]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>
[10127]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"/>
[9874]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"/>
[9980]486 <copy file="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7/common/endorsed/xml-apis.jar"
[10069]487 tofile="${web.applet}/xml-apis.jar"/>
[9980]488 <copy file="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7/common/endorsed/xercesImpl.jar"
[10069]489 tofile="${web.applet}/xercesImpl.jar"/>
[9874]490 </target>
491
[10069]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">
[9874]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
[10069]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
[9874]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">
[10069]516 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
517 <property name="tomcat.path" refid="local.tomcat.path"/>
[9874]518 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
[10189]519 <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux},${os.mac}" dir="${catalina.home}/bin" spawn="false">
[10195]520 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
[9874]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}"/>
[10301]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-->
[9874]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">
[10189]550 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux},${os.mac}" dir="${catalina.home}/bin" spawn="false">
[9874]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. -->
[10676]582 <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql,setup-mysql,set-mysql-account-passwords,stop-mysql"/>
[9874]583
584 <target name="init-mysql-vars">
585 <condition property="mysql.islocal.linux">
586 <and>
587 <isset property="mysql.islocal"/>
[10197]588 <isset property="current.os.isunixnotmac"/>
[9874]589 </and>
590 </condition>
[10197]591 <condition property="mysql.islocal.mac">
[10676]592 <and>
593 <isset property="mysql.islocal"/>
594 <isset property="current.os.ismac"/>
595 </and>
[10197]596 </condition>
[9874]597 <condition property="mysql.islocal.windows">
598 <and>
599 <isset property="mysql.islocal"/>
600 <isset property="current.os.iswindows"/>
601 </and>
602 </condition>
[10676]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.nopassword">
617 <and>
618 <isset property="mysql.islocal"/>
619 <or>
620 <not>
621 <isset property="mysql.use.passwords"/>
622 </not>
623 <equals arg1="no" arg2="${mysql.use.passwords}"/>
624 </or>
625 </and>
626 </condition>
[9874]627 </target>
628
[10676]629 <target name="get-mysql-root-password" depends="init,init-mysql-vars" if="mysql.islocal.usepassword">
630 <condition property="ask.root.password">
631 <or>
632 <not>
633 <isset property="mysql.root.password"/>
634 </not>
635 <equals arg1="" arg2="${mysql.root.password}"/>
636 </or>
637 </condition>
638 <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"/>
639 </target>
640
641 <target name="get-mysql-gsdl3-passwords" depends="init,init-mysql-vars" if="mysql.islocal.usepassword">
642 <condition property="ask.admin.password">
643 <or>
644 <not>
645 <isset property="mysql.admin.password"/>
646 </not>
647 <equals arg1="" arg2="${mysql.admin.password}"/>
648 </or>
649 </condition>
650 <condition property="ask.reader.password">
651 <or>
652 <not>
653 <isset property="mysql.reader.password"/>
654 </not>
655 <equals arg1="" arg2="${mysql.reader.password}"/>
656 </or>
657 </condition>
658 <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"/>
659 <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"/>
660 </target>
661
[10197]662 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows,install-mysql-mac"/>
[9874]663
[10676]664 <!-- install the database : linux-->
[9874]665 <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present">
666 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
667 dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
668 usetimestamp="true"/>
669 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
670 dest="${packages.home}"
671 compression="gzip"/>
672 <move todir="${packages.home}/mysql">
673 <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/>
674 </move>
675 <!-- file permissions are screwed up, so make executables executable -->
676 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
677 <chmod perm="a+x">
678 <fileset dir="${mysql.home}/bin" />
679 </chmod>
680 <mkdir dir="${mysql.home}/var/"/>
681 <mkdir dir="${mysql.home}/var/log/"/>
682 <chmod file="${mysql.home}/var/" perm="777"/>
683 <chmod file="${mysql.home}/var/log/" perm="777"/>
684
685 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
686 <arg value="--datadir=./data"/>
687 <arg value="--basedir=."/>
688 <arg value="--user=root"/>
689 <arg value="--force"/>
690 </exec>
691 </target>
692
[10197]693
[10676]694 <!-- install the database : mac-->
[10197]695 <target name="install-mysql-mac" depends="init,init-mysql-vars" if="mysql.islocal.mac" unless="mysql.present">
696 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
697 dest="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
698 usetimestamp="true"/>
699 <untar src="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
700 dest="${packages.home}"
701 compression="gzip"/>
702 <move todir="${packages.home}/mysql">
703 <fileset dir="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc"/>
704 </move>
705 <!-- file permissions are screwed up, so make executables executable -->
706 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
707 <chmod perm="a+x">
708 <fileset dir="${mysql.home}/bin" />
709 </chmod>
710 <mkdir dir="${mysql.home}/var/"/>
711 <mkdir dir="${mysql.home}/var/log/"/>
712 <chmod file="${mysql.home}/var/" perm="777" type="dir"/>
713 <chmod file="${mysql.home}/var/log/" perm="777" type="dir"/>
714 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
715 <arg value="--datadir=./data"/>
716 <arg value="--basedir=."/>
717 <!--<arg value="- -user=root"/>
718 <arg value="- -force"/>-->
719 </exec>
720 </target>
721
[10676]722 <!-- install the database : windows -->
[9874]723 <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present">
724 <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip"
725 dest="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
726 usetimestamp="true"/>
727 <!-- can we run the installer?? -->
728 <unzip src="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
729 dest="${packages.home}"/>
730 <move todir="${packages.home}/mysql">
731 <fileset dir="${packages.home}/mysql-4.1.11-win32"/>
732 </move>
733 </target>
734
[10676]735 <target name="setup-mysql" depends="init" if="mysql.islocal">
736 <!-- setup the gsdl3 accounts -->
[9874]737 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
738 <arg value="--user=root"/>
[10676]739 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost"/>
[9874]740 </exec>
[10676]741 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
742 <arg value="--user=root"/>
743 <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost"/>
744 </exec>
[10314]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@'%';"/>
748 </exec>-->
[10676]749
750 <!-- remove the anonymous user -->
[9874]751 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
752 <arg value="--user=root"/>
[10676]753 <arg value="--execute=delete from mysql.user where Host='localhost' and User='';"/>
[9874]754 </exec>
[10311]755 <!-- load in the demo collection database -->
[9874]756 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
757 <arg value="--user=root"/>
758 <arg value="--execute=create database localsite_gs3mgdemo;"/>
759 </exec>
760 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
[10069]761 input="${web.home}/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql">
[9874]762 <arg value="--user=root"/>
763 <arg value="localsite_gs3mgdemo"/>
764 </exec>
[10676]765 </target>
766
767 <target name="set-mysql-account-passwords" depends="init,init-mysql-vars,get-mysql-root-password,get-mysql-gsdl3-passwords" if="mysql.islocal.usepassword">
[10311]768 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
769 <arg value="--user=root"/>
[10676]770 <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;"/>
771 </exec>
[9874]772 </target>
773
[10311]774 <target name="start-mysql" depends="init,init-mysql-vars" if="mysql.islocal"
775 description="Startup only mysql">
776 <echo>Starting up the mysql server</echo>
777 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
778 spawn="true" os="${os.linux},${os.mac}">
779 <arg value="--datadir=./data"/>
780 <arg value="--basedir=."/>
781 <arg value="--pid_file=gsdl3.pid"/>
782 <arg value="--socket=/tmp/mysql.sock"/>
783 <arg value="--port=${mysql.port}"/>
784 <arg value="--err-log=./var/log/mysql.log"/>
785 </exec>
786 <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
[10315]787 <arg value="--port=${mysql.port}"/>
[10311]788 </exec>
789 <sleep seconds="2"/>
790 </target>
791
[10676]792 <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"
[9874]793 description="Shutdown only mysql">
[10676]794 <echo>MYSQL database server shutdown successfully</echo>
795 </target>
796
797 <target name="stop-mysql-no-password" depends="init" if="mysql.islocal.nopassword">
[9874]798 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
[10197]799 failonerror="true" os="${os.linux},{os.mac}">
[9874]800 <arg value="--user=root"/>
[10676]801 <arg value="--socket=/tmp/mysql.sock"/>
802 <arg value="shutdown"/>
803 </exec>
804 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
805 failonerror="true" os="${os.windows}">
806 <arg value="--user=root"/>
807 <arg value="shutdown"/>
808 </exec>
809 </target>
810
811 <target name="stop-mysql-use-password-linux" depends="init" if="mysql.islocal.usepassword">
812 <echo>At the password prompt, enter the mysql root password.</echo>
813 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
814 failonerror="true" os="${os.linux},{os.mac}">
815 <arg value="--user=root"/>
[10311]816 <arg value="-p"/>
[9874]817 <arg value="--socket=/tmp/mysql.sock"/>
818 <arg value="shutdown"/>
819 </exec>
[10676]820 </target>
821
822 <target name="stop-mysql-use-password-windows" depends="init" if="mysql.islocal.usepassword.windows">
823 <andcall target="get-mysql-root-password"/>
[10314]824 <!-- on windows it doesn't work unless the password is specified here -->
[9874]825 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
826 failonerror="true" os="${os.windows}">
827 <arg value="--user=root"/>
[10314]828 <arg value="-p${mysql.root.password}"/>
[9874]829 <arg value="shutdown"/>
830 </exec>
831 </target>
832
833 <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,stop-mysql,start-mysql"/>
834
835
836<!-- ======================= Axis Targets ============================ -->
837
838 <target name="prepare-axis" depends="init">
839 <mkdir dir="${basedir}/comms/soap"/>
[10127]840 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
841 dest="${basedir}/comms/soap/axis-bin-1_2_1.zip"
[9874]842 usetimestamp="true"/>
843 <delete dir="${basedir}/comms/soap/axis.bak"/>
844 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false">
845 <fileset dir="${basedir}/comms/soap/axis"/>
846 </move>
[10127]847 <unzip src="${basedir}/comms/soap/axis-bin-1_2_1.zip"
[9874]848 dest="${basedir}/comms/soap/"/>
849 <move todir="${basedir}/comms/soap/axis">
[10127]850 <fileset dir="${basedir}/comms/soap/axis-1_2_1"/>
[9874]851 </move>
[10127]852 <!-- install axis into greenstone web app -->
853 <copy todir="${web.lib}">
[10129]854 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/WEB-INF/lib">
855 <include name="*.jar"/>
856 </fileset>
[9874]857 </copy>
[10127]858 <copy todir="${web.home}">
[10129]859 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/">
860 <include name="*.jsp"/>
861 <include name="*.jws"/>
862 </fileset>
[10127]863 </copy>
864 <copy tofile="${web.home}/axis.html" file="${basedir}/comms/soap/axis/webapps/axis/index.html"/>
865 <copy todir="${web.classes}">
[10129]866 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/WEB-INF/classes">
867 <include name="*.properties"/>
868 </fileset>
[10127]869 </copy>
[9874]870 </target>
871
[10136]872 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files"
[9874]873 description="Deploy a SOAP web service for a local Greenstone site">
874 <java classname="org.apache.axis.client.AdminClient">
875 <classpath refid="compile.classpath"/>
[10127]876 <arg value="-l"/>
877 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[9874]878 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
879 </java>
880 </target>
881
882 <target name="soap-undeploy-site" depends="get-sitename"
883 description="Undeploy a SOAP web service for a local Greenstone site">
884 <java classname="org.apache.axis.client.AdminClient">
885 <classpath refid="compile.classpath"/>
[10127]886 <arg value="-l"/>
887 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[9874]888 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
889 </java>
890 </target>
891
[10136]892 <!-- this target used to deploy the localsite server for the default installation -->
[10321]893 <target name="deploy-localsite" depends="init">
[9874]894 <antcall target="start-tomcat"/>
895 <antcall target="soap-deploy-site">
896 <param name="axis.sitename" value="localsite"/>
897 <param name="axis.siteuri" value="localsite"/>
898 </antcall>
899 <antcall target="stop-tomcat"/>
900 </target>
901
902 <target name="get-sitename" unless="axis.sitename">
903 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
904 </target>
905
906 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
907 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
908 <echo>${axis.sitename}, ${axis.siteuri}</echo>
909 </target>
910 <target name="check-deployment-files" depends="get-sitename">
911 <condition property="deploy.exists">
[10136]912 <and>
913 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
914 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
915 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
916 </and>
[9874]917 </condition>
[10136]918 </target>
919
920 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
[9874]921 if="axis.sitename" unless="deploy.exists">
922 <filter token="sitename" value="${axis.sitename}"/>
923 <filter token="siteuri" value="${axis.siteuri}"/>
924 <copy file="${basedir}/resources/soap/site.wsdd.template"
925 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
926 filtering="true"/>
927 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
928 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
929 filtering="true"/>
930 <!-- create the java files and compile them -->
931 <copy file="${gsdl3.home}/SOAPServer.java.in"
932 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
933 filtering="true"/>
934 <javac srcdir="${src.home}"
935 destdir="${build.home}"
936 debug="${compile.debug}"
937 deprecation="${compile.deprecation}"
938 optimize="${compile.optimize}">
939 <classpath refid="compile.classpath"/>
940 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
941 </javac>
[10136]942 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
943 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
[9874]944 </target>
945
946
947<!-- ====================== Core targets ============================== -->
948<!-- core targets refer to the core gsdl3 java src -->
949
[10195]950 <target name="prepare-core" unless="nocvs.mode">
[9874]951 <!-- just get rid of empty directories-->
952 <cvs command="update -P"/>
953 </target>
[10069]954
[9874]955 <target name="configure-core"/>
[10116]956
[9874]957 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
958 description="Update only the Greenstone core" />
959
[10195]960 <target name="cvsupdate-core" unless="nocvs.mode">
[9874]961 <cvs command="update -l"/>
[10069]962 <cvs command="update -dP bin comms dist-resources docs lib resources src winutil"/>
[9874]963 </target>
964
965 <target name="clean-core"
966 description="Clean only the Greenstone core">
967 <delete dir="${build.home}"/>
968 </target>
969
970 <target name="compile-core"
971 description="Compile only the Greenstone core">
972 <mkdir dir="${build.home}"/>
973 <javac srcdir="${src.home}"
974 destdir="${build.home}"
975 debug="${compile.debug}"
976 deprecation="${compile.deprecation}"
977 optimize="${compile.optimize}">
978 <classpath>
979 <path refid="compile.classpath"/>
980 </classpath>
981 </javac>
982 <jar destfile="${build.home}/gsdl3.jar">
983 <fileset dir="${build.home}">
984 <include name="org/greenstone/gsdl3/**"/>
985 <exclude name="**/Test.class"/>
986 </fileset>
987 <manifest>
988 <attribute name="Built-By" value="${user.name}" />
989 </manifest>
990 </jar>
991 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
992 <jar destfile="${build.home}/phind.jar">
993 <fileset dir="${build.home}">
994 <include name="org/greenstone/applet/phind/**"/>
995 </fileset>
996 <manifest>
997 <attribute name="Built-By" value="${user.name}" />
998 </manifest>
999 </jar>
[10069]1000 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
[9874]1001 <jar destfile="${build.home}/anttasks.jar">
1002 <fileset dir="${build.home}">
1003 <include name="org/greenstone/anttasks/**"/>
1004 </fileset>
1005 <manifest>
1006 <attribute name="Built-By" value="${user.name}" />
1007 </manifest>
1008 </jar>
[10069]1009 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
[9874]1010 <jar destfile="${build.home}/gsdl3test.jar">
1011 <fileset dir="${build.home}">
1012 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1013 <include name="org/greenstone/testing/**"/>
1014 </fileset>
1015 <manifest>
1016 <attribute name="Built-By" value="${user.name}" />
1017 </manifest>
1018 </jar>
1019 </target>
1020
1021<!-- ================== Packages targets ================================ -->
1022 <!-- these targets refer to the greenstone packages - these need updating
1023 less often, so are in separate targets to the core -->
1024 <target name="prepare-packages" depends="init,prepare-mgpp,prepare-windows"/>
1025
1026 <target name="prepare-windows" depends="init" if="current.os.iswindows">
1027 <!-- need to download precompiled binaries for mg and mgpp -->
1028 </target>
[10195]1029
[10235]1030 <target name="checkout-mgpp" depends="check-cvsroot,init" unless="nocvs.mode">
[9874]1031 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
1032 </target>
[10235]1033
1034 <target name="prepare-mgpp" depends="init" unless="mgpp.present">
1035 <antcall target="checkout-mgpp"/>
1036 </target>
[9874]1037
1038 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
1039 description="Update only the packages"/>
1040
[10195]1041 <target name="cvsupdate-packages" unless="nocvs.mode">
[9874]1042 <cvs command="update -dP" dest="${packages.home}"/>
1043 </target>
1044
1045 <target name="configure-packages" description="Configure only the packages.">
1046 <echo>
1047 Configuring MG
1048 </echo>
[10147]1049 <exec executable="${mg.home}/configure" os="${os.linux},${os.mac}"
[9874]1050 dir="${mg.home}">
1051 <arg value="--prefix=${basedir}"/>
[10082]1052 <arg value="--libdir=${lib.jni}"/>
[9874]1053 </exec>
1054 <echo>
1055 Configuring MGPP
1056 </echo>
[10147]1057 <exec executable="${mgpp.home}/configure" os="${os.linux},${os.mac}"
[9874]1058 dir="${mgpp.home}">
1059 <arg value="--prefix=${basedir}"/>
[10082]1060 <arg value="--libdir=${lib.jni}"/>
[9874]1061 </exec>
1062 </target>
1063
1064 <target name="clean-packages"
1065 description="Clean only the packages">
1066 <!-- mg : just call the make target -->
[10189]1067 <exec executable="make" os="${os.linux},${os.mac}"
[9874]1068 dir="${mg.home}">
1069 <arg value="clean"/>
1070 </exec>
1071 <!-- mgpp -->
[10189]1072 <exec executable="make" os="${os.linux},${os.mac}"
[9874]1073 dir="${mg.home}">
1074 <arg value="clean"/>
1075 </exec>
1076 <!-- vishnu : just call the ant target -->
1077 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
[10075]1078 inheritall="false" target="clean">
1079 <property name="catalina.home" value="${catalina.home}"/>
1080 </ant>
[9874]1081 <!-- gsdl-as : just call the ant target-->
1082 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
[10069]1083 inheritall="false" target="clean">
1084 <property name="catalina.home" value="${catalina.home}"/>
1085 </ant>
[9874]1086 </target>
1087
1088 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
1089 description="Clean only the C/C++ packages">
1090 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1091 <arg value="clean"/>
1092 </exec>
1093 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1094 <arg value="clean"/>
1095 </exec>
1096 </target>
1097
1098 <target name="compile-packages"
1099 description="Compile only the packages">
1100 <echo>Compiling MG</echo>
[10147]1101 <exec executable="make" os="${os.linux},${os.mac}"
[9874]1102 dir="${mg.home}">
1103 </exec>
[10147]1104 <exec executable="make" os="${os.linux},${os.mac}"
[9874]1105 dir="${mg.home}">
1106 <arg value="install"/>
1107 </exec>
1108 <!-- windows: just the java stuff. -->
1109 <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
1110 dir="${mg.home}">
1111 <arg value="compile"/>
1112 <arg value="javaonly"/>
1113 </exec>
[10073]1114 <!-- install the jar file -->
[10078]1115 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
[9874]1116
1117 <!-- mgpp -->
1118 <echo>Compiling MGPP</echo>
[10147]1119 <exec executable="make" os="${os.linux},${os.mac}"
[9874]1120 dir="${mgpp.home}">
1121 </exec>
[10147]1122 <exec executable="make" os="${os.linux},${os.mac}"
[9874]1123 dir="${mgpp.home}">
1124 <arg value="install"/>
1125 </exec>
1126 <!-- windows: just the java stuff. -->
1127 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
1128 dir="${mgpp.home}">
1129 <arg value="compile"/>
1130 <arg value="javaonly"/>
1131 </exec>
[10073]1132 <!-- install the jar file -->
[10078]1133 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
[10073]1134
[9874]1135 <!-- vishnu -->
1136 <echo>Compiling Vishnu</echo>
1137 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
[10069]1138 inheritall="false" target="compile">
[10075]1139 <property name="catalina.home" value="${catalina.home}"/>
[10069]1140 </ant>
[9874]1141
1142 <!-- gsdl-as -->
1143 <echo>Compiling GSDL-AS</echo>
1144 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
[10069]1145 inheritall="false" target="compile">
1146 <property name="catalina.home" value="${catalina.home}"/>
1147 </ant>
[9874]1148 </target>
1149
1150 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
1151 description="Compile only the C/C++ packages">
1152 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"/>
1153 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1154 <arg value="install"/>
1155 <env key="GSDL3HOME" value="${basedir}"/>
1156 </exec>
1157 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"/>
1158 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1159 <arg value="install"/>
1160 <env key="GSDL3HOME" value="${basedir}"/>
1161 </exec>
1162 </target>
1163
1164 <!-- ================== gs2building targets ===============-->
1165
1166
1167 <target name="update-gs2building" if="gsdl2.islocal"
[10195]1168 depends="init,cvsupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
[9874]1169 description="Update only the Greenstone 2 building components"/>
1170
[10195]1171 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init" unless="nocvs.mode">
[9874]1172 <cvs command="update -dP" dest="${gli.home}"/>
1173 <!-- Note: can't do a -d update here cos it will get all of gsdl
1174 also, an update doesn't get new files, so we do a checkout instead. -->
1175 <cvs command="co gs2build" dest="${basedir}"/>
1176 </target>
1177
1178 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
1179 </target>
1180
[10195]1181 <target name="checkout-gs2build" depends="check-cvsroot,init" unless="nocvs.mode">
[9874]1182 <echo>checking out gs2build</echo>
1183 <cvs command="checkout -P" package="gs2build"/>
[10195]1184 </target>
[9874]1185
[10195]1186 <target name="prepare-gs2build" depends="init" if="gsdl2.islocal" unless="gs2build.present">
1187 <antcall target="checkout-gs2build"/>
[9874]1188 <!-- rename the .gs2build files -->
1189 <antcall target="rename-gs2build-files"/>
1190 <antcall target="unzip-windows-packages"/>
1191 <antcall target="get-windows-binaries"/>
1192 </target>
1193
[10195]1194 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1195 unless="nocvs.mode">
1196 <cvs command="checkout -P" package="winbin"/>
1197 </target>
1198
1199 <target name="get-windows-binaries" depends="init,checkout-winbin" if="current.os.iswindows">
1200 <copy todir="${basedir}/bin">
1201 <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/>
1202 </copy>
[9874]1203 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1204 <fileset dir="${basedir}/winbin/bin"/>
1205 </move>
1206 <delete dir="${basedir}/winbin"/>
1207 </target>
[10195]1208
[9874]1209 <target name="unzip-windows-packages" depends="init">
1210 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1211 dest="${gs2build.home}/packages/windows/gdbm"/>
1212 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1213 dest="${gs2build.home}/packages/windows/crypt"/>
1214 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1215 dest="${gs2build.home}/packages/windows/expat"/>
1216 </target>
1217
[10195]1218 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows"/>
[9874]1219
1220 <target name="rename-gs2build-files-windows" if="current.os.iswindows">
1221 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1222 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1223 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1224 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1225 <filterset>
1226 <filter token="gsdlhome" value="${gs2build.home}"/>
1227 </filterset>
1228 </copy>
1229 </target>
[10195]1230 <target name="rename-gs2build-files-unix" if="current.os.isunix">
[9874]1231 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1232 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1233 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1234 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1235 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1236 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1237 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1238 <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/>
1239 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1240
1241 </target>
[10235]1242 <target name="prepare-gli" depends="init" if="gsdl2.islocal" unless="gli.present">
1243 <antcall target="checkout-gli"/>
1244 </target>
1245
1246 <target name="checkout-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="nocvs.mode">
[9874]1247 <echo>checking out gli</echo>
1248 <cvs command="checkout -P" package="gli"/>
1249 </target>
1250
1251 <target name="configure-gs2building" depends="init" if="gsdl2.islocal"
1252 description="Configure only the Greenstone 2 building components">
[10195]1253 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.mac}"
[9874]1254 dir="${gs2build.home}">
1255 <arg value="--prefix=${gs2build.home}"/>
1256 </exec>
1257 </target>
1258
1259 <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
1260 description="Clean only the Greenstone 2 building components">
1261 <!-- gli -->
1262 <property name="gli.home" value="${basedir}/gli"/>
1263 <!-- linux -->
[10195]1264 <exec executable="clean.sh" os="${os.linux},${os.mac}" dir="${gli.home}"
[9874]1265 resolveExecutable="true"/>
1266 <!-- windows -->
1267 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1268 resolveExecutable="true"/>
1269 <!-- gs2build -->
1270 <!--linux: -->
[10195]1271 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
[9874]1272 <arg value="clean"/>
1273 </exec>
1274 <!-- windows: -->
1275 </target>
1276
1277 <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1278 description="remove all object files and executables">
1279 <!-- run the setup script -->
1280 <exec executable="${compile.windows.c++.setup}"/>
1281 <exec executable="nmake" dir="${gs2build.home}">
1282 <arg value="/f"/>
1283 <arg value="win32.mak"/>
1284 <arg value="clean"/>
1285 </exec>
1286 </target>
1287
1288 <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
1289 description="Compile only the Greenstone 2 building components">
1290 <!-- gli -->
1291 <property name="gli.home" value="${basedir}/gli"/>
1292 <!-- linux -->
[10195]1293 <exec executable="makegli.sh" os="${os.linux},${os.mac}" dir="${gli.home}"
[9874]1294 resolveExecutable="true"/>
1295 <!-- windows -->
1296 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1297 resolveExecutable="true"/>
1298 <!-- gs2build -->
1299 <!--linux: make, make install -->
[10195]1300 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
[9874]1301 </exec>
[10195]1302 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
[9874]1303 <arg value="install"/>
1304 </exec>
1305 </target>
1306 <!-- windows: -->
1307 <target name="compile-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1308 description="Use this if you want to compile the C++ code for the gs2build package">
1309 <!-- run the setup script -->
1310 <exec executable="${compile.windows.c++.setup}"/>
1311 <exec executable="nmake" dir="${gs2build.home}">
1312 <arg value="/f"/>
1313 <arg value="win32.mak"/>
1314 </exec>
1315 </target>
1316 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
1317 </target>
1318
1319 <target name="gli-local" depends="init" if="gsdl2.islocal">
[10195]1320 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.mac}" dir="${basedir}/gli" spawn="true">
[9890]1321 <env key="gsdl3path" path="${basedir}"/>
1322 <env key="gsdlpath" path="${basedir}/gs2build"/>
[9874]1323 </exec>
1324 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
[9890]1325 <env key="GSDL3PATH" path="${basedir}"/>
1326 <env key="GSDLPATH" path="${basedir}/gs2build"/>
[9874]1327 </exec>
[9890]1328 <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.
1329 </echo>
[9874]1330 </target>
1331
1332 <target name="gli-external" depends="init" unless="gsdl2.islocal">
[10195]1333 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux},${os.mac}" dir="${gsdl2.installed.path}/gli" spawn="true">
[9890]1334 <env key="gsdl3path" path="${basedir}"/>
1335 <env key="gsdlpath" path="${gsdl2.installed.path}"/>
1336 </exec>
1337 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli" spawn="true">
1338 <env key="GSDL3PATH" path="${basedir}"/>
1339 <env key="GSDLPATH" path="${gsdl2.installed.path}"/>
1340 </exec>
1341 <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:
[10195]1342 (Linux/Mac OS X / Windows)
[9890]1343in gsdl3 directory: source gs3-setup.sh / gs3-setup
1344in gsdl directory: source setup.bash / setup
1345in gli directory: gli4gs3.sh / gli4gs3
1346 </echo>
[9874]1347 </target>
1348
1349
1350<!-- ======================== TESTING Targets ========================= -->
1351
1352 <target name="test" description="Run the (incomplete) JUnit test suite "
1353 depends="init">
1354 <mkdir dir="${basedir}/test"/>
1355 <junit printsummary="withOutAndErr"
1356 errorproperty="test.failed"
1357 failureproperty="test.failed"
1358 fork="${junit.fork}">
1359 <formatter type="plain"/>
1360 <classpath>
1361 <pathelement location="${build.home}/gsdl3test.jar"/>
1362 <path refid="compile.classpath"/>
1363 </classpath>
1364 <test name="${testcase}" if="testcase"/>
1365 <batchtest todir="${basedir}/test" unless="testcase">
1366 <fileset dir="${build.home}"
1367 includes="**/*Test.class"
1368 />
1369 </batchtest>
1370 </junit>
1371 <echo>
1372 *********************************************
1373 Test output can be found in directory 'test'
1374 *********************************************
1375 </echo>
1376 </target>
1377
1378
[10676]1379<!-- ====================== DISTRIBUTION Targets ========================= -->
[9874]1380
[10676]1381 <target name="prepare-for-dist" depends="init">
1382 <cvs command="export -D '1 second ago'" package="mgpp"
1383 dest="${basedir}/packages/"
1384 cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
1385 <cvs command="export -D '1 second ago'" package="gs2build"
1386 cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
1387 <cvs command="export -D '1 second ago'" package="gli"
1388 cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
1389 <antcall target="rename-gs2build-files"/>
1390 <antcall target="unzip-windows-packages"/>
1391 <antcall target="get-windows-binaries"/>
1392 <antcall target="install-mysql"/>
1393 <antcall target="start-mysql"/>
1394 <antcall target="setup-mysql"/>
1395 <antcall target="stop-mysql-no-password"/>
1396 <antcall target="prepare-tomcat"/>
1397 <antcall target="configure-tomcat"/>
1398 <antcall target="prepare-axis"/>
1399 <!-- delete old axis dir -->
1400 <delete dir="${basedir}/comms/soap/axis"/>
1401 <antcall target="prepare-web"/>
1402 <antcall target="configure-c++"/>
1403 <antcall target="compile"/>
1404 <antcall target="deploy-localsite"/>
1405 <xslt in="build.xml" out="dist-build.xml" style="dist-resources/convert-build-xml.xsl"/>
1406 <delete dir="${basedir}/dist-resources"/>
1407 </target>
1408
1409 <target name="get-perl-for-windows" if="current.os.iswindows">
1410 <get src="http://www.greenstone.org/gs3files/perl-for-windows.zip"
1411 dest="${gs2build.home}/bin/windows/perl-for-windows.zip"
1412 usetimestamp="true"/>
1413 <unzip src="${gs2build.home}/bin/windows/perl-for-windows.zip"
1414 dest="${gs2build.home}/bin/windows"/>
1415 </target>
[9874]1416
[10676]1417 <target name="install-for-dist" depends="accept-properties,init,start-mysql,set-mysql-account-passwords,stop-mysql,configure,configure-tomcat">
1418
1419 </target>
[8418]1420</project>
1421
[9874]1422
Note: See TracBrowser for help on using the repository browser.