source: trunk/gsdl3/build.xml@ 9980

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

made a mistake in the last commit when i fixed up the tomcat compat stuff

  • Property svn:keywords set to Author Date Id Revision
File size: 48.3 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 <property name="javalib" value="${basedir}/lib/java"/>
54 <property name="web.home" value="${basedir}/web"/>
55 <property name="web.lib" value="${web.home}/lib"/>
56 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
57
58 <property name="javadocs" value="${basedir}/docs/javadoc"/>
59
60 <property name="app.name" value="gsdl3"/>
61 <property name="app.path" value="/${app.name}"/>
62 <property name="app.version" value="3.00alpha"/>
63 <property name="catalina.home" value="${basedir}/comms/jakarta/tomcat"/>
64
65 <property name="os.linux" value="Linux"/> <!-- mac??-->
66 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP, Windows NT,Windows ME"/> <!-- check this!!!-->
67
68 <condition property="current.os.islinux">
69 <os family="unix"/>
70 </condition>
71 <condition property="current.os.iswindows">
72 <os family="windows"/>
73 </condition>
74 <!-- ============= Base dirs for each package and component ============ -->
75 <property name="applet.home" value="${src.home}/org/greenstone/applet"/>
76 <property name="gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
77 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
78 <property name="gs2build.home" value="${basedir}/gs2build"/>
79 <property name="gli.home" value="${basedir}/gli"/>
80 <property name="vishnu.home" value="${packages.home}/vishnu"/>
81 <property name="mg.home" value="${packages.home}/mg"/>
82 <property name="mgpp.home" value="${packages.home}/mgpp"/>
83 <property name="mysql.home" value="${packages.home}/mysql"/>
84 <property name="gsdl-as.home" value="${packages.home}/gsdl-as"/>
85
86<!-- ==================== Compilation Control Options ==================== -->
87
88<!--
89
90 These properties control option settings on the Javac compiler when it
91 is invoked using the <javac> task.
92
93 compile.debug Should compilation include the debug option?
94
95 compile.deprecation Should compilation include the deprecation option?
96
97 compile.optimize Should compilation include the optimize option?
98
99-->
100
101 <property name="compile.debug" value="true"/>
102 <property name="compile.deprecation" value="true"/>
103 <property name="compile.optimize" value="true"/>
104
105<!--
106
107 Rather than relying on the CLASSPATH environment variable, Ant includes
108 features that makes it easy to dynamically construct the classpath you
109 need for each compilation. The example below constructs the compile
110 classpath to include the servlet.jar file, as well as the other components
111 that Tomcat makes available to web applications automatically, plus anything
112 that you explicitly added.
113
114-->
115
116 <path id="compile.classpath">
117 <!-- Include all jar files in our lib directory -->
118 <pathelement location="${javalib}"/>
119 <fileset dir="${javalib}">
120 <include name="*.jar"/>
121 </fileset>
122 <!-- Include the resources directory -->
123 <pathelement location="${basedir}/resources/java"/>
124 <pathelement location="${basedir}/resources/dtd"/>
125
126 <!-- Include the axis jar files -->
127 <fileset dir="${basedir}/comms/soap/axis/lib">
128 <include name="*.jar"/>
129 </fileset>
130
131 <!-- include the jar files from the packages -->
132 <!-- mg and mgpp get installed into lib/java but they may not be there yet -->
133 <pathelement location="${javalib}/mg.jar"/>
134 <pathelement location="${javalib}/mgpp.jar"/>
135 <pathelement location="${vishnu.home}/build/vishnu.jar"/>
136
137 <!-- Include all elements that Tomcat exposes to applications -->
138 <pathelement location="${catalina.home}/common/classes"/>
139 <fileset dir="${catalina.home}/common/endorsed">
140 <include name="*.jar"/>
141 </fileset>
142 <fileset dir="${catalina.home}/common/lib">
143 <include name="*.jar"/>
144 </fileset>
145 <pathelement location="${catalina.home}/shared/classes"/>
146 <fileset dir="${catalina.home}/shared/lib">
147 <include name="*.jar"/>
148 </fileset>
149 </path>
150
151 <path id="running.path">
152 <pathelement location="${mysql.home}/bin"/>
153 <pathelement location="${basedir}/bin/script"/>
154 <pathelement location="${basedir}/bin"/>
155 <pathelement location="${basedir}/lib"/>
156 <pathelement path="${env.PATH}"/>
157 <pathelement path="${env.Path}"/>
158 </path>
159
160 <path id="ld.library.path">
161 <pathelement path="${env.LD_LIBRARY_PATH}"/>
162 <pathelement location="${basedir}/lib"/>
163 <pathelement location="${mysql.home}/lib/mysql"/>
164 </path>
165
166<target name="test-java">
167 <echo>${ant.java.version}</echo>
168</target>
169<!-- ==================== Primary and Global Targets ============================= -->
170
171 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
172
173 <target name="install" depends="accept-properties,init,prepare,cvsupdate,configure,clean,compile,deploy-localsite"
174 description="Install Greenstone 3. Use this when you first checkout the code. Also running this target later on will reinstall Greenstone. Most things will be reset back to their defaults, except for code changes."/>
175
176 <target name="prepare" depends="init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-mysql,prepare-collections"/>
177
178 <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building"
179 description="Do a cvs update for all sources. Doesn't reompile the code."/>
180
181 <target name="configure" depends="init,configure-tomcat,configure-files,configure-packages,configure-core,configure-gs2building"
182 description="Configure the installation. Includes setting up config files and configuring the C/C++ packages. This is called from install and update. Should be re-run if you change the build.properties file."/>
183
184 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
185 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
186 <target name="clean-windows-c++" depends="init,clean-windows-c++-gs2building,clean-windows-c++-packages"
187 description="Remove C++ compiled code for Windows. Requires Microsoft Visual Studio"/>
188 <target name="compile" depends="init,compile-extra,compile-packages,compile-core,compile-gs2building"
189 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
190 <target name="compile-windows-c++" depends="init,compile-windows-c++-gs2building,compile-windows-c++-packages"
191 description="Compile the C/C++ code for Windows. Requires Microsoft Visual Studio"/>
192 <target name="update" depends="init,update-packages,update-core,update-gs2building"
193 description="Update (thru CVS) all the source (including core, packages and gs2building) and recompile. Similar to install but doesn't reinstall components such as Tomcat and axis."/>
194
195 <target name="start" depends="init,start-mysql,start-tomcat"
196 description="Startup the (local) Greenstone servers (tomcat,mysql...)" />
197
198 <target name="stop" depends="init,stop-tomcat,stop-mysql"
199 description="Shutdown the (local) Greenstone servers."/>
200
201 <target name="restart" description="Shutdown and restart the Greenstone servers" depends="init,stop,start"/>
202
203
204<!-- =========== Help targets =================================== -->
205
206 <target name="usage" description="Print a help message">
207 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
208 <echo message=" Execute 'ant -help' for Ant help."/>
209 <echo>To install Greenstone, run 'ant [options] install'.
210There 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.
211To log the output, use the '-logfile build.log' option.
212 </echo>
213 </target>
214
215 <target name="help" depends="usage" description="Print a help message"/>
216
217 <target name="debug" depends="init" description="Display all the currently used properties">
218 <echoproperties/>
219 </target>
220
221<!-- ====== initialization and setup targets ================== -->
222
223 <target name="accept-properties" unless="properties.accepted">
224 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
225tomcat.server=${tomcat.server}
226tomcat.port=${tomcat.port}
227tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
228gsdl2.installed.path=${gsdl2.installed.path} (this is the location of Greenstone 2 if you have it)
229proxy.host=${proxy.host}
230proxy.port=${proxy.port}
231mysql.installed.path=${mysql.installed.path} (this is the location of mysql if it is already installed)
232mysql.admin.user=${mysql.admin.user}
233mysql.port=${mysql.port}
234If these are not acceptable, please change them and rerun this target. Continue [y/n]?" />
235 </input>
236 <condition property="do.abort">
237 <equals arg1="n" arg2="${properties.ok}"/>
238 </condition>
239 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
240 </target>
241
242 <target name="check-cvsroot">
243 <condition property="cvsroot.notset">
244 <or>
245 <not>
246 <isset property="env.CVSROOT"/>
247 </not>
248 <equals arg1="" arg2="${env.CVSROOT}"/>
249 </or>
250 </condition>
251 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
252 </target>
253 <!-- this sets up some initial properties -->
254 <target name="init">
255
256 <condition property="java.too.old">
257 <or>
258 <equals arg1="1.1" arg2="${ant.java.version}"/>
259 <equals arg1="1.2" arg2="${ant.java.version}"/>
260 <equals arg1="1.3" arg2="${ant.java.version}"/>
261 </or>
262 </condition>
263 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
264
265 <available file="${basedir}/packages/mgpp/text" property="mgpp.present"/>
266 <available file="${basedir}/packages/mysql/bin" property="mysql.present"/>
267 <available file="${basedir}/gli" property="gli.present"/>
268 <available file="${basedir}/gs2build" property="gs2build.present"/>
269 <available file="${basedir}/comms/soap/axis" property="axis.present"/>
270 <available file="${basedir}/comms/jakarta/tomcat/webapps/axis" property="axis.installed"/>
271 <condition property="gsdl2.islocal">
272 <or>
273 <not>
274 <isset property="gsdl2.installed.path"/>
275 </not>
276 <equals arg1="" arg2="${gsdl2.installed.path}"/>
277 </or>
278 </condition>
279 <condition property="mysql.islocal">
280 <or>
281 <not>
282 <isset property="mysql.installed.path"/>
283 </not>
284 <equals arg1="" arg2="${mysql.installed.path}"/>
285 </or>
286 </condition>
287 <condition property="tomcat.islocal">
288 <or>
289 <not>
290 <isset property="tomcat.installed.path"/>
291 </not>
292 <equals arg1="" arg2="${tomcat.installed.path}"/>
293 </or>
294 </condition>
295
296 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gsdlislocal=${gsdl2.islocal} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
297 <condition property="proxy.present">
298 <and>
299 <isset property="proxy.host"/>
300 <not>
301 <equals arg1="" arg2="${proxy.host}"/>
302 </not>
303 </and>
304 </condition>
305 </target>
306
307 <target name="setup-proxy" depends="init" if="proxy.present">
308 <condition property="ask.user">
309 <or>
310 <equals arg1="" arg2="${proxy.user}"/>
311 <equals arg1="" arg2="${proxy.password}"/>
312 </or>
313 </condition>
314 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}"/>
315 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
316 </target>
317
318 <!-- ========== Miscellaneous Targets ================================ -->
319
320 <target name="prepare-collections">
321 <property name="collect.dir" value="${basedir}/web/sites/localsite/collect"/>
322 <!-- gs3mgdemo -->
323 <unzip src="${collect.dir}/gs3mgdemo/import.zip"
324 dest="${collect.dir}/gs3mgdemo"/>
325 <unzip src="${collect.dir}/gs3mgdemo/archives.zip"
326 dest="${collect.dir}/gs3mgdemo"/>
327 <unzip src="${collect.dir}/gs3mgdemo/index/index.zip"
328 dest="${collect.dir}/gs3mgdemo/index"/>
329 <!-- gs2mgdemo -->
330 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
331 dest="${collect.dir}/gs2mgdemo"/>
332 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
333 dest="${collect.dir}/gs2mgdemo"/>
334 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
335 dest="${collect.dir}/gs2mgdemo/index"/>
336 <!-- gs2mgppdemo -->
337 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
338 dest="${collect.dir}/gs2mgppdemo"/>
339 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
340 dest="${collect.dir}/gs2mgppdemo"/>
341 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
342 dest="${collect.dir}/gs2mgppdemo/index"/>
343 <!-- gberg -->
344 <unzip src="${collect.dir}/gberg/index/index.zip"
345 dest="${collect.dir}/gberg/index"/>
346 </target>
347
348 <target name="configure-files" depends="configure-files-gsdl3,configure-files-server"/>
349
350 <target name="configure-files-gsdl3" depends="init">
351 <filter token="gsdl3home" value="${basedir}"/>
352 <copy file="${basedir}/web/WEB-INF/web.xml.in" tofile="${basedir}/web/WEB-INF/web.xml" filtering="true"/>
353 <copy file="${basedir}/resources/java/SOAPServer.cfg.in" tofile="${basedir}/resources/java/SOAPServer.cfg" filtering="true"/>
354 </target>
355
356 <target name="configure-files-server" depends="init">
357 <filter token="port" value="${tomcat.port}"/>
358 <filter token="hostname" value="${tomcat.server}"/>
359 <copy file="${basedir}/web/sites/localsite/siteConfig.xml.in" tofile="${basedir}/web/sites/localsite/siteConfig.xml" filtering="true" overwrite="true"/>
360 <copy file="${basedir}/web/sites/gateway/siteConfig.xml.in" tofile="${basedir}/web/sites/gateway/siteConfig.xml" filtering="true" overwrite="true"/>
361 </target>
362
363 <target name="compile-extra" depends="init">
364 <javac srcdir="${web.home}/WEB-INF/classes"
365 destdir="${web.home}/WEB-INF/classes"
366 debug="${compile.debug}"
367 deprecation="${compile.deprecation}"
368 optimize="${compile.optimize}">
369 <classpath>
370 <path refid="compile.classpath"/>
371 </classpath>
372 </javac>
373 </target>
374
375
376
377
378<!-- ======================= Tomcat Targets ========================== -->
379
380 <!-- this target sets up tomcat for the first time, or resets it any subsequent times -->
381 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
382 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7.zip"
383 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
384 usetimestamp="true"/>
385 <delete dir="${basedir}/comms/jakarta/tomcat.bak"/>
386 <move todir="${basedir}/comms/jakarta/tomcat.bak" failonerror="false">
387 <fileset dir="${basedir}/comms/jakarta/tomcat"/>
388 </move>
389 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
390 dest="${basedir}/comms/jakarta"/>
391 <condition property="need.tomcat.compat">
392 <equals arg1="1.4" arg2="${ant.java.version}"/>
393 </condition>
394 <antcall target="prepare-tomcat-compat"/>
395 <move todir="${basedir}/comms/jakarta/tomcat">
396 <fileset dir="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7"/>
397 </move>
398 <!-- make sure we have execute permission for the .sh files -->
399 <chmod dir="${basedir}/comms/jakarta/tomcat/bin" perm="ugo+rx"
400 includes="*.sh"/>
401 <copy file="${basedir}/comms/jakarta/setclasspath.bat"
402 tofile="${basedir}/comms/jakarta/tomcat/bin/setclasspath.bat"
403 overwrite="true"/>
404 </target>
405
406
407 <target name="prepare-tomcat-compat" if="need.tomcat.compat">
408 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7-compat.zip"
409 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
410 usetimestamp="true"/>
411 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
412 dest="${basedir}/comms/jakarta"/>
413 <copy file="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7/common/endorsed/xml-apis.jar"
414 tofile="${basedir}/web/lib/xml-apis.jar"/>
415 <copy file="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7/common/endorsed/xercesImpl.jar"
416 tofile="${basedir}/web/lib/xercesImpl.jar"/>
417 </target>
418
419 <target name="configure-tomcat" depends="init" if="tomcat.islocal">
420 <!-- re-setup the server.xml file -->
421 <copy file="${basedir}/comms/jakarta/server.xml.in" tofile="${basedir}/comms/jakarta/tomcat/conf/server.xml" overwrite="true">
422 <filterset>
423 <filter token="port" value="${tomcat.port}"/>
424 <filter token="gsdl3home" value="${basedir}"/>
425 </filterset>
426 </copy>
427 </target>
428
429 <target name="reload" description="Reload web application"
430 depends="init,setup-catalina-ant-tasks">
431 <reload url="http://kanuka:7070/manager" username="admin" password="admin"
432 path="/gsdl3"/>
433 </target>
434
435 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
436 <property name="tomcat.classpath" refid="compile.classpath"/>
437 <property name="tomcat.path" refid="running.path"/>
438 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
439 <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false">
440 <env key="GSDLOS" value="linux"/>
441 <env key="GSDL3HOME" value="${basedir}"/>
442 <env key="PATH" path="${tomcat.path}"/>
443 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
444 <env key="CATALINA_HOME" value="${catalina.home}"/>
445 <env key="CLASSPATH" path="${tomcat.classpath}"/>
446 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${basedir}/lib:${mysql.home}/lib/mysql"/>
447 </exec>
448 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
449 <env key="GSDLOS" value="windows"/>
450 <env key="GSDL3HOME" value="${basedir}"/>
451 <env key="Path" path="${tomcat.path}"/>
452 <env key="PATH" path="${tomcat.path}"/>
453 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
454 <env key="CLASSPATH" path="${tomcat.classpath}"/>
455 </exec>
456 <!-- wait for the server to startup in case other targets need it running -->
457 <waitfor maxwait="5" maxwaitunit="second">
458 <and>
459 <socket server="${tomcat.server}" port="${tomcat.port}"/>
460 <http url="http://${tomcat.server}:${tomcat.port}/gsdl3/index.html"/>
461 </and>
462 </waitfor>
463 </target>
464 <!-- windows: do we want to launch a webrowser?? -->
465 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
466 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false">
467 <env key="CATALINA_HOME" value="${catalina.home}"/>
468 </exec>
469 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
470 </target>
471
472 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
473
474 <target name="setup-catalina-ant-tasks">
475 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
476 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
477 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
478 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
479 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
480 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
481 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
482 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
483 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
484 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
485 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
486 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
487 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
488 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
489 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
490 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
491 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
492 </target>
493
494
495<!-- ======================= Mysql Targets =========================== -->
496
497 <!-- this is one target that we only want to run once. -->
498 <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql,setup-mysql,stop-mysql"/>
499
500 <target name="init-mysql-vars">
501 <condition property="mysql.islocal.linux">
502 <and>
503 <isset property="mysql.islocal"/>
504 <isset property="current.os.islinux"/>
505 </and>
506 </condition>
507
508 <condition property="mysql.islocal.windows">
509 <and>
510 <isset property="mysql.islocal"/>
511 <isset property="current.os.iswindows"/>
512 </and>
513 </condition>
514 </target>
515
516 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows"/>
517
518 <!-- install and set up the database -->
519 <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present">
520 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
521 dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
522 usetimestamp="true"/>
523 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
524 dest="${packages.home}"
525 compression="gzip"/>
526 <move todir="${packages.home}/mysql">
527 <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/>
528 </move>
529 <!-- file permissions are screwed up, so make executables executable -->
530 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
531 <chmod perm="a+x">
532 <fileset dir="${mysql.home}/bin" />
533 </chmod>
534 <mkdir dir="${mysql.home}/var/"/>
535 <mkdir dir="${mysql.home}/var/log/"/>
536 <chmod file="${mysql.home}/var/" perm="777"/>
537 <chmod file="${mysql.home}/var/log/" perm="777"/>
538
539 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
540 <arg value="--datadir=./data"/>
541 <arg value="--basedir=."/>
542 <arg value="--user=root"/>
543 <arg value="--force"/>
544 </exec>
545 </target>
546
547 <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present">
548 <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip"
549 dest="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
550 usetimestamp="true"/>
551 <!-- can we run the installer?? -->
552 <unzip src="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
553 dest="${packages.home}"/>
554 <move todir="${packages.home}/mysql">
555 <fileset dir="${packages.home}/mysql-4.1.11-win32"/>
556 </move>
557 </target>
558
559 <!-- is this just linux or both??. also we probably need to do this for external mysql -->
560 <!-- had unless mysql.present -->
561 <target name="setup-mysql" depends="init,init-mysql-vars" if="mysql.islocal">
562 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
563 <arg value="--user=root"/>
564 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"/>
565 </exec>
566 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
567 <arg value="--user=root"/>
568 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%'"/>
569 </exec>
570 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
571 <arg value="--user=root"/>
572 <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost;"/>
573 </exec>
574 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
575 <arg value="--user=root"/>
576 <arg value="--execute=create database localsite_gs3mgdemo;"/>
577 </exec>
578 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
579 input="${basedir}/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql">
580 <arg value="--user=root"/>
581 <arg value="localsite_gs3mgdemo"/>
582 </exec>
583 </target>
584
585 <target name="start-mysql" depends="init,init-mysql-vars" if="mysql.islocal"
586 description="Startup only mysql">
587 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
588 spawn="true" os="${os.linux}">
589 <arg value="--user=root"/>
590 <arg value="--datadir=./data"/>
591 <arg value="--basedir=."/>
592 <arg value="--pid_file=gsdl3.pid"/>
593 <arg value="--socket=/tmp/mysql.sock"/>
594 <arg value="--err-log=./var/log/mysql.log"/>
595 </exec>
596 <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
597 </exec>
598 <sleep seconds="2"/>
599 <!-- need to test that the server has started up -->
600 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
601 failonerror="true" outputproperty="throw.away">
602 <arg value="--user=root"/>
603 <arg value="--execute=show databases;"/>
604 </exec>
605 <echo>MYSQL database server started successfully</echo>
606 </target>
607
608 <target name="stop-mysql" depends="init" if="mysql.islocal"
609 description="Shutdown only mysql">
610 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
611 failonerror="true" os="${os.linux}">
612 <arg value="--user=root"/>
613 <arg value="--socket=/tmp/mysql.sock"/>
614 <arg value="shutdown"/>
615 </exec>
616 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
617 failonerror="true" os="${os.windows}">
618 <arg value="--user=root"/>
619 <arg value="shutdown"/>
620 </exec>
621 <echo>MYSQL database server shutdown successfully</echo>
622 </target>
623
624 <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,stop-mysql,start-mysql"/>
625
626
627<!-- ======================= Axis Targets ============================ -->
628
629 <target name="prepare-axis" depends="init">
630 <mkdir dir="${basedir}/comms/soap"/>
631 <get src="http://www.greenstone.org/gs3files/axis-1_1.zip"
632 dest="${basedir}/comms/soap/axis-1_1.zip"
633 usetimestamp="true"/>
634 <delete dir="${basedir}/comms/soap/axis.bak"/>
635 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false">
636 <fileset dir="${basedir}/comms/soap/axis"/>
637 </move>
638 <unzip src="${basedir}/comms/soap/axis-1_1.zip"
639 dest="${basedir}/comms/soap/"/>
640 <move todir="${basedir}/comms/soap/axis">
641 <fileset dir="${basedir}/comms/soap/axis-1_1"/>
642 </move>
643 <!-- install the webapp into tomcat -->
644 <copy todir="${basedir}/comms/jakarta/tomcat/webapps/axis">
645 <fileset dir="${basedir}/comms/soap/axis/webapps/axis"/>
646 </copy>
647 </target>
648
649 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files,restart-tomcat"
650 description="Deploy a SOAP web service for a local Greenstone site">
651 <java classname="org.apache.axis.client.AdminClient">
652 <classpath refid="compile.classpath"/>
653 <arg value="-p"/>
654 <arg value="${tomcat.port}"/>
655 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
656 </java>
657 </target>
658
659 <target name="soap-undeploy-site" depends="get-sitename"
660 description="Undeploy a SOAP web service for a local Greenstone site">
661 <java classname="org.apache.axis.client.AdminClient">
662 <classpath refid="compile.classpath"/>
663 <arg value="-p"/>
664 <arg value="${tomcat.port}"/>
665 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
666 </java>
667 </target>
668
669 <target name="deploy-localsite" depends="init">
670 <antcall target="start-tomcat"/>
671 <antcall target="soap-deploy-site">
672 <param name="axis.sitename" value="localsite"/>
673 <param name="axis.siteuri" value="localsite"/>
674 </antcall>
675 <antcall target="stop-tomcat"/>
676 </target>
677
678 <target name="get-sitename" unless="axis.sitename">
679 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
680 </target>
681
682 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
683 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
684 <echo>${axis.sitename}, ${axis.siteuri}</echo>
685 </target>
686 <target name="check-deployment-files" depends="get-sitename">
687 <condition property="deploy.exists">
688 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
689 </condition>
690 <condition property="undeploy.exists">
691 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
692 </condition>
693 <echo>${axis.sitename}, ${deploy.exists}, ${undeploy.exists}</echo>
694 </target>
695 <target name="create-deployment-files" depends="get-sitename,check-deployment-files"
696 if="axis.sitename" unless="deploy.exists">
697 <filter token="sitename" value="${axis.sitename}"/>
698 <filter token="siteuri" value="${axis.siteuri}"/>
699 <copy file="${basedir}/resources/soap/site.wsdd.template"
700 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
701 filtering="true"/>
702 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
703 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
704 filtering="true"/>
705 <!-- create the java files and compile them -->
706 <copy file="${gsdl3.home}/SOAPServer.java.in"
707 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
708 filtering="true"/>
709 <javac srcdir="${src.home}"
710 destdir="${build.home}"
711 debug="${compile.debug}"
712 deprecation="${compile.deprecation}"
713 optimize="${compile.optimize}">
714 <classpath refid="compile.classpath"/>
715 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
716 </javac>
717 <jar destfile="${build.home}/gsdl3.jar">
718 <fileset dir="${build.home}">
719 <include name="org/greenstone/gsdl3/**"/>
720 <exclude name="**/Test.class"/>
721 </fileset>
722 <manifest>
723 <attribute name="Built-By" value="${user.name}" />
724 </manifest>
725 </jar>
726 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
727 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
728 </target>
729
730
731<!-- ====================== Core targets ============================== -->
732<!-- core targets refer to the core gsdl3 java src -->
733
734 <target name="prepare-core">
735 <!-- just get rid of empty directories-->
736 <cvs command="update -P"/>
737 </target>
738 <target name="configure-core"/>
739 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
740 description="Update only the Greenstone core" />
741
742 <target name="cvsupdate-core">
743 <cvs command="update -l"/>
744 <cvs command="update -dP bin comms dist-resources docs interfaces lib resources src web winutil"/>
745 </target>
746
747 <target name="clean-core"
748 description="Clean only the Greenstone core">
749 <delete dir="${build.home}"/>
750 </target>
751
752 <target name="compile-core"
753 description="Compile only the Greenstone core">
754 <mkdir dir="${build.home}"/>
755 <javac srcdir="${src.home}"
756 destdir="${build.home}"
757 debug="${compile.debug}"
758 deprecation="${compile.deprecation}"
759 optimize="${compile.optimize}">
760 <classpath>
761 <path refid="compile.classpath"/>
762 </classpath>
763 </javac>
764 <jar destfile="${build.home}/gsdl3.jar">
765 <fileset dir="${build.home}">
766 <include name="org/greenstone/gsdl3/**"/>
767 <exclude name="**/Test.class"/>
768 </fileset>
769 <manifest>
770 <attribute name="Built-By" value="${user.name}" />
771 </manifest>
772 </jar>
773 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
774 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
775 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
776 <copy file="${build.home}/org/greenstone/gsdl3/LibraryServlet.class"
777 todir="${web.classes}/org/greenstone/gsdl3"/>
778 <jar destfile="${build.home}/phind.jar">
779 <fileset dir="${build.home}">
780 <include name="org/greenstone/applet/phind/**"/>
781 </fileset>
782 <manifest>
783 <attribute name="Built-By" value="${user.name}" />
784 </manifest>
785 </jar>
786 <copy file="${build.home}/phind.jar" todir="${javalib}"/>
787 <copy file="${build.home}/phind.jar" todir="${web.lib}"/>
788 <jar destfile="${build.home}/anttasks.jar">
789 <fileset dir="${build.home}">
790 <include name="org/greenstone/anttasks/**"/>
791 </fileset>
792 <manifest>
793 <attribute name="Built-By" value="${user.name}" />
794 </manifest>
795 </jar>
796 <copy file="${build.home}/anttasks.jar" todir="${javalib}"/>
797 <jar destfile="${build.home}/gsdl3test.jar">
798 <fileset dir="${build.home}">
799 <include name="org/greenstone/gsdl3/**/*Test.class"/>
800 <include name="org/greenstone/testing/**"/>
801 </fileset>
802 <manifest>
803 <attribute name="Built-By" value="${user.name}" />
804 </manifest>
805 </jar>
806 </target>
807
808<!-- ================== Packages targets ================================ -->
809 <!-- these targets refer to the greenstone packages - these need updating
810 less often, so are in separate targets to the core -->
811 <target name="prepare-packages" depends="init,prepare-mgpp,prepare-windows"/>
812
813 <target name="prepare-windows" depends="init" if="current.os.iswindows">
814 <!-- need to download precompiled binaries for mg and mgpp -->
815 </target>
816 <target name="prepare-mgpp" depends="check-cvsroot,init" unless="mgpp.present">
817 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
818 </target>
819
820 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
821 description="Update only the packages"/>
822
823 <target name="cvsupdate-packages">
824 <cvs command="update -dP" dest="${packages.home}"/>
825 </target>
826
827 <target name="configure-packages" description="Configure only the packages.">
828 <echo>
829 Configuring MG
830 </echo>
831 <exec executable="${mg.home}/configure" os="${os.linux}"
832 dir="${mg.home}">
833 <arg value="--prefix=${basedir}"/>
834 </exec>
835 <echo>
836 Configuring MGPP
837 </echo>
838 <exec executable="${mgpp.home}/configure" os="${os.linux}"
839 dir="${mgpp.home}">
840 <arg value="--prefix=${basedir}"/>
841 </exec>
842 </target>
843
844 <target name="clean-packages"
845 description="Clean only the packages">
846 <!-- mg : just call the make target -->
847 <exec executable="make" os="${os.linux}"
848 dir="${mg.home}">
849 <arg value="clean"/>
850 </exec>
851 <!-- mgpp -->
852 <exec executable="make" os="${os.linux}"
853 dir="${mg.home}">
854 <arg value="clean"/>
855 </exec>
856 <!-- vishnu : just call the ant target -->
857 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
858 inheritall="false" target="clean"/>
859
860 <!-- gsdl-as : just call the ant target-->
861 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
862 inheritall="false" target="clean"/>
863 </target>
864
865 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
866 description="Clean only the C/C++ packages">
867 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
868 <arg value="clean"/>
869 </exec>
870 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
871 <arg value="clean"/>
872 </exec>
873 </target>
874
875 <target name="compile-packages"
876 description="Compile only the packages">
877 <echo>Compiling MG</echo>
878 <exec executable="make" os="${os.linux}"
879 dir="${mg.home}">
880 </exec>
881 <exec executable="make" os="${os.linux}"
882 dir="${mg.home}">
883 <arg value="install"/>
884 </exec>
885 <!-- windows: just the java stuff. -->
886 <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
887 dir="${mg.home}">
888 <arg value="compile"/>
889 <arg value="javaonly"/>
890 </exec>
891 <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
892 dir="${mg.home}">
893 <arg value="install"/>
894 <arg value="javaonly"/>
895 <env key="GSDL3HOME" value="${basedir}"/>
896 </exec>
897
898 <!-- mgpp -->
899 <echo>Compiling MGPP</echo>
900 <exec executable="make" os="${os.linux}"
901 dir="${mgpp.home}">
902 </exec>
903 <exec executable="make" os="${os.linux}"
904 dir="${mgpp.home}">
905 <arg value="install"/>
906 </exec>
907 <!-- windows: just the java stuff. -->
908 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
909 dir="${mgpp.home}">
910 <arg value="compile"/>
911 <arg value="javaonly"/>
912 </exec>
913 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
914 dir="${mgpp.home}">
915 <arg value="install"/>
916 <arg value="javaonly"/>
917 <env key="GSDL3HOME" value="${basedir}"/>
918 </exec>
919
920 <!-- vishnu -->
921 <echo>Compiling Vishnu</echo>
922 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
923 inheritall="false" target="compile"/>
924
925 <!-- gsdl-as -->
926 <echo>Compiling GSDL-AS</echo>
927 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
928 inheritall="false" target="compile"/>
929 </target>
930
931 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
932 description="Compile only the C/C++ packages">
933 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"/>
934 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
935 <arg value="install"/>
936 <env key="GSDL3HOME" value="${basedir}"/>
937 </exec>
938 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"/>
939 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
940 <arg value="install"/>
941 <env key="GSDL3HOME" value="${basedir}"/>
942 </exec>
943 </target>
944
945 <!-- ================== gs2building targets ===============-->
946
947
948 <target name="update-gs2building" if="gsdl2.islocal"
949 depends="init,cvsupdate-gs2building,configure-gs2building,clean-gs2building,compile-gs2building"
950 description="Update only the Greenstone 2 building components"/>
951
952 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init">
953 <cvs command="update -dP" dest="${gli.home}"/>
954 <!-- Note: can't do a -d update here cos it will get all of gsdl
955 also, an update doesn't get new files, so we do a checkout instead. -->
956 <cvs command="co gs2build" dest="${basedir}"/>
957 <!-- rename the .gs2build files - we may have gotten changes to the main
958 gsdl versions - make sure they are set back to the gs2build versions -->
959 <antcall target="rename-gs2build-files"/>
960 </target>
961
962 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
963 <echo>checking out gs2 building stuff</echo>
964 </target>
965
966 <target name="prepare-gs2build" depends="check-cvsroot,init" if="gsdl2.islocal" unless="gs2build.present">
967 <echo>checking out gs2build</echo>
968 <cvs command="checkout -P" package="gs2build"/>
969
970 <!-- rename the .gs2build files -->
971 <antcall target="rename-gs2build-files"/>
972 <antcall target="unzip-windows-packages"/>
973 <antcall target="get-windows-binaries"/>
974 </target>
975
976 <target name="get-windows-binaries" depends="init" if="current.os.iswindows">
977 <cvs command="checkout -P" package="winbin"/>
978 <copy todir="${basedir}/bin">
979 <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/>
980 </copy>
981 <move todir="${gs2build.home}/bin/windows" failonerror="false">
982 <fileset dir="${basedir}/winbin/bin"/>
983 </move>
984 <delete dir="${basedir}/winbin"/>
985 </target>
986 <target name="unzip-windows-packages" depends="init">
987 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
988 dest="${gs2build.home}/packages/windows/gdbm"/>
989 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
990 dest="${gs2build.home}/packages/windows/crypt"/>
991 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
992 dest="${gs2build.home}/packages/windows/expat"/>
993 </target>
994
995 <target name="rename-gs2build-files" depends="rename-gs2build-files-linux,rename-gs2build-files-windows"/>
996
997 <target name="rename-gs2build-files-windows" if="current.os.iswindows">
998 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
999 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1000 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1001 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1002 <filterset>
1003 <filter token="gsdlhome" value="${gs2build.home}"/>
1004 </filterset>
1005 </copy>
1006 </target>
1007 <target name="rename-gs2build-files-linux" if="current.os.islinux">
1008 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1009 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1010 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1011 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1012 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1013 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1014 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1015 <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/>
1016 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1017
1018 </target>
1019 <target name="prepare-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="gli.present">
1020 <echo>checking out gli</echo>
1021 <cvs command="checkout -P" package="gli"/>
1022 </target>
1023
1024 <target name="configure-gs2building" depends="init" if="gsdl2.islocal"
1025 description="Configure only the Greenstone 2 building components">
1026 <exec executable="${gs2build.home}/configure" os="${os.linux}"
1027 dir="${gs2build.home}">
1028 <arg value="--prefix=${gs2build.home}"/>
1029 </exec>
1030 </target>
1031
1032 <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
1033 description="Clean only the Greenstone 2 building components">
1034 <!-- gli -->
1035 <property name="gli.home" value="${basedir}/gli"/>
1036 <!-- linux -->
1037 <exec executable="clean.sh" os="${os.linux}" dir="${gli.home}"
1038 resolveExecutable="true"/>
1039 <!-- windows -->
1040 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1041 resolveExecutable="true"/>
1042 <!-- gs2build -->
1043 <!--linux: -->
1044 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
1045 <arg value="clean"/>
1046 </exec>
1047 <!-- windows: -->
1048 </target>
1049
1050 <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1051 description="remove all object files and executables">
1052 <!-- run the setup script -->
1053 <exec executable="${compile.windows.c++.setup}"/>
1054 <exec executable="nmake" dir="${gs2build.home}">
1055 <arg value="/f"/>
1056 <arg value="win32.mak"/>
1057 <arg value="clean"/>
1058 </exec>
1059 </target>
1060
1061 <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
1062 description="Compile only the Greenstone 2 building components">
1063 <!-- gli -->
1064 <property name="gli.home" value="${basedir}/gli"/>
1065 <!-- linux -->
1066 <exec executable="makegli.sh" os="${os.linux}" dir="${gli.home}"
1067 resolveExecutable="true"/>
1068 <!-- windows -->
1069 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1070 resolveExecutable="true"/>
1071 <!-- gs2build -->
1072 <!--linux: make, make install -->
1073 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
1074 </exec>
1075 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
1076 <arg value="install"/>
1077 </exec>
1078 </target>
1079 <!-- windows: -->
1080 <target name="compile-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1081 description="Use this if you want to compile the C++ code for the gs2build package">
1082 <!-- run the setup script -->
1083 <exec executable="${compile.windows.c++.setup}"/>
1084 <exec executable="nmake" dir="${gs2build.home}">
1085 <arg value="/f"/>
1086 <arg value="win32.mak"/>
1087 </exec>
1088 </target>
1089 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
1090 </target>
1091
1092 <target name="gli-local" depends="init" if="gsdl2.islocal">
1093 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux}" dir="${basedir}/gli" spawn="true">
1094 <env key="gsdl3path" path="${basedir}"/>
1095 <env key="gsdlpath" path="${basedir}/gs2build"/>
1096 </exec>
1097 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1098 <env key="GSDL3PATH" path="${basedir}"/>
1099 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1100 </exec>
1101 <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.
1102 </echo>
1103 </target>
1104
1105 <target name="gli-external" depends="init" unless="gsdl2.islocal">
1106 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux}" dir="${gsdl2.installed.path}/gli" spawn="true">
1107 <env key="gsdl3path" path="${basedir}"/>
1108 <env key="gsdlpath" path="${gsdl2.installed.path}"/>
1109 </exec>
1110 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli" spawn="true">
1111 <env key="GSDL3PATH" path="${basedir}"/>
1112 <env key="GSDLPATH" path="${gsdl2.installed.path}"/>
1113 </exec>
1114 <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:
1115 (Linux / Windows)
1116in gsdl3 directory: source gs3-setup.sh / gs3-setup
1117in gsdl directory: source setup.bash / setup
1118in gli directory: gli4gs3.sh / gli4gs3
1119 </echo>
1120 </target>
1121
1122
1123<!-- ======================== TESTING Targets ========================= -->
1124
1125 <target name="test" description="Run the (incomplete) JUnit test suite "
1126 depends="init">
1127 <mkdir dir="${basedir}/test"/>
1128 <junit printsummary="withOutAndErr"
1129 errorproperty="test.failed"
1130 failureproperty="test.failed"
1131 fork="${junit.fork}">
1132 <formatter type="plain"/>
1133 <classpath>
1134 <pathelement location="${build.home}/gsdl3test.jar"/>
1135 <path refid="compile.classpath"/>
1136 </classpath>
1137 <test name="${testcase}" if="testcase"/>
1138 <batchtest todir="${basedir}/test" unless="testcase">
1139 <fileset dir="${build.home}"
1140 includes="**/*Test.class"
1141 />
1142 </batchtest>
1143 </junit>
1144 <echo>
1145 *********************************************
1146 Test output can be found in directory 'test'
1147 *********************************************
1148 </echo>
1149 </target>
1150
1151
1152 <target name="reconfigure-server-settings" depends="init,configure-tomcat,configure-files-server"
1153 description="If you have changed any of the Tomcat properties in the build.properties file, run this target to update the Tomcat configuration, and any Greenstone configuration files that specify the server address">
1154 </target>
1155
1156
1157</project>
1158
1159
Note: See TracBrowser for help on using the repository browser.