source: greenstone3/trunk/build.xml@ 20235

Last change on this file since 20235 was 20235, checked in by oranfry, 15 years ago

moved tomcat/java check to init and fixed it up a little

File size: 75.9 KB
Line 
1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
10
11 <!-- ============ classpath =================== -->
12 <path id="project.classpath">
13 <fileset dir="lib/java">
14 <include name="**/*.jar"/>
15 </fileset>
16 </path>
17
18 <!-- ============ self defined tasks =================== -->
19 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
20 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
21 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
22 <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
23 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
24 <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
25
26 <!-- ===================== Property Definitions =========================== -->
27
28 <!--
29
30 Each of the following properties are used in the build script.
31 Values for these properties are set by the first place they are
32 defined, from the following list:
33
34 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
35
36 * Definitions from a "build.properties" file in the top level
37 source directory of this application.
38
39 * Definitions from a "build.properties" file in the user's
40 home directory.
41
42 * Default definitions in this build.xml file.
43
44 You will note below that property values can be composed based on the
45 contents of previously defined properties. This is a powerful technique
46 that helps you minimize the number of changes required when your development
47 environment is modified. Note that property composition is allowed within
48 "build.properties" files as well as in the "build.xml" script.
49
50 -->
51
52 <!-- create build.properties if it has not been created yet -->
53 <if>
54 <bool><not><available file="build.properties"/></not></bool>
55 <copy file="build.properties.in" tofile="build.properties"/>
56 </if>
57
58 <!-- create the packages dir if it has not been created yet -->
59 <mkdir dir="packages"/>
60
61 <!--the first three properties have to be put on the top to be used by build.properties-->
62 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
63 <property name="src.packages.home" value="${basedir}/src/packages"/>
64 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
65
66 <property file="build.properties"/>
67 <if><bool><available file="${user.home}/build.properties"/></bool>
68 <property file="${user.home}/build.properties"/>
69 </if>
70
71 <!-- get properties from the environment -->
72 <property environment="env"/>
73
74 <!-- get the filesets defining components and executables -->
75 <import file="resources/xml/components.xml"/>
76 <import file="resources/xml/executables.xml"/>
77
78 <!-- version properties for external packages -->
79 <!-- for Java versions < 1.4, we print out the message that Java is too old.
80 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 6.0-->
81 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-6.0.20">
82 <equals arg1="1.4" arg2="${ant.java.version}"/>
83 </condition>
84 <condition property="tomcat.version.major" value="5" else="6">
85 <equals arg1="1.4" arg2="${ant.java.version}"/>
86 </condition>
87
88
89
90 <property name="axis.zip.version" value="axis-bin-1_2_1.zip"/>
91 <property name="axis.dir.version" value="axis-1_2_1"/>
92 <property name="sqlite.targz.version" value="sqlite-amalgamation-3.5.9.tar.gz"/>
93
94 <property name="build.home" value="${basedir}/build"/>
95 <property name="src.home" value="${basedir}/src/java"/>
96 <property name="packages.home" value="${basedir}/packages"/>
97 <!-- this may be set in build.properties, eg if you move the web dir to
98 tomcats webapps directory -->
99 <property name="web.home" value="${basedir}/web"/>
100 <!-- jar files needed by applets go here -->
101 <property name="web.applet" value="${web.home}/applet"/>
102
103 <!-- jar files needed by the servlet (and extra ones) go here -->
104 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
105 <!-- other files needed by the servlet go here -->
106 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
107 <!--- flax: the WordNet home -->
108 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
109
110 <!-- jni libraries and java wrappers go here -->
111 <property name="lib.jni" value="${basedir}/lib/jni"/>
112
113 <!-- other jar files needed for installation (but not runtime) go here -->
114 <property name="lib.java" value="${basedir}/lib/java"/>
115
116 <property name="javadocs" value="${basedir}/docs/javadoc"/>
117
118 <property name="app.name" value="greenstone3"/>
119 <property name="app.path" value="/${app.name}"/>
120
121 <property name="admin.dir" value="${basedir}/admin"/>
122
123 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
124 <property name="app.version" value="trunk"/>
125 <property name="branch.path" value="trunk"/>
126 <property name="branch.revision" value="HEAD"/>
127
128 <!--constants -->
129 <property name="svn.root" value="http://svn.greenstone.org"/>
130
131 <!-- catalina home is set to tomcat basedir if already installed, otherwise
132 use greenstone's tomcat -->
133 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
134 <and>
135 <isset property="tomcat.installed.path"/>
136 <not>
137 <equals arg1="" arg2="${tomcat.installed.path}"/>
138 </not>
139 </and>
140 </condition>
141
142 <property name="os.linux" value="Linux"/>
143 <property name="os.mac" value="Mac OS X"/>
144 <property name="os.solaris" value="SunOS"/>
145 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
146 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista"/> <!-- check this!!!-->
147
148 <!-- this is true for linux and macs -->
149 <condition property="current.os.isunix">
150 <os family="unix"/>
151 </condition>
152
153 <condition property="current.os.isunixnotmac">
154 <and>
155 <os family="unix"/>
156 <not>
157 <os family="mac"/>
158 </not>
159 </and>
160 </condition>
161
162 <condition property="current.os.ismac">
163 <os family="mac"/>
164 </condition>
165
166 <condition property="current.os.iswindows">
167 <os family="windows"/>
168 </condition>
169
170 <!-- is there a better way to do this?? what about solaris?? -->
171 <condition property="os.bin.dir" value="windows">
172 <os family="windows"/>
173 </condition>
174 <condition property="os.bin.dir" value="darwin">
175 <os family="mac"/>
176 </condition>
177 <condition property="os.bin.dir" value="linux">
178 <and>
179 <os family="unix"/>
180 <not>
181 <os family="mac"/>
182 </not>
183 </and>
184 </condition>
185
186
187 <condition property="collection.building.disabled">
188 <isset property="disable.collection.building"/>
189 </condition>
190
191 <condition property="collection.building.enabled">
192 <not>
193 <isset property="disable.collection.building"/>
194 </not>
195 </condition>
196
197 <condition property="collection.building.enabled.windows">
198 <and>
199 <isset property="collection.building.enabled"/>
200 <isset property="current.os.iswindows"/>
201 </and>
202 </condition>
203
204 <condition property="collection.building.enabled.unix">
205 <and>
206 <isset property="collection.building.enabled"/>
207 <isset property="current.os.isunix"/>
208 </and>
209 </condition>
210
211 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
212 <isset property="compile.static"/>
213 </condition>
214
215 <!-- where is search4j tool -->
216 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
217 <isset property="current.os.iswindows"/>
218 </condition>
219
220
221 <!-- ============= Base dirs for each package and component ============ -->
222 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
223 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
224 <property name="gli.home" value="${basedir}/gli"/>
225 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
226
227 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}/common-src">
228 <isset property="disable.collection.building"/>
229 </condition>
230
231 <property name="build.src.home" value="${gs2build.home}/build-src"/>
232 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
233 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
234 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
235 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
236
237 <!-- ==================== Compilation Control Options ==================== -->
238
239 <!--
240
241 These properties control option settings on the Javac compiler when it
242 is invoked using the <javac> task.
243
244 compile.debug Should compilation include the debug option?
245
246 compile.deprecation Should compilation include the deprecation option?
247
248 compile.optimize Should compilation include the optimize option?
249
250 -->
251
252 <property name="compile.debug" value="true"/>
253 <property name="compile.deprecation" value="true"/>
254 <property name="compile.optimize" value="true"/>
255
256 <!--
257
258 Rather than relying on the CLASSPATH environment variable, Ant includes
259 features that makes it easy to dynamically construct the classpath you
260 need for each compilation. The example below constructs the compile
261 classpath to include the servlet.jar file, as well as the other components
262 that Tomcat makes available to web applications automatically, plus anything
263 that you explicitly added.
264
265 -->
266
267 <!-- All elements that Tomcat 5 exposes to applications -->
268 <path id="tomcat5">
269 <pathelement location="${catalina.home}/common/classes"/>
270 <fileset dir="${catalina.home}/common/endorsed">
271 <include name="*.jar"/>
272 </fileset>
273 <fileset dir="${catalina.home}/common/lib">
274 <include name="*.jar"/>
275 </fileset>
276 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
277 <pathelement location="${catalina.home}/shared/classes"/>
278 <fileset dir="${catalina.home}/shared/lib">
279 <include name="*.jar"/>
280 </fileset>
281 </path>
282
283 <!-- All elements that Tomcat 6 exposes to applications -->
284 <path id="tomcat6">
285 <fileset dir="${catalina.home}/lib">
286 <include name="*.jar"/>
287 </fileset>
288 </path>
289
290 <path id="compile.classpath">
291 <!-- Include all jar files and libraries in our jni lib directory -->
292 <pathelement location="${lib.jni}"/>
293 <fileset dir="${lib.jni}">
294 <include name="*.jar"/>
295 </fileset>
296 <!-- Include all jar files in our web lib directory -->
297 <pathelement location="${web.lib}"/>
298 <fileset dir="${web.lib}">
299 <include name="*.jar"/>
300 </fileset>
301
302 <pathelement location="${lib.java}"/>
303 <fileset dir="${lib.java}">
304 <include name="*.jar"/>
305 </fileset>
306
307 <!-- include the jar files from the source packages -->
308 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
309 so we add them in by name -->
310 <pathelement location="${lib.jni}/mg.jar"/>
311 <pathelement location="${lib.jni}/mgpp.jar"/>
312
313 <!-- Include all elements that Tomcat exposes to applications -->
314 <path refid="tomcat${tomcat.version.major}"/>
315
316 </path>
317
318 <path id="local.tomcat.classpath">
319 <!-- explicitly include the jni java wrappers in the classpath -->
320 <pathelement location="${lib.jni}"/>
321 <fileset dir="${lib.jni}">
322 <include name="*.jar"/>
323 </fileset>
324 </path>
325
326 <path id="local.tomcat.path">
327 <pathelement location="${basedir}/bin/script"/>
328 <pathelement location="${basedir}/bin"/>
329 <pathelement location="${lib.jni}"/>
330 <pathelement path="${env.PATH}"/>
331 <pathelement path="${env.Path}"/>
332 <pathelement path="${wn.home}/bin"/>
333 </path>
334
335 <target name="test-setup">
336 <echo>ant java version=${ant.java.version}</echo>
337 <echo>is unix : ${current.os.isunix}</echo>
338 <echo>is mac : ${current.os.ismac}</echo>
339 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
340 <echo>is windows : ${current.os.iswindows}</echo>
341 <echo>os.unix: ${os.unix}</echo>
342 </target>
343
344 <!-- ==================== Primary and Global Targets ============================= -->
345
346 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
347 description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
348
349 <!-- make sure .sh files are executable -->
350 <chmod dir="${basedir}" perm="ugo+rx"
351 includes="*.sh"/>
352 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
353 includes="*.sh,*.pl"/>
354 </target>
355
356 <!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
357 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
358 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
359
360 <target name="install-common-src" depends="init"
361 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
362 <antcall target="configure-common-src"/>
363 <antcall target="compile-common-src"/>
364 <antcall target="install-auxiliary-jar-files"/>
365 <antcall target="install-jni-files"/>
366 </target>
367
368 <target name="install-collection-building" depends="init" if="collection.building.enabled"
369 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
370 <antcall target="configure-collection-building"/>
371 <antcall target="tweak-makefiles" />
372 <antcall target="compile-collection-building"/>
373 </target>
374
375
376 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
377 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
378
379 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
380 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
381
382 <target name="configure" depends="init,configure-tomcat,configure-web"
383 description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file."/>
384
385 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
386 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
387
388 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
389 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
390
391 <target name="update" depends="init,svnupdate,clean,install"
392 description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
393
394 <target name="start" depends="init,start-tomcat"
395 description="Startup the Tomcat server." >
396 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
397 <echo>Tomcat: ${catalina.home}</echo>
398 <echo>Java : ${java.home}</echo>
399 <echo>URL : http://${tomcat.server}:${tomcat.port}${app.path}/</echo>
400 <!-- assuming that index.html is not needed here -->
401 </target>
402
403 <target name="stop" depends="init,stop-tomcat"
404 description="Shutdown the Tomcat server."/>
405
406 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
407
408
409 <!-- =========== Help targets =================================== -->
410
411 <property name="install-command" value="ant [options] prepare install"/>
412
413 <target name="usage" description="Print a help message">
414 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
415 <echo message=" Execute 'ant -help' for Ant help."/>
416 <echo>To install Greenstone3, run '${install-command}'.
417 There 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.
418 To log the output, use the '-logfile build.log' option.
419 The README.txt file has more information about the ant targets and install process.
420 </echo>
421 </target>
422
423 <target name="help" depends="usage" description="Print a help message"/>
424
425 <target name="debug" depends="init" description="Display all the currently used properties">
426 <echoproperties/>
427 </target>
428
429 <!-- ====== initialization and setup targets ================== -->
430
431 <target name="accept-properties" unless="properties.accepted">
432 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
433 tomcat.server=${tomcat.server}
434 tomcat.port=${tomcat.port}
435 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
436 proxy.host=${proxy.host}
437 proxy.port=${proxy.port}
438 disable.collection.building=${disable.collection.building}
439 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
440 </input>
441 <condition property="do.abort">
442 <equals arg1="n" arg2="${properties.ok}"/>
443 </condition>
444 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
445 </target>
446
447 <!-- this sets up some initial properties -->
448 <target name="init">
449
450 <!-- has the gs3-setup script been run?? -->
451 <condition property="gs3-setup-not-done">
452 <not>
453 <isset property="env.GSDL3HOME"/>
454 </not>
455 </condition>
456
457 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
458
459 <condition property="java.too.old">
460 <or>
461 <equals arg1="1.1" arg2="${ant.java.version}"/>
462 <equals arg1="1.2" arg2="${ant.java.version}"/>
463 <equals arg1="1.3" arg2="${ant.java.version}"/>
464 </or>
465 </condition>
466 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
467
468 <available file="${basedir}/gli" property="gli.present"/>
469 <available file="${basedir}/common-src" property="common.src.present"/>
470 <available file="${basedir}/gs2build" property="gs2build.present"/>
471
472 <condition property="tomcat.islocal">
473 <or>
474 <not><isset property="tomcat.installed.path"/></not>
475 <equals arg1="" arg2="${tomcat.installed.path}"/>
476 </or>
477 </condition>
478
479 <echo>tomcat.port = ${tomcat.port}</echo>
480
481 <condition property="proxy.present">
482 <and>
483 <isset property="proxy.host"/>
484 <not><equals arg1="" arg2="${proxy.host}"/></not>
485 </and>
486 </condition>
487
488 <!--
489 the next block checks if tomcat is present in the 'packages' directory, and if so, figures
490 out its major version number (5, 6, etc.)
491 then it checks if your java is new enough to run that tomcat and if not fails with an explanation
492 -->
493 <condition property="packages.tomcat.ispresent" value="true" else="false">
494 <available file="packages/tomcat"/>
495 </condition>
496
497 <if><bool><istrue value="${packages.tomcat.ispresent}"/></bool>
498 <exec os="${os.unix}" outputproperty="packages.tomcat.detected.version" errorproperty="packages.tomcat.detection.errors" dir="packages/tomcat/bin" executable="sh">
499 <arg value="-c"/>
500 <arg value="./catalina.sh version | grep '^Server version: ' | sed 's@[^0-9]*\([0-9]\).*@\1@g'"/>
501 </exec>
502 <!--
503 totally untested, so commented out for now
504 <exec os="${os.windows}" outputproperty="packages.tomcat.detected.version" dir="packages/tomcat/bin" executable="cmd.exe">
505 <arg value="/c"/>
506 <arg value="catalina.bat version | grep '^Server version: ' | sed 's@[^0-9]*\([0-9]\).*@\1@g'"/>
507 </exec>
508 -->
509 <property name="packages.tomcat.detected.version" value="unknown"/>
510 </if>
511 <!--
512 <echo>packages.tomcat.ispresent: ${packages.tomcat.ispresent}</echo>
513 <echo>packages.tomcat.detected.version: ${packages.tomcat.detected.version}</echo>
514 <echo>packages.tomcat.detection.error: ${packages.tomcat.detection.errors}</echo>
515 -->
516
517 <if>
518 <bool>
519 <or>
520 <and>
521 <istrue value="${packages.tomcat.ispresent}"/>
522 <equals arg1="${packages.tomcat.detected.version}" arg2="6"/>
523 <equals arg1="1.4" arg2="${ant.java.version}"/>
524 </and>
525 <not><equals arg1="${packages.tomcat.detection.errors}" arg2=""/></not>
526 </or>
527 </bool>
528 <fail>Your java version (1.4) is too old to work with the bundled version of Apache Tomcat. Please upgrade your java to version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
529 </if>
530
531 </target>
532
533 <target name="setup-proxy" depends="init" if="proxy.present">
534 <condition property="ask.user">
535 <or>
536 <equals arg1="" arg2="${proxy.user}"/>
537 <equals arg1="" arg2="${proxy.password}"/>
538 </or>
539 </condition>
540
541 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
542 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
543 </target>
544
545 <!-- ========== Web app Targets ================================ -->
546
547 <target name="prepare-web" depends="init">
548 <mkdir dir="${web.home}/applet"/>
549 <mkdir dir="${web.home}/logs"/>
550 </target>
551
552 <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib, but if we are using java 1.4, we can't have it there -->
553 <target name="configure-java-version" depends="init"
554 description="Activates or deactivates some jar libraries as needed depending on your java version">
555
556 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
557 <condition property="need.xalan.jar">
558 <or>
559 <equals arg1="1.5" arg2="${ant.java.version}"/>
560 <equals arg1="1.6" arg2="${ant.java.version}"/>
561 </or>
562 </condition>
563
564 <!-- if they have xalan.jar but dont need it -->
565 <if>
566 <bool>
567 <and>
568 <isset property="have.xalan.jar"/>
569 <not><isset property="need.xalan.jar"/></not>
570 </and>
571 </bool>
572 <antcall target="deactivate-xalan-jar"/>
573 </if>
574
575 <!-- if they need xalan.jar but dont have it -->
576 <if>
577 <bool>
578 <and>
579 <not><isset property="have.xalan.jar"/></not>
580 <isset property="need.xalan.jar"/>
581 </and>
582 </bool>
583 <antcall target="activate-xalan-jar"/>
584 </if>
585
586 </target>
587
588 <target name="activate-xalan-jar">
589 <echo>activating xalan.jar</echo>
590 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
591 <if>
592 <bool>
593 <and>
594 <isset property="current.os.ismac"/>
595 <available file="${catalina.home}/common/endorsed" type="dir"/>
596 </and>
597 </bool>
598 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
599 </if>
600 </target>
601
602 <target name="deactivate-xalan-jar">
603 <echo>deactivating xalan.jar</echo>
604 <delete file="${web.lib}/xalan.jar"/>
605 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
606 </target>
607
608
609 <target name="prepare-collections" depends="init">
610 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
611 <property name="index.zip" value="index.zip"/>
612
613 <echo message="installing collections..."/>
614 <antcall target="gs2mgdemo-install"/>
615 <antcall target="gs2mgppdemo-install"/>
616 <antcall target="gberg-install"/>
617 </target>
618
619 <target name="gs2mgdemo-prepare" if="collect.dir">
620 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
621
622 <condition property="gs2mgdemo.present">
623 <and>
624 <available file="${gs2mgdemo.dir}/${index.zip}"/>
625 </and>
626 </condition>
627 </target>
628
629 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
630 <echo> installing gs2mgdemo</echo>
631 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
632 <echo>collection gs2mgdemo installed</echo>
633 </target>
634
635 <target name="gs2mgppdemo-prepare" if="collect.dir">
636 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
637
638 <condition property="gs2mgppdemo.present">
639 <and>
640 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
641 </and>
642 </condition>
643 </target>
644
645 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
646 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
647 <echo>collection gs2mgppdemo installed</echo>
648 </target>
649
650 <target name="gberg-prepare" if="collect.dir">
651 <property name="gberg.dir" value="${collect.dir}/gberg"/>
652 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
653 </target>
654
655 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
656 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
657 <echo>collection gberg installed</echo>
658 </target>
659
660 <target name="configure-web" depends="init"
661 description="Configure only the web app config files">
662 <!-- we want a unix path in the global.properties file -->
663 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
664 <path path="${web.home}"/>
665 </pathconvert>
666 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
667 <filter token="gsdl3version" value="${app.version}"/>
668 <filter token="tomcat.server" value="${tomcat.server}"/>
669 <filter token="tomcat.port" value="${tomcat.port}"/>
670 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
671 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
672 <chmod file="${web.classes}/global.properties" perm="600"/>
673 <chmod file="${web.classes}/log4j.properties" perm="600"/>
674 </target>
675
676 <target name="compile-web" depends="init">
677 <javac srcdir="${web.classes}"
678 destdir="${web.classes}"
679 debug="${compile.debug}"
680 deprecation="${compile.deprecation}"
681 optimize="${compile.optimize}">
682 <classpath><path refid="compile.classpath"/></classpath>
683 </javac>
684 </target>
685
686 <target name="compile-classpath-jars" depends="init">
687 <if><bool><available file="admin/cp.mf"/></bool>
688 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
689 </if>
690 <if><bool><available file="${lib.java}/cp.mf"/></bool>
691 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
692 </if>
693 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
694 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
695 </if>
696 <if><bool><available file="${web.lib}/cp.mf"/></bool>
697 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
698 </if>
699 <jar destfile="cp.jar">
700 <manifest>
701 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
702 </manifest>
703 </jar>
704 </target>
705
706 <target name="clean-classpath-jars" depends="init">
707 <delete file="admin/cp.jar"/>
708 <delete file="${lib.java}/cp.jar"/>
709 <delete file="${lib.jni}/cp.jar"/>
710 <delete file="${web.lib}/cp.jar"/>
711 <delete file="cp.jar"/>
712 </target>
713
714
715 <target name="svnupdate-web" unless="nosvn.mode">
716 <svn>
717 <update dir="${web.home}" revision="${branch.revision}"/>
718 </svn>
719 </target>
720
721 <target name="update-web" depends="init,svnupdate-web,configure-web"
722 description="update only the web stuff (config files)"/>
723
724 <!-- ======================= Tomcat Targets ========================== -->
725
726 <!-- this target downloads and installs Tomcat -->
727 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
728 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
729 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 6 if using Java 1.5 or higher). If you want to change which version of Java you are using between 1.4 and 1.5/6 then you need to run prepare-tomcat">
730 <if>
731 <bool>
732 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
733 </bool>
734
735 <!-- check that packages dir is there -->
736 <mkdir dir="${packages.home}"/>
737 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
738 dest="${packages.home}/${tomcat.version}.zip"
739 usetimestamp="true"/>
740 <unzip src="${packages.home}/${tomcat.version}.zip"
741 dest="${packages.home}"/>
742
743 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
744 we would need to have the tomcat compat package to work with Java 1.4-->
745 <if>
746 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
747 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
748 dest="${packages.home}/${tomcat.version}-compat.zip"
749 usetimestamp="true"/>
750 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
751 dest="${packages.home}"/>
752 </if>
753
754 <!-- delete any existing tomcat -->
755 <delete dir="${packages.home}/tomcat"/>
756 <move todir="${packages.home}/tomcat">
757 <fileset dir="${packages.home}/${tomcat.version}"/>
758 </move>
759 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
760 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
761 overwrite="true"/>
762 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
763 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
764 overwrite="true"/>
765 <!-- make sure we have execute permission for the .sh files -->
766 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
767 includes="*.sh"/>
768
769 <echo file="${packages.home}/tomcat/.flagfile">
770 the timestamp of this file is the time that tomcat was extracted from the zip files.
771 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
772 </echo>
773
774 <!-- this is not strictly a prepare tomcat thing, but if one changes
775 Java, then they need to change tomcat as well, so might as well call
776 it here -->
777 <antcall target="configure-java-version"/>
778 <else>
779 <echo>Tomcat has been prepared, will not prepare</echo>
780 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
781 </else>
782
783 </if>
784
785 </target>
786
787 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
788
789 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
790 <!-- re-setup the server.xml file -->
791 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
792 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
793 <filterset>
794 <filter token="port" value="${tomcat.port}"/>
795 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
796 </filterset>
797 </copy>
798 <!-- set up the greenstone3 context -->
799 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
800 <filterset>
801 <filter token="gsdl3webhome" value="${web.home}"/>
802 </filterset>
803 </copy>
804 </target>
805
806 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
807 <!-- re-setup the server.xml file -->
808 <!-- need to edit the config file, or do we get the user to do this???-->
809 </target>
810
811 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
812 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
813 <property name="tomcat.path" refid="local.tomcat.path"/>
814 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
815 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
816 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
817 <env key="GSDL3HOME" value="${basedir}"/>
818 <env key="PATH" path="${tomcat.path}"/>
819 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
820 <env key="CATALINA_HOME" value="${catalina.home}"/>
821 <env key="CLASSPATH" path="${tomcat.classpath}"/>
822 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
823 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here??-->
824 <env key="WNHOME" path="${wn.home}"/>
825 </exec>
826 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
827 <env key="GSDLOS" value="windows"/>
828 <env key="GSDL3HOME" value="${basedir}"/>
829 <env key="Path" path="${tomcat.path}"/>
830 <env key="PATH" path="${tomcat.path}"/>
831 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
832 <env key="CATALINA_HOME" value="${catalina.home}"/>
833 <env key="CLASSPATH" path="${tomcat.classpath}"/>
834 </exec>
835 <!-- wait for the server to startup in case other targets need it running -->
836 <waitfor maxwait="5" maxwaitunit="second">
837 <and>
838 <socket server="${tomcat.server}" port="${tomcat.port}"/>
839 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
840 </and>
841 </waitfor>
842 </target>
843
844 <!-- windows: do we want to launch a webrowser?? -->
845 <!-- shouldn't this test whether anything is running first? -->
846 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
847 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
848 <env key="CATALINA_HOME" value="${catalina.home}"/>
849 </exec>
850 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
851 <env key="CATALINA_HOME" value="${catalina.home}"/>
852 </exec>
853 </target>
854
855 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
856
857 <target name="setup-catalina-ant-tasks">
858 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
859 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
860 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
861 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
862 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
863 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
864 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
865 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
866 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
867 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
868 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
869 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
870 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
871 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
872 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
873 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
874 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
875 </target>
876
877
878 <!-- ======================= ant Targets ============================ -->
879 <target name="prepare-ant" depends="init">
880 <if>
881 <bool>
882 <not><available file="${packages.home}/ant/.flagfile"/></not>
883 </bool>
884
885 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
886 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
887 usetimestamp="true"/>
888 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
889 dest="${packages.home}"/>
890 <move todir="${packages.home}/ant">
891 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
892 </move>
893 <echo file="${packages.home}/ant/.flagfile">
894 the timestamp of this file is the time that ant was extracted from the zip files.
895 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
896 </echo>
897
898 <else>
899 <echo>Ant has been prepared, will not prepare</echo>
900 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
901 </else>
902
903 </if>
904 </target>
905
906 <!-- ======================= Axis Targets ============================ -->
907
908 <target name="prepare-axis" depends="init">
909
910 <if>
911 <bool>
912 <not><available file="${packages.home}/axis/.flagfile"/></not>
913 </bool>
914
915 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
916 dest="${packages.home}/${axis.zip.version}"
917 usetimestamp="true"/>
918 <unzip src="${packages.home}/${axis.zip.version}"
919 dest="${packages.home}"/>
920 <move todir="${packages.home}/axis">
921 <fileset dir="${packages.home}/${axis.dir.version}"/>
922 </move>
923 <!-- install axis into greenstone web app -->
924 <copy todir="${web.lib}">
925 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
926 <include name="*.jar"/>
927 </fileset>
928 </copy>
929 <copy todir="${web.home}">
930 <fileset dir="${packages.home}/axis/webapps/axis/">
931 <include name="*.jsp"/>
932 <include name="*.jws"/>
933 </fileset>
934 </copy>
935 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
936 <copy todir="${web.classes}">
937 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
938 <include name="*.properties"/>
939 </fileset>
940 </copy>
941 <echo file="${packages.home}/axis/.flagfile">
942 the timestamp of this file is the time that axis was extracted from the zip files.
943 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
944 </echo>
945
946 <else>
947 <echo>Axis has been prepared, will not prepare</echo>
948 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
949 </else>
950
951 </if>
952 </target>
953
954 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
955 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
956
957 <target name="deploy-site">
958 <java classname="org.apache.axis.client.AdminClient">
959 <classpath refid="compile.classpath"/>
960 <arg value="-l"/>
961 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
962 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
963 </java>
964 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
965 </target>
966
967 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
968 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
969 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
970 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
971 tofile="${basedir}/resources/soap/undeploy.wsdd"
972 filtering="true"
973 overwrite="true"/>
974 <java classname="org.apache.axis.client.AdminClient">
975 <classpath refid="compile.classpath"/>
976 <arg value="-l"/>
977 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
978 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
979 </java>
980 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
981 </target>
982
983 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
984 with the default servicename of localsite-->
985 <target name="deploy-localsite" depends="init"
986 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
987 <antcall target="start-tomcat"/>
988 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
989 <antcall target="create-deployment-files">
990 <param name="axis.sitename" value="localsite"/>
991 <param name="axis.servicesname" value="${base.webservice.name}"/>
992 <param name="axis.siteuri" value="localsite"/>
993 </antcall>
994 <antcall target="deploy-site">
995 <param name="axis.sitename" value="localsite"/>
996 <param name="axis.servicesname" value="${base.webservice.name}"/>
997 <param name="axis.siteuri" value="localsite"/>
998 </antcall>
999 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1000 </target>
1001
1002 <target name="get-sitename" unless="axis.sitename">
1003 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1004Press Enter for default:localsite</input>
1005 </target>
1006
1007 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1008 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1009To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1010Or press Enter for undeploying the default:localsite /&gt;</input>
1011 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1012 </target>
1013
1014 <target name="get-webservices" unless="axis.servicesname">
1015 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1016Choose from: ${web.services.list}
1017Or press Enter for default:${base.webservice.name} /&gt;</input>
1018 <echo>${axis.servicesname}</echo>
1019 </target>
1020
1021 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1022 <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
1023 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1024 </target>
1025
1026 <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC" if="axis.servicesname">
1027 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1028 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1029 </condition>
1030
1031 <!--everything else defaults to java:RPC at present-->
1032 <condition property="soap.method" value="provider='java:RPC'">
1033 <not>
1034 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1035 </not>
1036 </condition>
1037 </target>
1038
1039 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1040 <filter token="sitename" value="${axis.sitename}"/>
1041 <filter token="siteuri" value="${axis.siteuri}"/>
1042 <filter token="servicesname" value="${axis.servicesname}"/>
1043 <filter token="soapmethod" value="${soap.method}"/>
1044 <copy file="${basedir}/resources/soap/site.wsdd.template"
1045 tofile="${basedir}/resources/soap/deploy.wsdd"
1046 filtering="true"
1047 overwrite="true"/>
1048 <!-- create the java files and compile them -->
1049 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1050 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1051 filtering="true"
1052 overwrite="true"/>
1053 <mkdir dir="${build.home}"/>
1054 <javac srcdir="${src.home}"
1055 destdir="${build.home}"
1056 debug="${compile.debug}"
1057 deprecation="${compile.deprecation}"
1058 optimize="${compile.optimize}">
1059 <classpath refid="compile.classpath"/>
1060 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1061 </javac>
1062 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1063 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1064 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1065 overwrite="true" />
1066 </target>
1067
1068
1069 <!-- ====================== Core targets ============================== -->
1070 <!-- core targets refer to the core gsdl3 java src -->
1071
1072 <target name="prepare-core"/>
1073
1074 <target name="configure-core"/>
1075
1076 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1077 description="Update only the Greenstone core" />
1078
1079 <target name="svnupdate-core" unless="nosvn.mode">
1080 <svn>
1081 <update dir="." revision="${branch.revision}"/>
1082 </svn>
1083 </target>
1084
1085 <target name="clean-core"
1086 description="Clean only the Greenstone core">
1087 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1088 <delete dir="${build.home}"/>
1089 </target>
1090
1091 <target name="compile-core" depends="init"
1092 description="Compile only the Greenstone core">
1093 <mkdir dir="${build.home}"/>
1094 <javac srcdir="${src.home}"
1095 destdir="${build.home}"
1096 debug="${compile.debug}"
1097 deprecation="${compile.deprecation}"
1098 optimize="${compile.optimize}">
1099 <classpath>
1100 <path refid="compile.classpath"/>
1101 </classpath>
1102 </javac>
1103 <jar destfile="${build.home}/gsdl3.jar">
1104 <fileset dir="${build.home}">
1105 <include name="org/greenstone/gsdl3/**"/>
1106 <include name="org/flax/**"/>
1107 <exclude name="**/Test.class"/>
1108 </fileset>
1109 <manifest>
1110 <attribute name="Built-By" value="${user.name}" />
1111 </manifest>
1112 </jar>
1113 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1114 <!-- copy the localsite server in case we need it -->
1115 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1116
1117 <!-- Greenstone Administrator Interface -->
1118 <jar destfile="${build.home}/GAI.jar">
1119 <fileset dir="${build.home}">
1120 <include name="org/greenstone/admin/**"/>
1121 </fileset>
1122 <manifest>
1123 <attribute name="Built-By" value="${user.name}" />
1124 </manifest>
1125 </jar>
1126 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1127 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1128 <jar destfile="${build.home}/phind.jar">
1129 <fileset dir="${build.home}">
1130 <include name="org/greenstone/applet/phind/**"/>
1131 </fileset>
1132 <manifest>
1133 <attribute name="Built-By" value="${user.name}" />
1134 </manifest>
1135 </jar>
1136 <mkdir dir="${web.applet}"/>
1137 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1138 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1139 <if>
1140 <bool><istrue value="${tomcat.islocal}"/></bool>
1141 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1142 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1143 </if>
1144
1145
1146 <!-- skip anttasks for now
1147 <jar destfile="${build.home}/anttasks.jar">
1148 <fileset dir="${build.home}">
1149 <include name="org/greenstone/anttasks/**"/>
1150 </fileset>
1151 <manifest>
1152 <attribute name="Built-By" value="${user.name}" />
1153 </manifest>
1154 </jar>
1155 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1156 <jar destfile="${build.home}/gsdl3test.jar">
1157 <fileset dir="${build.home}">
1158 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1159 <include name="org/greenstone/testing/**"/>
1160 </fileset>
1161 <manifest>
1162 <attribute name="Built-By" value="${user.name}" />
1163 </manifest>
1164 </jar>
1165 <jar destfile="${build.home}/server.jar">
1166 <fileset dir="${build.home}">
1167 <include name="org/greenstone/server/**"/>
1168 </fileset>
1169 <fileset file="${basedir}/resources/java/server.properties"/>
1170 <manifest>
1171 <attribute name="Built-By" value="${user.name}"/>
1172 </manifest>
1173 </jar>
1174 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1175 </target>
1176
1177 <!-- ================== Packages targets ================================ -->
1178 <!-- these targets refer to the greenstone source packages - these need
1179 updating less often, so are in separate targets to the core -->
1180 <target name="prepare-packages" depends="init"/>
1181
1182 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1183 description="Update only the source packages"/>
1184
1185 <target name="svnupdate-packages" unless="nosvn.mode">
1186 <svn>
1187 <update dir="${src.packages.home}" revision="${branch.revision}"/>
1188 </svn>
1189 </target>
1190
1191
1192 <target name="configure-packages" depends="init,configure-javagdbm"
1193 description="Configure only the packages."/>
1194
1195 <target name="configure-javagdbm">
1196 <echo>
1197 Configuring JavaGDBM
1198 </echo>
1199
1200 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1201 <arg value="--prefix=${basedir}"/>
1202 <arg value="--libdir=${lib.jni}"/>
1203 <arg value="--with-gdbm=${gdbm.home}"/>
1204 </exec>
1205 </target>
1206
1207 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1208
1209 <target name="clean-javagdbm" depends="init">
1210 <exec executable="make" os="${os.unix}"
1211 dir="${javagdbm.home}" failonerror="true">
1212 <arg value="clean"/>
1213 </exec>
1214 </target>
1215
1216 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1217
1218 <target name="distclean-javagdbm" depends="init">
1219 <exec executable="make" os="${os.unix}"
1220 dir="${javagdbm.home}" failonerror="true">
1221 <arg value="distclean"/>
1222 </exec>
1223 </target>
1224
1225 <target name="compile-packages" description="Compile only the source packages">
1226
1227 <!-- unix: -->
1228 <echo>compile javagdbm</echo>
1229 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1230 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1231 <arg value="install"/>
1232 </exec>
1233
1234 <!-- windows: just the java stuff. -->
1235 <echo>Windows: compile javagdbm (java only)</echo>
1236 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1237 <arg value="compile"/>
1238 <arg value="javaonly"/>
1239 </exec>
1240
1241 <!-- install the jar file -->
1242 <echo>Install the javagdbm jar file</echo>
1243 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1244
1245
1246 <!-- Search4j -->
1247 <antcall target="compile-search4j"/>
1248 </target>
1249
1250 <target name="compile-search4j">
1251
1252 <!-- windows -->
1253 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1254 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1255 <arg value="/f"/>
1256 <arg value="win32.mak"/>
1257 <arg value='BINDIR="${basedir}\bin"'/>
1258 </exec>
1259 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1260 <arg value="/f"/>
1261 <arg value="win32.mak"/>
1262 <arg value="install"/>
1263 <arg value='BINDIR="${basedir}\bin"'/>
1264 </exec>
1265
1266 <!-- unix -->
1267 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1268 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1269 <arg value="--bindir=${basedir}/bin"/>
1270 <arg value="${static.arg}"/>
1271 </exec>
1272 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1273 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1274 <arg value="install"/>
1275 </exec>
1276
1277 <!-- else warn -->
1278 <else>
1279 <fail>this target does not support the current os</fail>
1280
1281 </else></if></else></if>
1282
1283 </target>
1284
1285 <target name="install-auxiliary-jar-files" depends="init">
1286 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1287 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1288 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1289 </target>
1290
1291 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1292
1293 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1294 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1295 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1296 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1297 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1298 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1299 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1300 </target>
1301 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1302 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1303 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1304 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1305 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1306 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1307 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1308 </target>
1309 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1310 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1311 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1312 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1313 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1314 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1315 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1316 </target>
1317
1318 <!-- ========common-src targets =================================-->
1319 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1320 collection building is not enabled -->
1321
1322 <target name="update-common-src" depends="init" if="collection.building.disabled">
1323 </target>
1324
1325 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1326 <svn>
1327 <update dir="${common.src.home}" revision="${branch.revision}"/>
1328 </svn>
1329 </target>
1330
1331 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1332 <antcall target="checkout-common-src"/>
1333 <antcall target="unzip-windows-packages"/>
1334 </target>
1335
1336 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1337 <echo>checking out common-src</echo>
1338 <svn>
1339 <checkout url="${svn.root}/gsdl/trunk/common-src" destPath="common-src" revision="${branch.revision}"/>
1340 </svn>
1341 </target>
1342
1343 <target name="configure-common-src" depends="init">
1344 <exec executable="${common.src.home}/configure" os="${os.unix}"
1345 dir="${common.src.home}" failonerror="true">
1346 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1347 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1348 <arg line="${static.arg}"/>
1349 </exec>
1350 </target>
1351
1352 <target name="clean-common-src" depends="init">
1353 <!-- unix: -->
1354 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1355 <arg value="clean"/>
1356 </exec>
1357 <!-- windows: -->
1358 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1359 <arg value="/f"/>
1360 <arg value="win32.mak"/>
1361 <arg value="clean"/>
1362 <arg value="GSDLHOME=${gs2build.home}"/>
1363 </exec>
1364 </target>
1365 <target name="distclean-common-src" depends="init">
1366 <!-- unix: -->
1367 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1368 <arg value="distclean"/>
1369 </exec>
1370 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1371 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1372 <arg value="/f"/>
1373 <arg value="win32.mak"/>
1374 <arg value="clean"/>
1375 <arg value="GSDLHOME=${gs2build.home}"/>
1376 </exec>
1377 </target>
1378 <target name="compile-common-src" depends="init">
1379 <!-- unix: -->
1380 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1381 </exec>
1382 <!-- windows: -->
1383 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1384 <arg value="/f"/>
1385 <arg value="win32.mak"/>
1386 <arg value="GSDLHOME=${gs2build.home}"/>
1387 </exec>
1388 </target>
1389
1390 <!-- ======= collection-building targets ===========================-->
1391
1392 <target name="update-collection-building" if="collection.building.enabled"
1393 depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
1394 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1395
1396 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1397 description="SVN update the collection building components">
1398 </target>
1399
1400 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1401 </target>
1402
1403 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1404 description="Configure the collection building components">
1405 </target>
1406
1407 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1408 description="Clean only the collection building components"
1409 if="collection.building.enabled"/>
1410
1411 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1412 description="Distclean only the collection building components"
1413 if="collection.building.enabled"/>
1414
1415 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1416 description="Compile only the collection building components">
1417 <!-- make install for common-src -->
1418 <!-- unix: -->
1419 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1420 <arg value="install"/>
1421 </exec>
1422
1423 <!-- windows: -->
1424 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1425 <arg value="/f"/>
1426 <arg value="win32.mak"/>
1427 <arg value="install"/>
1428 </exec>
1429
1430 <!-- install gs2build indexers for windows -->
1431 <if>
1432 <bool><istrue value="${current.os.iswindows}"/></bool>
1433 <copy todir="${gs2build.home}/bin/windows">
1434 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1435 <include name="*.*"/>
1436 </fileset>
1437 </copy>
1438 </if>
1439
1440 <!-- LuceneWrapper jar file not installed by default -->
1441 <mkdir dir="${gs2build.home}/bin/java"/>
1442 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1443
1444 </target>
1445
1446 <!-- ============== gli targets ================================= -->
1447 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1448 <svn>
1449 <update dir="${gli.home}" revision="${branch.revision}"/>
1450
1451 <!-- some files from cgi-bin: necessary for remote GLI server -->
1452 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/>
1453 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1454 </svn>
1455 </target>
1456
1457 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1458 <!-- checkout -->
1459 <if><bool><not><istrue value="${nosvn.mode}"/></not></bool>
1460 <svn>
1461 <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1462
1463 <!-- some files from cgi-bin: necessary for remote GLI server -->
1464 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/>
1465 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1466 </svn>
1467 </if>
1468 </target>
1469
1470 <target name="clean-gli" depends="init" if="collection.building.enabled">
1471 <!-- gli -->
1472 <property name="gli.home" value="${basedir}/gli"/>
1473 <!-- linux -->
1474 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1475 resolveExecutable="true"/>
1476 <!-- windows -->
1477 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1478 resolveExecutable="true"/>
1479 </target>
1480
1481 <target name="compile-gli" depends="init" if="collection.building.enabled">
1482 <!-- gli -->
1483 <property name="gli.home" value="${basedir}/gli"/>
1484
1485 <!-- linux -->
1486 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1487 <!--remote gli-->
1488 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1489 resolveExecutable="true"/>
1490 <!-- windows -->
1491 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1492 <!--remote gli-->
1493 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1494 resolveExecutable="true"/>
1495 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1496 </target>
1497
1498 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1499 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1500 <env key="gsdl3path" path="${basedir}"/>
1501 <env key="gsdlpath" path="${gs2build.home}"/>
1502 </exec>
1503 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1504 <env key="gsdl3path" path="${basedir}"/>
1505 <env key="gsdlpath" path="${gs2build.home}"/>
1506 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
1507 </exec>
1508 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1509 <env key="GSDL3PATH" path="${basedir}"/>
1510 <env key="GSDLPATH" path="${gs2build.home}"/>
1511 </exec>
1512 <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 gli.sh/bat from the greenstone3/gli directory.
1513 </echo>
1514 </target>
1515
1516 <!-- ================ gs2build targets =========================== -->
1517
1518 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1519 <echo>svn updating gs2build</echo>
1520 <svn>
1521 <update dir="{gs2build.home}" revision="${branch.revision}"/>
1522 </svn>
1523 </target>
1524
1525 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1526 <antcall target="checkout-gs2build"/>
1527 <antcall target="unzip-windows-packages"/>
1528 <antcall target="checkout-winbin"/>
1529 <antcall target="get-windows-binaries"/>
1530 <antcall target="delete-winbin"/>
1531 </target>
1532
1533 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1534 <echo>checking out gs2build</echo>
1535 <svn>
1536 <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1537 </svn>
1538 </target>
1539
1540 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1541 unless="nosvn.mode">
1542 <svn>
1543 <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1544 </svn>
1545 </target>
1546
1547 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1548 <svn>
1549 <update dir="winbin" revision="${branch.revision}"/>
1550 </svn>
1551 </target>
1552
1553 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1554 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1555 <fileset dir="${basedir}/winbin/bin"/>
1556 </move>
1557 </target>
1558
1559 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1560 <delete dir="${basedir}/winbin"/>
1561 </target>
1562
1563 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1564 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1565 dest="${common.src.home}/packages/windows/crypt"/>
1566 <unzip src="${common.src.home}/packages/windows/expat/expat.zip"
1567 dest="${common.src.home}/packages/windows/expat"/>
1568 <untar compression="gzip"
1569 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1570 dest="${common.src.home}/packages/sqlite"/>
1571 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1572 dest="${common.src.home}/indexers/packages/windows/iconv"/>
1573 </target>
1574
1575 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1576 <!-- we want a windows path in the setup.bat file -->
1577 <pathconvert targetos="windows" property="gs2build.home.windows">
1578 <path path="${gs2build.home}"/>
1579 </pathconvert>
1580 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1581 <filterset>
1582 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1583 </filterset>
1584 </move>
1585 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1586 </target>
1587
1588
1589 <target name="clean-build-src" depends="init" if="collection.building.enabled">
1590 <!-- unix: -->
1591 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1592 <arg value="clean"/>
1593 </exec>
1594 <!-- windows: -->
1595 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1596 <arg value="/f"/>
1597 <arg value="win32.mak"/>
1598 <arg value="clean"/>
1599 <arg value="GSDLHOME=${gs2build.home}"/>
1600 </exec>
1601 </target>
1602
1603
1604 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
1605 <!-- unix: -->
1606 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1607 <arg value="distclean"/>
1608 </exec>
1609 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1610 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1611 <arg value="/f"/>
1612 <arg value="win32.mak"/>
1613 <arg value="clean"/>
1614 <arg value="GSDLHOME=${gs2build.home}"/>
1615 </exec>
1616 </target>
1617
1618 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1619 description="Configure the build-src component">
1620 <exec executable="${build.src.home}/configure" os="${os.unix}"
1621 dir="${build.src.home}" failonerror="true">
1622 <arg value="--prefix=${gs2build.home}"/>
1623 <arg line="${static.arg}"/>
1624 </exec>
1625 </target>
1626
1627 <!-- common-src is done separately and needs to be compiled first -->
1628 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1629
1630 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true"/>
1631 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1632 <arg value="install"/>
1633 </exec>
1634
1635 <!-- run the setup script -->
1636 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1637 <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
1638 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1639 <arg value="/f"/>
1640 <arg value="win32.mak"/>
1641 <arg value="GSDLHOME=${gs2build.home}"/>
1642 </exec>
1643 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1644 <arg value="/f"/>
1645 <arg value="win32.mak"/>
1646 <arg value="install"/>
1647 <arg value="GSDLHOME=${gs2build.home}"/>
1648 </exec>
1649 </target>
1650
1651
1652 <!-- ======================== TESTING Targets ========================= -->
1653
1654 <target name="test" description="Run the (incomplete) JUnit test suite "
1655 depends="init">
1656 <mkdir dir="${basedir}/test"/>
1657 <junit printsummary="withOutAndErr"
1658 errorproperty="test.failed"
1659 failureproperty="test.failed"
1660 fork="${junit.fork}">
1661 <formatter type="plain"/>
1662 <classpath>
1663 <pathelement location="${build.home}/gsdl3test.jar"/>
1664 <path refid="compile.classpath"/>
1665 </classpath>
1666 <test name="${testcase}" if="testcase"/>
1667 <batchtest todir="${basedir}/test" unless="testcase">
1668 <fileset dir="${build.home}" includes="**/*Test.class" />
1669 </batchtest>
1670 </junit>
1671 <echo>
1672 *********************************************
1673 Test output can be found in directory 'test'
1674 *********************************************
1675 </echo>
1676 </target>
1677
1678 <!-- ======================== FLAX Targets ========================= -->
1679 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1680 <echo>checking out flax ...</echo>
1681 <mkdir dir="${basedir}/src/java/org/flax"/>
1682 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1683 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1684 <mkdir dir="${web.home}/interfaces/flax"/>
1685 <mkdir dir="${web.home}/sites/flax"/>
1686 <mkdir dir="${basedir}/flax-resources"/>
1687 <mkdir dir="${basedir}/flax-lib"/>
1688 <svn>
1689 <checkout url="${flax.checkout.path}/src/java/org/flax/"
1690 destPath="${basedir}/src/java/org/flax"/>
1691 <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1692 destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1693 <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1694 destPath="${web.home}/WEB-INF/classes/flax"/>
1695 <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1696 destPath="${web.home}/interfaces/flax"/>
1697 <checkout url="${flax.checkout.path}/web/sites/flax/"
1698 destPath="${web.home}/sites/flax"/>
1699 <checkout url="${flax.checkout.path}/flax-resources"
1700 destPath="${basedir}/flax-resources"/>
1701 <checkout url="${flax.checkout.path}/lib"
1702 destPath="${basedir}/flax-lib"/>
1703 </svn>
1704 <echo>prepare flax files...</echo>
1705 <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1706 <antcall target="flax-copy-files" />
1707 <antcall target="unzip-flax-resources" />
1708 </target>
1709
1710 <target name="update-flax" description="update flax from repository">
1711 <echo>updating flax ...</echo>
1712 <svn>
1713 <update dir="${basedir}/src/java/org/flax"/>
1714 <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1715 <update dir="${web.home}/WEB-INF/classes/flax"/>
1716 <update dir="${web.home}/interfaces/flax"/>
1717 <update dir="${web.home}/sites/flax"/>
1718 </svn>
1719 <antcall target="flax-copy-files" />
1720 </target>
1721
1722 <target name="unzip-flax-resources" >
1723 <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1724 <unzip dest="${classes.dir}">
1725 <fileset dir="${classes.dir}">
1726 <include name="*.zip"/>
1727 </fileset>
1728 </unzip>
1729 <delete>
1730 <fileset dir="${classes.dir}" includes="*.zip"/>
1731 </delete>
1732 </target>
1733
1734 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1735 <echo>copying flax files ...</echo>
1736 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1737 <!-- A configuration file containing web service binding information for the axis engine -->
1738 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1739 <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1740 <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />
1741 </target>
1742
1743
1744
1745
1746 <target name="compile-javadocs">
1747 <javadoc packagenames="org.greenstone.*"
1748 sourcepath="src/java"
1749 defaultexcludes="yes"
1750 destdir="docs/javadoc"
1751 author="true"
1752 version="true"
1753 use="true"
1754 windowtitle="Greenstone3 API">
1755 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
1756 </javadoc>
1757 </target>
1758
1759<!-- ========== Some distribution targets ======================== -->
1760 <target name="remove-source">
1761 <delete includeEmptyDirs="true">
1762 <fileset dir="." defaultexcludes="false">
1763 <patternset refid="greenstone3.source.component"/>
1764 </fileset>
1765 </delete>
1766 </target>
1767
1768 <target name="dist-tidy"
1769 description="'tidies-up' a greenstone3 installation for distribution.">
1770
1771 <!-- delete unneeded things -->
1772 <delete dir="${packages.home}/axis"/>
1773 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
1774 <delete file="README-SVN.txt"/>
1775 <delete file="build.properties.in"/>
1776
1777 <!-- delete source files -->
1778 <antcall target="remove-source"/>
1779
1780 <!-- create empty directories -->
1781 <mkdir dir="${web.home}/applet"/>
1782 <mkdir dir="${web.home}/logs"/>
1783
1784 <!-- os specific tidy-ups -->
1785 <!-- linux, mac -->
1786 <if><bool><istrue value="${current.os.isunix}"/></bool>
1787 <delete><fileset dir="." includes="*.bat"/></delete>
1788 <delete><fileset dir="gli" includes="*.bat"/></delete>
1789 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
1790 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
1791 <delete file="${basedir}/gs2build/win32cfg.h"/>
1792 <delete file="${basedir}/gs2build/win32.mak"/>
1793 <delete dir="${basedir}/winutil"/>
1794 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
1795
1796 <!-- windows -->
1797 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
1798 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
1799 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
1800 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
1801 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
1802 </if></else></if>
1803
1804 </target>
1805
1806 <!-- fix up executable permissions for binary release -->
1807 <target name="fix-execute-permissions">
1808 <echo>Setting binaries to executable</echo>
1809 <chmod perm="775">
1810 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
1811 </chmod>
1812 </target>
1813
1814 <!-- fix up executable permissions for source code release -->
1815 <target name="fix-execute-permissions-source">
1816 <chmod perm="775">
1817 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
1818 </chmod>
1819 </target>
1820
1821
1822 <!-- ============= tweaks for making compilation static ========== -->
1823 <target name="tweak-makefiles" depends="init" if="compile.static">
1824 <antcall target="rtftohtml-add-static" />
1825 </target>
1826
1827 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
1828 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
1829 </target>
1830
1831</project>
Note: See TracBrowser for help on using the repository browser.