root/release-kits/wirk2/ant-scripts/wrap.xml @ 17633

Revision 17378, 4.2 KB (checked in by oranfry, 12 years ago)

use the individually zipped components instead of loose files

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