root/release-kits/lirk3/ant-scripts/wrap.xml @ 19008

Revision 19008, 4.1 KB (checked in by oranfry, 12 years ago)

more changes for the new shared code layout

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="lirk3-wrap" default="wrap">
3
4    <target name="wrap">
5        <antcall target="setup-for-wrapping"/>
6        <antcall target="compile-wrapper"/>
7    </target>
8
9    <target name="setup-for-wrapping">
10
11        <!-- create and setup the build directory -->
12        <mkdir dir="${basedir}/wrapped-installer/build"/>
13        <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/linux/wrapper.cpp" overwrite="true" />
14        <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/core/search4j/libsearch4j.cpp" overwrite="true" />
15        <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/core/search4j/libsearch4j.h" overwrite="true" />
16
17        <!-- copy bundled files -->
18        <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/linux/${linux-java.installer}"/>
19        <copy tofile="${basedir}/wrapped-installer/build/greenstone3.jar" file="${basedir}/installer/Greenstone-${version}-${os.suffix}.jar"/>
20
21        <!-- substitute the real java installer filename and min version into various files -->
22        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.installer@" replacement="${linux-java.installer}"/>
23        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@installer.name@" replacement="greenstone3"/>
24        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.extracted@" replacement="${linux-java.extracted}"/>
25        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
26
27    </target>
28
29    <target name="compile-wrapper">
30        <echo level="info">create an object file (extension .o) for each file to bundle</echo>
31        <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
32            <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_jar_start=greenstone3jar --readonly-text greenstone3.jar greenstone3.jar.o"/>
33        </exec>
34        <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
35            <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_${linux-java.installer}_start=java --readonly-text ${linux-java.installer} java.o"/>
36        </exec>
37
38        <!-- get size of greenstone.jar -->
39        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3.jar.ls"><arg line="-l greenstone3.jar"/></exec>
40        <exec executable="sed" inputstring="${greenstone3.jar.ls}" outputproperty="greenstone3.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
41
42        <!-- get size of java -->
43        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${linux-java.installer}"/></exec>
44        <exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
45
46        <echo level="info">compile libsearch4j</echo>
47        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
48            <arg line="-Wall -static -static-libgcc -c -o libsearch4j.o libsearch4j.cpp"/>
49        </exec>
50
51        <echo level="info">creating the header file for bundled java version</echo>
52        <delete file="wrapper.h"/>
53        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone3jar[${greenstone3.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">recompile the wrapper program</echo>
58        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
59            <arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
60        </exec>
61
62        <echo level="info">relink, bundling the files to be bundled</echo>
63        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
64            <arg line="-static -static-libgcc -o  ../../products/Greenstone-${version}-${os.suffix}.bin wrapper.o libsearch4j.o greenstone3.jar.o java.o"/>
65        </exec>
66
67    </target>
68
69</project>
Note: See TracBrowser for help on using the browser.