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

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

fixes to rk2 for linux and mac

File size: 9.0 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 <antcall target="checkout-gsdl-gli" />
7 <antcall target="drop-in-docs"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
8 <antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
9 <antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
10
11 <!-- windows only -->
12 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
13 <antcall target="unzip-packages" />
14 <antcall target="get-winbin" />
15 <antcall target="insert-windows-perl"><param name="todir" value="compiled/bin/windows"/></antcall>
16 <antcall target="compile-c-code" />
17
18 <!-- linux only -->
19 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
20 <antcall target="add-static-to-configure-in"/>
21 <antcall target="set-environment-in-packages-configure"/>
22 <antcall target="run-configure"/>
23 <antcall target="makefiles-add-static"/>
24 <!-- make common-src and reconfigure -->
25 <!-- this is a workaround to a problem with the gsdl build code -->
26 <!-- expat needs to be compiled before the perl XML Parser is configured -->
27 <antcall target="make-common-src"/>
28 <antcall target="run-configure"/>
29 <!-- end of workaround -->
30 <antcall target="run-make"/>
31 <antcall target="run-make-install"/>
32 <antcall target="run-make-apache-for-dist"/>
33 <antcall target="strip-execs"/>
34
35 <!-- mac only -->
36 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
37 <antcall target="run-configure"/>
38 <antcall target="tweak-makefiles"/>
39 <!-- make common-src and reconfigure -->
40 <!-- this is a workaround to a problem with the gsdl build code -->
41 <!-- expat needs to be compiled before the perl XML Parser is configured -->
42 <antcall target="make-common-src"/>
43 <antcall target="run-configure"/>
44 <!-- end of workaround -->
45 <antcall target="run-make"/>
46 <antcall target="run-make-install"/>
47 <antcall target="run-make-apache-for-dist"/>
48 <antcall target="strip-execs"/>
49
50 </if></else></if></else></if>
51
52 <!-- gli -->
53 <antcall target="compile-gli">
54 <param name="glibasedir" value="${basedir}/compiled/gli"/>
55 <param name="gsdlbasedir" value="${basedir}/compiled"/>
56 </antcall>
57
58 <!-- uninstaller -->
59 <antcall target="compile-uninstaller" />
60
61 <!-- build collections -->
62 <antcall target="build-demo-collection" />
63
64 </target>
65
66 <target name="add-static-to-configure-in">
67 <rsr
68 file="${basedir}/compiled/configure.in"
69 pattern="^LDFLAGS=.*$"
70 replacement="LDFLAGS=-static" />
71 <exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure"><arg value="configure.in"/></exec>
72 </target>
73
74 <target name="set-environment-in-packages-configure">
75 <rsr
76 file="${basedir}/compiled/common-src/packages/configure"
77 pattern="^ENVIRONMENT=.*$"
78 replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;" />
79 <rsr
80 file="${basedir}/compiled/build-src/packages/configure"
81 pattern="^ENVIRONMENT=.*$"
82 replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;" />
83 </target>
84
85 <target name="run-configure">
86 <!-- linux -->
87 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
88 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
89 <arg line="--enable-apache-httpd"/>
90 <env key="LDFLAGS" value="-static"/>
91 </exec>
92
93 <!-- mac -->
94 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
95 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure">
96 <arg value="--enable-apache-httpd"/>
97 </exec>
98
99 <else>
100 <fail>This target does not support this rk.os: ${rk.os}</fail>
101
102 </else></if></else></if>
103 </target>
104
105 <target name="makefiles-add-static">
106 <rsr
107 file="${basedir}/compiled/build-src/packages/wv/wv-gs/Makefile"
108 pattern="^LDFLAGS =.*$"
109 replacement="LDFLAGS = -static" />
110 <rsr
111 file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile"
112 pattern="^LDFLAGS =.*$"
113 replacement="LDFLAGS = -static" />
114 <rsr
115 file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile"
116 pattern="^LDFLAGS =.*$"
117 replacement="LDFLAGS = -static" />
118 <rsr
119 file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile"
120 pattern="(-o rtftohtml.{2}EXEEXT.{1})"
121 replacement="$1 -static" />
122 </target>
123
124 <target name="run-make">
125 <exec dir="${basedir}/compiled" executable="make" failonerror="true"/>
126 </target>
127
128 <target name="run-make-install">
129 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
130 </target>
131
132 <target name="run-make-apache-for-dist">
133 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
134 </target>
135
136 <target name="strip-execs">
137 <exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
138 <arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
139 </exec>
140 </target>
141
142 <target name="build-demo-collection">
143
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="${rk.home}/kits/rk2/resources/build-demo.sh" failonerror="true"/>
147
148 <!-- windows -->
149 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
150 <!-- the envs on these execs simulate the environment when you run setup.bat -->
151 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl.exe">
152 <arg line="bin\script\import.pl --removeold demo"/>
153 <env key="GSDLHOME" value="${basedir}/compiled"/>
154 <env key="GSDLCOLLECTDIR" value="${basedir}/compiled/collect"/>
155 <env key="GSDLOS" value="windows"/>
156 <env key="PATH" value="${basedir}\compiled\bin\windows\perl\bin;${basedir}\compiled\bin\windows;${basedir}\compiled\bin\script"/>
157 </exec>
158 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl.exe">
159 <arg line="bin\script\buildcol.pl --removeold demo"/>
160 <env key="GSDLHOME" value="${basedir}/compiled"/>
161 <env key="GSDLCOLLECTDIR" value="${basedir}/compiled/collect"/>
162 <env key="GSDLOS" value="windows"/>
163 <env key="PATH" value="${basedir}\compiled\bin\windows\perl\bin;${basedir}\compiled\bin\windows;${basedir}\compiled\bin\script"/>
164 </exec>
165 <delete dir="${basedir}/compiled/collect/demo/index"/>
166 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
167
168 <else>
169 <fail>This target does not support the current rk.os: ${rk.os}</fail>
170
171 </else></if></else></if>
172
173 </target>
174
175 <target name="tweak-makefiles">
176 <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" />
177 <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" />
178 </target>
179
180 <target name="unzip-packages">
181 <unzip src="${basedir}/compiled/common-src/packages/windows/crypt/crypt.zip" dest="${basedir}/compiled/common-src/packages/windows/crypt"/>
182 <unzip src="${basedir}/compiled/common-src/packages/windows/expat/expat.zip" dest="${basedir}/compiled/common-src/packages/windows/expat"/>
183 <unzip src="${basedir}/compiled/common-src/packages/windows/stlport/stlport.zip" dest="${basedir}/compiled/common-src/packages/windows/stlport"/>
184 <unzip src="${basedir}/compiled/common-src/indexers/packages/windows/iconv/iconv.zip" dest="${basedir}/compiled/common-src/indexers/packages/windows/iconv"/>
185 <untar src="${basedir}/compiled/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/compiled/common-src/packages/sqlite" compression="gzip"/>
186 </target>
187
188 <target name="get-winbin">
189 <if>
190 <bool><not><available file="${basedir}/compiled/bin/windows"/></not></bool>
191 <svn><export srcUrl="${svn.root}/main/${branch.path}/binaries/windows/bin" destPath="${basedir}/compiled/bin/windows" revision="${branch.revision}"/></svn>
192 </if>
193 </target>
194
195 <target name="compile-c-code">
196 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
197 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
198 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
199 <mkdir dir="products"/>
200 <copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}.exe"/>
201 <move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
202 </target>
203
204 <target name="drop-in-docs">
205 <echo level="info">Dropping gsdl docs into distribution</echo>
206 <copy todir="${gsdl.basedir}" overwrite="true">
207 <fileset dir="${rk.home}/shared/greenstone2/docs" excludes="READMEar.txt,READMEes.txt,READMEfr.txt,READMEru.txt"/>
208 </copy>
209 </target>
210
211
212</project>
Note: See TracBrowser for help on using the repository browser.