source: release-kits/lirk3/ant-scripts/wrap.xml@ 15205

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

some updates to make the release kit produce nicer installers

File size: 6.5 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2
3<!--
4 ..........................................................
5 September 2007
6 Greenstone3 'release maker' script
7 Oran Fry
8 ..........................................................
9-->
10
11<project name="lirk3-wrap" default="wrap">
12
13 <target name="wrap">
14 <addressedcall target="setup-for-wrapping"/>
15 <addressedcall target="compile-wrapper"/>
16 <addressedcall target="clean-up-after-wrapping"/>
17 </target>
18
19
20 <target name="setup-for-wrapping">
21 <if><bool><istrue value="${execute}"/></bool>
22
23 <!-- create and setup the build directory -->
24 <mkdir dir="${basedir}/wrapped-installer/build"/>
25 <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/wrapper/mywrapper.c"/>
26
27 <!-- copy bundled files -->
28 <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/search4j/search4j"/>
29 <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/wrapper/${java.installer}"/>
30 <copy todir="${basedir}/wrapped-installer/build" file="${basedir}/installer/greenstone3.jar"/>
31 <copy todir="${basedir}/wrapped-installer/build" file="${basedir}/installer/greenstone3-with-java.jar"/>
32
33 <!-- substitute the real java installer filename and min version into various files -->
34 <rsr file="${basedir}/wrapped-installer/build/mywrapper.c" pattern="@java.installer@" replacement="${java.installer}"/>
35 <rsr file="${basedir}/wrapped-installer/build/mywrapper.c" pattern="@java.extracted@" replacement="${java.extracted}"/>
36 <rsr file="${basedir}/wrapped-installer/build/mywrapper.c" pattern="@java.min.version@" replacement="${java.min.version}"/>
37
38 </if>
39 </target>
40
41 <target name="compile-wrapper">
42 <if><bool><istrue value="${execute}"/></bool>
43
44 <echo level="info">create an object file (extension .o) for each file to bundle</echo>
45 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
46 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_jar_start=greenstone3jar --readonly-text greenstone3.jar greenstone3.jar.o"/>
47 </exec>
48 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
49 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_with_java_jar_start=greenstone3jar --readonly-text greenstone3-with-java.jar greenstone3-with-java.jar.o"/>
50 </exec>
51 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
52 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_search4j_start=search4j --readonly-text search4j search4j.o"/>
53 </exec>
54 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
55 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_${java.installer}_start=java --readonly-text ${java.installer} java.o"/>
56 </exec>
57
58
59 <!-- get size of greenstone.jar -->
60 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3.jar.ls"><arg line="-l greenstone3.jar"/></exec>
61 <exec executable="sed" inputstring="${greenstone3.jar.ls}" outputproperty="greenstone3.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
62
63 <!-- get size of greenstone-with-java.jar -->
64 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3-with-java.jar.ls"><arg line="-l greenstone3-with-java.jar"/></exec>
65 <exec executable="sed" inputstring="${greenstone3-with-java.jar.ls}" outputproperty="greenstone3-with-java.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
66
67 <!-- get size of search4j -->
68 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="search4j.ls"><arg line="-l search4j"/></exec>
69 <exec executable="sed" inputstring="${search4j.ls}" outputproperty="search4j.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
70
71 <!-- get size of java -->
72 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${java.installer}"/></exec>
73 <exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
74
75
76 <echo level="info">creating the header file for no java version</echo>
77 <delete file="mywrapper.h"/>
78 <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h"><arg line="extern const char greenstone3jar[${greenstone3.jar.size}];"/></exec>
79 <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="extern const char search4j[${search4j.size}];"/></exec>
80
81 <echo level="info">compile the wrapper program</echo>
82 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
83 <arg line="-Wall -static -static-libgcc -c -o mywrapper.o mywrapper.c"/>
84 </exec>
85
86 <echo level="info">link, bundling the files to be bundled</echo>
87 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
88 <arg line="-static -static-libgcc -o ../greenstone-${version}-linux.bin mywrapper.o greenstone3.jar.o search4j.o"/>
89 </exec>
90
91
92 <echo level="info">creating the header file for bundled java version</echo>
93 <delete file="mywrapper.h"/>
94 <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h"><arg line="extern const char greenstone3jar[${greenstone3-with-java.jar.size}];"/></exec>
95 <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="extern const char search4j[${search4j.size}];"/></exec>
96 <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="extern const char java[${java.size}];"/></exec>
97 <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="#define java_is_bundled yes"/></exec>
98
99 <echo level="info">recompile the wrapper program</echo>
100 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
101 <arg line="-Wall -static -static-libgcc -c -o mywrapper.o mywrapper.c"/>
102 </exec>
103
104 <echo level="info">relink, bundling the files to be bundled</echo>
105 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
106 <arg line="-static -static-libgcc -o ../greenstone-${version}-linux-with-java.bin mywrapper.o greenstone3-with-java.jar.o search4j.o java.o"/>
107 </exec>
108
109
110
111 </if>
112 </target>
113
114 <target name="clean-up-after-wrapping">
115 <if><bool><istrue value="${execute}"/></bool>
116 <delete dir="${basedir}/wrapped-installer/build"/>
117 </if>
118 </target>
119
120
121
122</project>
Note: See TracBrowser for help on using the repository browser.