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

Revision 16245, 5.4 KB (checked in by oranfry, 12 years ago)

change from gs3.ico -> icon.ico and set date

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