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

Last change on this file since 21658 was 21658, checked in by oranfry, 12 years ago

fixes

File size: 12.7 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 <!-- the envs on these execs simulate the environment when you run setup.bat
145 <exec dir="${basedir}/compiled" executable="perl">
146 <arg line="bin/script/import.pl - -removeold demo"/>
147 <env key="GSDLHOME" path="${basedir}/compiled"/>
148 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
149 <env key="GSDLOS" value="windows"/>
150 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
151 </exec>
152 <exec dir="${basedir}/compiled" executable="perl">
153 <arg line="bin/script/buildcol.pl - -removeold demo"/>
154 <env key="GSDLHOME" path="${basedir}/compiled"/>
155 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
156 <env key="GSDLOS" value="windows"/>
157 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
158 </exec>
159 <delete dir="${basedir}/compiled/collect/demo/index"/>
160 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
161 -->
162
163 <!-- delete the source code -->
164 <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
165 <delete dir="compiled/common-src"/>
166 <delete dir="compiled/build-src"/>
167 <delete dir="compiled/runtime-src"/>
168 <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>
169
170 <!-- strip .svn working-copy dirs -->
171 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
172
173 <!-- create needed empty files -->
174 <mkdir dir="compiled/tmp"/>
175 <chmod dir="compiled/tmp" perm="a+rwx"/>
176 <echo file="compiled/etc/usage.txt"></echo>
177
178 <!-- windows -->
179 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
180
181 <!-- make a copy of server.exe in the root -->
182 <copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
183
184 <!-- delete sourcecode -->
185 <delete dir="${binzip.dir}/common-src"/>
186 <delete dir="${binzip.dir}/build-src"/>
187 <delete dir="${binzip.dir}/runtime-src"/>
188
189 <!-- create simple zipped binary distribution
190 <mkdir dir="distributions"/>
191 <property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
192 <copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
193 <delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
194 -->
195
196 <!-- delete unneeded files -->
197 <delete dir="compiled/bin/linux" />
198 <delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc"/></delete>
199 <delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
200 <delete dir="compiled/autom4te.cache" />
201
202 <!-- linux -->
203 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
204 <!-- grab imagemagick binaries -->
205 <delete dir="compiled/bin/linux/imagemagick"/>
206 <exec executable="svn">
207 <arg value="export"/>
208 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
209 <arg value="compiled/bin/linux/imagemagick"/>
210 </exec>
211
212 <!-- grab wv binaries -->
213 <delete dir="compiled/bin/linux/wv"/>
214 <exec executable="svn">
215 <arg value="export"/>
216 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
217 <arg value="compiled/bin/linux/wv"/>
218 </exec>
219
220 <!-- delete unneeded files -->
221 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
222 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
223 <delete><fileset dir="compiled" includes="*.bat"/></delete>
224 <delete dir="compiled/common-src/packages/windows"/>
225 <delete dir="compiled/common-src/indexers/packages/windows"/>
226
227 <!-- mac -->
228 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
229 <!-- grab imagemagick binaries -->
230 <delete dir="compiled/bin/darwin/imagemagick"/>
231 <exec executable="svn">
232 <arg value="export"/>
233 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
234 <arg value="compiled/bin/darwin/imagemagick"/>
235 </exec>
236
237 <!-- grab ghostscript binaries -->
238 <delete dir="compiled/bin/darwin/imagemagick"/>
239 <exec executable="svn">
240 <arg value="export"/>
241 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
242 <arg value="compiled/bin/darwin/ghostscript"/>
243 </exec>
244
245 <!-- delete unneeded files -->
246 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,*.bat"/></delete>
247 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
248 <delete dir="compiled/common-src/packages/windows"/>
249
250 </if></else></if></else></if>
251
252 <!-- delete unneeded files -->
253 <delete dir="compiled/uninstaller" />
254 <delete file="compiled/bin/java/SignedGatherer.jar" />
255
256 <!-- tidy up gli -->
257 <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
258
259 <!-- mac and linux: insert export to cdrom package -->
260 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
261 <mkdir dir="compiled/bin/windows"/>
262 <get src="${server.exe.location}" dest="compiled/bin/windows/server.exe"/>
263 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
264 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
265 </if>
266
267 </target>
268
269</project>
Note: See TracBrowser for help on using the repository browser.