root/release-kits/lirk2/ant-scripts/wrap.xml @ 18500

Revision 18500, 4.0 KB (checked in by oranfry, 11 years ago)

changing release kits to put all products in a products directory

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="lirk2-wrap" default="wrap">
3
4    <target name="wrap">
5        <antcall target="setup-for-wrapping"/>
6        <antcall target="compile-wrapper"/>
7    </target>
8
9
10    <target name="setup-for-wrapping">
11
12        <!-- create and setup the build directory -->
13        <mkdir dir="${basedir}/wrapped-installer/build"/>
14        <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/linux/wrapper.cpp"/>
15        <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/packages/search4j/libsearch4j.cpp"/>
16        <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/packages/search4j/libsearch4j.h"/>
17
18        <!-- copy bundled files -->
19        <copy todir="${basedir}/wrapped-installer/build" file="${lirk2.home}/linux/${linux-java.installer}"/>
20        <copy tofile="${basedir}/wrapped-installer/build/greenstone2.jar" file="${basedir}/installer/Greenstone-${version}-linux.jar"/>
21
22        <!-- substitute in real values -->
23        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.installer@" replacement="${linux-java.installer}"/>
24        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@installer.name@" replacement="greenstone2"/>
25        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.extracted@" replacement="${linux-java.extracted}"/>
26        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
27
28    </target>
29
30    <target name="compile-wrapper">
31
32        <echo level="info">create an object file (extension .o) for each file to bundle</echo>
33        <!-- jar -->
34        <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
35            <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone2_jar_start=greenstone2jar --readonly-text greenstone2.jar greenstone2.jar.o"/>
36        </exec>
37        <!-- java -->
38        <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
39            <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_${linux-java.installer}_start=java --readonly-text ${linux-java.installer} java.o"/>
40        </exec>
41
42        <echo level="info">working out the size of the objects</echo>
43        <!-- jar -->
44        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone2.jar.ls"><arg line="-l greenstone2.jar"/></exec>
45        <exec executable="sed" inputstring="${greenstone2.jar.ls}" outputproperty="greenstone2.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
46
47        <!-- java -->
48        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${linux-java.installer}"/></exec>
49        <exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
50
51        <echo level="info">creating wrapper header file</echo>
52        <delete file="wrapper.h"/>
53        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone2jar[${greenstone2.jar.size}];"/></exec>
54        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="extern const char java[${java.size}];"/></exec>
55        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="#define java_is_bundled yes"/></exec>
56
57        <echo level="info">compile libsearch4j</echo>
58        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
59            <arg line="-Wall -static -static-libgcc -c -o libsearch4j.o libsearch4j.cpp"/>
60        </exec>
61
62        <echo level="info">compile the wrapper program</echo>
63        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
64            <arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
65        </exec>
66
67        <echo level="info">link the compiled code and bundled files</echo>
68        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
69            <arg line="-static -static-libgcc -o ../../products/Greenstone-${version}-linux.bin wrapper.o libsearch4j.o greenstone2.jar.o java.o"/>
70        </exec>
71
72    </target>
73
74</project>
Note: See TracBrowser for help on using the browser.