source: branches/ant-install-branch/gsdl3/build.xml@ 9779

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

more windows changes

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