source: release-kits/lirk2/ant-scripts/wrap.xml@ 15980

Last change on this file since 15980 was 15980, checked in by oranfry, 13 years ago

have lirk2 get the linux general stuff

File size: 6.3 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="lirk2-wrap" default="wrap">
12
13 <target name="wrap">
14 <addressedcall target="setup-for-wrapping"/>
15 <addressedcall target="compile-wrapper"/>
16 </target>
17
18
19 <target name="setup-for-wrapping">
20 <if><bool><istrue value="${execute}"/></bool>
21
22 <!-- create and setup the build directory -->
23 <mkdir dir="${basedir}/wrapped-installer/build"/>
24 <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/linux/wrapper.cpp"/>
25
26 <!-- copy bundled files -->
27 <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/search4j/search4j"/>
28 <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/wrapper/${java.installer}"/>
29 <copy tofile="${basedir}/wrapped-installer/build/greenstone2.jar" file="${basedir}/installer/gsdl-${version}-linux.jar"/>
30 <copy tofile="${basedir}/wrapped-installer/build/greenstone2-with-java.jar" file="${basedir}/installer/gsdl-${version}-linux-with-java.jar"/>
31
32 <!-- substitute in real values -->
33 <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.installer@" replacement="${java.installer}"/>
34 <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.extracted@" replacement="${java.extracted}"/>
35 <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
36
37 </if>
38 </target>
39
40 <target name="compile-wrapper">
41 <if><bool><istrue value="${execute}"/></bool>
42
43 <echo level="info">create an object file (extension .o) for each file to bundle</echo>
44 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
45 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone2_jar_start=greenstone2jar --readonly-text greenstone2.jar greenstone2.jar.o"/>
46 </exec>
47 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
48 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone2_with_java_jar_start=greenstone2jar --readonly-text greenstone2-with-java.jar greenstone2-with-java.jar.o"/>
49 </exec>
50 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
51 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_search4j_start=search4j --readonly-text search4j search4j.o"/>
52 </exec>
53 <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
54 <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_${java.installer}_start=java --readonly-text ${java.installer} java.o"/>
55 </exec>
56
57 <!-- get size of greenstone.jar -->
58 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone2.jar.ls"><arg line="-l greenstone2.jar"/></exec>
59 <exec executable="sed" inputstring="${greenstone2.jar.ls}" outputproperty="greenstone2.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
60
61 <!-- get size of greenstone-with-java.jar -->
62 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone2-with-java.jar.ls"><arg line="-l greenstone2-with-java.jar"/></exec>
63 <exec executable="sed" inputstring="${greenstone2-with-java.jar.ls}" outputproperty="greenstone2-with-java.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
64
65 <!-- get size of search4j -->
66 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="search4j.ls"><arg line="-l search4j"/></exec>
67 <exec executable="sed" inputstring="${search4j.ls}" outputproperty="search4j.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
68
69 <!-- get size of java -->
70 <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${java.installer}"/></exec>
71 <exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
72
73 <echo level="info">creating the header file for no java version</echo>
74 <delete file="wrapper.h"/>
75 <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone2jar[${greenstone2.jar.size}];"/></exec>
76 <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="extern const char search4j[${search4j.size}];"/></exec>
77
78 <echo level="info">compile the wrapper program</echo>
79 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
80 <arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
81 </exec>
82
83 <echo level="info">link, bundling the files to be bundled</echo>
84 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
85 <arg line="-static -static-libgcc -o ../greenstone-${version}-linux.bin wrapper.o greenstone2.jar.o search4j.o"/>
86 </exec>
87
88 <echo level="info">creating the header file for bundled java version</echo>
89 <delete file="wrapper.h"/>
90 <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone2jar[${greenstone2-with-java.jar.size}];"/></exec>
91 <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="extern const char search4j[${search4j.size}];"/></exec>
92 <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="extern const char java[${java.size}];"/></exec>
93 <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="#define java_is_bundled yes"/></exec>
94
95 <echo level="info">recompile the wrapper program</echo>
96 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
97 <arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
98 </exec>
99
100 <echo level="info">relink, bundling the files to be bundled</echo>
101 <exec executable="g++" dir="${basedir}/wrapped-installer/build">
102 <arg line="-static -static-libgcc -o ../greenstone-${version}-linux-with-java.bin wrapper.o greenstone2-with-java.jar.o search4j.o java.o"/>
103 </exec>
104
105 </if>
106 </target>
107
108</project>
Note: See TracBrowser for help on using the repository browser.