source: main/trunk/release-kits/kits/rk2/ant-scripts/compile.xml@ 21652

Last change on this file since 21652 was 21652, checked in by oranfry, 14 years ago

got properties target working for all kits, plus some fixes

File size: 13.4 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk2-compile">
3
4 <target name="compile" depends="init,gs2-init">
5
6 <!-- checkout gsdl and gli -->
7 <exec executable="svn">
8 <arg value="checkout"/>
9 <arg value="${svn.root}/main/${branch.path}/greenstone2"/>
10 <arg value="${basedir}/compiled"/>
11 </exec>
12 <exec executable="svn">
13 <arg value="checkout"/>
14 <arg value="${svn.root}/main/${branch.path}/gli"/>
15 <arg value="${basedir}/compiled/gli"/>
16 </exec>
17
18 <!-- drop in documentation -->
19 <copy todir="compiled" overwrite="true">
20 <fileset dir="${rk.home}/shared/greenstone2/docs" excludes="READMEar.txt,READMEes.txt,READMEfr.txt,READMEru.txt"/>
21 </copy>
22
23 <!-- set version numbers -->
24 <antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
25 <antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
26
27 <!-- windows only -->
28 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
29
30 <!-- unzip packages -->
31 <unzip src="${basedir}/compiled/common-src/packages/windows/crypt/crypt.zip" dest="${basedir}/compiled/common-src/packages/windows/crypt"/>
32 <unzip src="${basedir}/compiled/common-src/packages/windows/expat/expat.zip" dest="${basedir}/compiled/common-src/packages/windows/expat"/>
33 <unzip src="${basedir}/compiled/common-src/packages/windows/stlport/stlport.zip" dest="${basedir}/compiled/common-src/packages/windows/stlport"/>
34 <unzip src="${basedir}/compiled/common-src/indexers/packages/windows/iconv/iconv.zip" dest="${basedir}/compiled/common-src/indexers/packages/windows/iconv"/>
35 <untar src="${basedir}/compiled/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/compiled/common-src/packages/sqlite" compression="gzip"/>
36
37 <!-- get winbin -->
38 <if><bool><not><available file="${basedir}/compiled/bin/windows"/></not></bool>
39 <exec executable="svn">
40 <arg value="export"/>
41 <arg value="${svn.root}/main/${branch.path}/binaries/windows/bin"/>
42 <arg value="${basedir}/compiled/bin/windows"/>
43 <arg value="-r"/><arg value="${branch.revision}"/>
44 </exec>
45 </if>
46
47 <!-- insert windows perl -->
48 <unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/bin/windows"/>
49
50 <!-- compile c code -->
51 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
52 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
53 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
54 <mkdir dir="products"/>
55 <copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}.exe"/>
56 <move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
57
58
59 <!-- linux only -->
60 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
61
62 <!-- add static to configure.in -->
63 <rsr file="${basedir}/compiled/configure.in" pattern="^LDFLAGS=.*$" replacement="LDFLAGS=-static"/>
64 <exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure">
65 <arg value="configure.in"/>
66 </exec>
67
68 <!-- set environment in packages/configure -->
69 <rsr file="${basedir}/compiled/common-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
70 <rsr file="${basedir}/compiled/build-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
71
72 <!-- run configure -->
73 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
74 <arg line="--enable-apache-httpd"/>
75 <env key="LDFLAGS" value="-static"/>
76 </exec>
77
78 <!-- add -static to makefiles -->
79 <rsr file="${basedir}/compiled/build-src/packages/wv/wv-gs/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static" />
80 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
81 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
82 <rsr file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="(-o rtftohtml.{2}EXEEXT.{1})" replacement="$1 -static"/>
83
84 <!-- mac only -->
85 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
86 <!-- run configure -->
87 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
88 <arg line="--enable-apache-httpd"/>
89 </exec>
90
91 <!-- tweak makefiles -->
92 <rsr file="${basedir}/compiled/runtime-src/src/recpt/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
93 <rsr file="${basedir}/compiled/runtime-src/src/oaiservr/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
94
95 </if></else></if></else></if>
96
97 <!-- mac and linux: compile -->
98 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
99
100 <!-- WORKAROUND: make common-src and reconfigure -->
101 <!-- this is a workaround to a problem with the gsdl build code -->
102 <!-- expat needs to be compiled before the perl XML Parser is configured -->
103 <exec dir="${basedir}/compiled/common-src" executable="make" failonerror="true"/>
104 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
105 <arg line="--enable-apache-httpd"/>
106 <env key="LDFLAGS" value="-static"/>
107 </exec>
108 <!-- /WORKAROUND -->
109
110 <!-- make -->
111 <exec dir="${basedir}/compiled" executable="make" failonerror="true"/>
112
113 <!-- make install -->
114 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
115
116 <!-- make apache-for-dist -->
117 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
118
119 <!-- strip executables -->
120 <exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
121 <arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
122 </exec>
123 </if>
124
125 <!-- compile gli -->
126 <!-- (linux and mac) -->
127 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
128 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makegli.sh"/></exec>
129 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makejar.sh"/></exec>
130 <!-- windows -->
131 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
132 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makegli.bat"/></exec>
133 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makejar.bat"/></exec>
134 </if></else></if>
135
136 <delete dir="compiled/gli/jar"/>
137 <delete dir="compiled/gli/classes/org"/>
138 <move file="compiled/gli/GLIServer.jar" todir="compiled/bin/java"/>
139
140 <!-- compile uninstaller -->
141 <antcall target="insert-and-compile-uninstaller" />
142
143 <!-- build demo collection -->
144 <!-- linux, mac -->
145 <if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
146 <exec dir="${basedir}/compiled" executable="/bin/bash" failonerror="true">
147 <arg value="-c"/>
148 <arg value="
149 source setup.bash &amp;&amp; \
150 import.pl --removeold demo &amp;&amp; \
151 buildcol.pl --removeold demo &amp;&amp; \
152 rm -rf collect/demo/index collect/demo/archives &amp;&amp; \
153 mv collect/demo/building collect/demo/index"/>
154 </exec>
155
156 <!-- windows -->
157 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
158 <!-- the envs on these execs simulate the environment when you run setup.bat -->
159 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl.exe">
160 <arg line="bin\script\import.pl --removeold demo"/>
161 <env key="GSDLHOME" value="${basedir}/compiled"/>
162 <env key="GSDLCOLLECTDIR" value="${basedir}/compiled/collect"/>
163 <env key="GSDLOS" value="windows"/>
164 <env key="PATH" value="${basedir}\compiled\bin\windows\perl\bin;${basedir}\compiled\bin\windows;${basedir}\compiled\bin\script"/>
165 </exec>
166 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl.exe">
167 <arg line="bin\script\buildcol.pl --removeold demo"/>
168 <env key="GSDLHOME" value="${basedir}/compiled"/>
169 <env key="GSDLCOLLECTDIR" value="${basedir}/compiled/collect"/>
170 <env key="GSDLOS" value="windows"/>
171 <env key="PATH" value="${basedir}\compiled\bin\windows\perl\bin;${basedir}\compiled\bin\windows;${basedir}\compiled\bin\script"/>
172 </exec>
173 <delete dir="${basedir}/compiled/collect/demo/index"/>
174 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
175
176 </if></else></if>
177
178 <!-- delete the source code -->
179 <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
180 <delete dir="compiled/common-src"/>
181 <delete dir="compiled/build-src"/>
182 <delete dir="compiled/runtime-src"/>
183 <delete><fileset dir="compiled" includes="Install.txt,acconfig.h,aclocal.m4,config.guess,config.sub,configtest.pl,configure,configure.in,install-sh,Makefile.in,micotest.cpp,config.h.in,win32.mak,win32cfg.h"/></delete>
184
185 <!-- strip .svn working-copy dirs -->
186 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
187
188 <!-- create needed empty files -->
189 <mkdir dir="compiled/tmp"/>
190 <chmod dir="compiled/tmp" perm="a+rwx"/>
191 <echo file="compiled/etc/usage.txt"></echo>
192
193 <!-- windows -->
194 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
195
196 <!-- make a copy of server.exe in the root -->
197 <copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
198
199 <!-- delete sourcecode -->
200 <delete dir="${binzip.dir}/common-src"/>
201 <delete dir="${binzip.dir}/build-src"/>
202 <delete dir="${binzip.dir}/runtime-src"/>
203
204 <!-- create simple zipped binary distribution
205 <mkdir dir="distributions"/>
206 <property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
207 <copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
208 <delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
209 -->
210
211 <!-- delete unneeded files -->
212 <delete dir="compiled/bin/linux" />
213 <delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc"/></delete>
214 <delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
215 <delete dir="compiled/autom4te.cache" />
216
217 <!-- linux -->
218 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
219 <!-- grab imagemagick binaries -->
220 <delete dir="compiled/bin/linux/imagemagick"/>
221 <exec executable="svn">
222 <arg value="export"/>
223 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
224 <arg value="compiled/bin/linux/imagemagick"/>
225 </exec>
226
227 <!-- grab wv binaries -->
228 <delete dir="compiled/bin/linux/wv"/>
229 <exec executable="svn">
230 <arg value="export"/>
231 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
232 <arg value="compiled/bin/linux/wv"/>
233 </exec>
234
235 <!-- delete unneeded files -->
236 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
237 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
238 <delete><fileset dir="compiled" includes="*.bat"/></delete>
239 <delete dir="compiled/common-src/packages/windows"/>
240 <delete dir="compiled/common-src/indexers/packages/windows"/>
241
242 <!-- mac -->
243 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
244 <!-- grab imagemagick binaries -->
245 <delete dir="compiled/bin/darwin/imagemagick"/>
246 <exec executable="svn">
247 <arg value="export"/>
248 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
249 <arg value="compiled/bin/darwin/imagemagick"/>
250 </exec>
251
252 <!-- grab ghostscript binaries -->
253 <delete dir="compiled/bin/darwin/imagemagick"/>
254 <exec executable="svn">
255 <arg value="export"/>
256 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
257 <arg value="compiled/bin/darwin/ghostscript"/>
258 </exec>
259
260 <!-- delete unneeded files -->
261 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,*.bat"/></delete>
262 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
263 <delete dir="compiled/common-src/packages/windows"/>
264
265 </if></else></if></else></if>
266
267 <!-- delete unneeded files -->
268 <delete dir="compiled/uninstaller" />
269 <delete file="compiled/bin/java/SignedGatherer.jar" />
270
271 <!-- tidy up gli -->
272 <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
273
274 <!-- mac and linux: insert export to cdrom package -->
275 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
276 <mkdir dir="compiled/bin/windows"/>
277 <get src="${server.exe.location}" dest="compiled/bin/windows/server.exe"/>
278 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
279 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
280 </if>
281
282 </target>
283
284</project>
Note: See TracBrowser for help on using the repository browser.