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

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

changes to wirk3 after ant cleaned up

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