root/release-kits/wirk3/ant-scripts/wrap.xml @ 17268

Revision 17268, 4.9 KB (checked in by oranfry, 11 years ago)

compile search4j in release process and started standardising java installtion

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="wirk3-wrap" default="wrap">
3
4    <target name="wrap">
5        <antcall target="copy-files-for-wrapping"/>
6        <antcall target="tweak-files-for-wrapping"/>
7        <antcall target="compile-resources"/>
8        <antcall target="compile-wrapper"/>
9        <antcall target="link-wrapper-no-java"/>
10        <antcall target="link-wrapper-with-java"/>
11    </target>
12
13    <target name="copy-files-for-wrapping">
14        <echo>Copying wrapper source files</echo>
15        <mkdir dir="${basedir}/wrapped-installer/build"/>
16        <copy todir="${basedir}/wrapped-installer/build" file="${wirk3.home}/windows/wrapper/wrapper.cpp"/>
17        <copy todir="${basedir}/wrapped-installer/build" file="${wirk3.home}/packages/search4j/libsearch4j.cpp"/>
18        <copy todir="${basedir}/wrapped-installer/build" file="${wirk3.home}/packages/search4j/libsearch4j.h"/>
19    </target>
20   
21    <target name="tweak-files-for-wrapping">
22        <echo>Substituting concrete values into source files</echo>
23        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
24        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.installer@" replacement="${windows-java.installer}"/>
25        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.extracted@" replacement="${windows-java.extracted}"/>
26        <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@bundled.version.java@" replacement="${bundled.version.windows-java}"/>
27    </target>
28
29    <target name="compile-resources">
30        <if>
31            <bool>
32                <not>
33                    <uptodate targetfile="${basedir}/wrapped-installer/build/wrapper.RES">
34                        <srcfiles dir="${wirk3.home}/greenstone3/icon" includes="icon.ico"/>
35                        <srcfiles dir="${wirk3.home}/windows/wrapper" includes="${windows-java.installer}"/>
36                        <srcfiles dir="${wirk3.home}/windows/wrapper" includes="*.bmp"/>
37                        <srcfiles dir="${wirk3.home}/windows/wrapper" includes="*.rc"/>
38                        <srcfiles dir="${wirk3.home}/greenstone3/wrapper" includes="*.bmp"/>
39                        <srcfiles dir="${basedir}/installer" includes="greenstone3.jar"/>
40                    </uptodate>
41                </not>
42            </bool>
43           
44            <echo>Compiling resources</echo>
45           
46            <echo>getting the template resource script</echo>
47            <copy todir="${basedir}/wrapped-installer/build" file="${wirk3.home}/windows/wrapper/wrapper.rc" overwrite="true"/>
48           
49            <echo>copying the small resource files into place</echo>
50            <copy todir="${basedir}/wrapped-installer/build">
51                <fileset dir="${wirk3.home}/windows/wrapper" includes="*.bmp"/>
52                <fileset dir="${wirk3.home}/greenstone3/wrapper" includes="*.bmp"/>
53                <fileset dir="${wirk3.home}/greenstone3/icon" includes="icon.ico"/>
54            </copy>
55           
56            <echo>adding greenstone3.jar to the resource script as chunks</echo>
57            <rsplit
58                resource="${basedir}/installer/greenstone-${version}-win32.jar"
59                outputDir="${basedir}/wrapped-installer/build"
60                resourceScript="${basedir}/wrapped-installer/build/wrapper.rc"
61                resourceName="JAR"
62                resourceType="JAR"
63                chunkSize="${resources.chunksize}"
64                />
65       
66            <echo>resource compiling the resource script</echo>
67            <exec executable="rc" dir="${basedir}/wrapped-installer/build">
68                <arg line="wrapper.rc"/>
69            </exec>
70           
71            <echo>making a copy of the resource script</echo>
72            <copy file="${basedir}/wrapped-installer/build/wrapper.rc" tofile="${basedir}/wrapped-installer/build/wrapper-with-jre.rc"/>
73           
74            <echo>adding ${windows-java.installer} to the copy as chunks</echo>
75            <rsplit
76                resource="${wirk3.home}/windows/wrapper/${windows-java.installer}"
77                outputDir="${basedir}/wrapped-installer/build"                 
78                resourceScript="${basedir}/wrapped-installer/build/wrapper-with-jre.rc"
79                resourceName="JAVA"
80                resourceType="EXE"
81                chunkSize="${resources.chunksize}"
82                />
83
84            <echo>resource compiling the generated resource script again</echo>
85            <exec executable="rc" dir="${basedir}/wrapped-installer/build">
86                <arg line="wrapper-with-jre.rc"/>
87            </exec>
88           
89            <else>
90                <echo>Resourses are up-to-date, will not compile</echo>
91            </else>
92        </if>
93    </target>
94
95    <target name="compile-wrapper">
96        <exec executable="cl" dir="${basedir}/wrapped-installer/build">
97            <arg line="/c -GX /DWINDOWS=yes libsearch4j.cpp /out:libsearch4j.obj"/>
98        </exec>
99
100        <exec executable="cl" dir="${basedir}/wrapped-installer/build">
101            <arg line="/c -GX /DWINDOWS=yes wrapper.cpp /out:wrapper.obj"/>
102        </exec>
103    </target>
104   
105    <target name="link-wrapper-no-java">
106        <exec executable="link" dir="${basedir}/wrapped-installer/build">
107            <arg line="/OUT:..\greenstone-${version}-win32.exe gdi32.lib advapi32.lib shell32.lib user32.lib libsearch4j.obj wrapper.obj wrapper.res"/>
108        </exec>
109    </target>
110
111    <target name="link-wrapper-with-java">
112        <exec executable="link" dir="${basedir}/wrapped-installer/build">
113            <arg line="/OUT:..\greenstone-${version}-win32-with-java.exe gdi32.lib advapi32.lib shell32.lib user32.lib libsearch4j.obj wrapper.obj wrapper-with-jre.res"/>
114        </exec>
115    </target>
116
117</project>
Note: See TracBrowser for help on using the browser.