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

Revision 16684, 5.6 KB (checked in by oranfry, 12 years ago)

getting rid of unneeded if wrappers to each target as hacked ant now takes care of that, and replacing calls to custom task addressed calls to builtin antcall, which has been hacked in ant

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}/packages/search4j/libsearch4j.cpp" overwrite="true" />
15        <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/packages/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 todir="${basedir}/wrapped-installer/build" file="${basedir}/installer/greenstone3.jar"/>
20        <copy todir="${basedir}/wrapped-installer/build" file="${basedir}/installer/greenstone3-with-java.jar"/>
21
22        <!-- substitute the real java installer filename and min version into various files -->
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="greenstone3"/>
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        <echo level="info">create an object file (extension .o) for each file to bundle</echo>
32        <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
33            <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_jar_start=greenstone3jar --readonly-text greenstone3.jar greenstone3.jar.o"/>
34        </exec>
35        <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
36            <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"/>
37        </exec>
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
43        <!-- get size of greenstone.jar -->
44        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3.jar.ls"><arg line="-l greenstone3.jar"/></exec>
45        <exec executable="sed" inputstring="${greenstone3.jar.ls}" outputproperty="greenstone3.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
46
47        <!-- get size of greenstone-with-java.jar -->
48        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3-with-java.jar.ls"><arg line="-l greenstone3-with-java.jar"/></exec>
49        <exec executable="sed" inputstring="${greenstone3-with-java.jar.ls}" outputproperty="greenstone3-with-java.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
50
51        <!-- get size of java -->
52        <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${linux-java.installer}"/></exec>
53        <exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
54
55
56        <echo level="info">creating the header file for no java version</echo>
57        <delete file="wrapper.h"/>
58        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone3jar[${greenstone3.jar.size}];"/></exec>
59
60        <echo level="info">compile the wrapper program</echo>
61        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
62            <arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
63        </exec>
64
65        <echo level="info">compile libsearch4j</echo>
66        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
67            <arg line="-Wall -static -static-libgcc -c -o libsearch4j.o libsearch4j.cpp"/>
68        </exec>
69
70        <echo level="info">link, bundling the files to be bundled</echo>
71        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
72            <arg line="-static -static-libgcc -o  ../greenstone-${version}-linux.bin wrapper.o libsearch4j.o greenstone3.jar.o"/>
73        </exec>
74
75
76        <echo level="info">creating the header file for bundled java version</echo>
77        <delete file="wrapper.h"/>
78        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone3jar[${greenstone3-with-java.jar.size}];"/></exec>
79        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="extern const char java[${java.size}];"/></exec>
80        <exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="#define java_is_bundled yes"/></exec>
81
82        <echo level="info">recompile the wrapper program</echo>
83        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
84            <arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
85        </exec>
86
87        <echo level="info">relink, bundling the files to be bundled</echo>
88        <exec executable="g++" dir="${basedir}/wrapped-installer/build">
89            <arg line="-static -static-libgcc -o  ../greenstone-${version}-linux-with-java.bin wrapper.o libsearch4j.o greenstone3-with-java.jar.o java.o"/>
90        </exec>
91
92    </target>
93
94</project>
Note: See TracBrowser for help on using the browser.