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

Revision 19008, 4.3 KB (checked in by oranfry, 11 years ago)

more changes for the new shared code layout

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}/core/search4j/libsearch4j.cpp" overwrite="true"/>
19        <copy todir="${basedir}/wrapped-installer/build" file="${wirk2.home}/core/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        <!--
35        <if>
36            <bool>
37                <not>
38                    <uptodate targetfile="${basedir}/wrapped-installer/build/wrapper.RES">
39                        <srcfiles dir="${wirk2.home}/greenstone2/icon" includes="icon.ico"/>
40                        <srcfiles dir="${wirk2.home}/windows/wrapper" includes="${windows-java.installer}"/>
41                        <srcfiles dir="${wirk2.home}/windows/wrapper" includes="*.bmp"/>
42                        <srcfiles dir="${wirk2.home}/greenstone2/wrapper" includes="*.bmp"/>
43                        <srcfiles dir="${wirk2.home}/windows/wrapper" includes="*.rc"/>
44                        <srcfiles dir="${wirk2.home}/core/language-strings" includes="*.properties"/>
45                        <srcfiles dir="${basedir}/installer" includes="Greenstone-${version}-win32.jar"/>
46                    </uptodate>
47                </not>
48            </bool>
49        -->
50           
51            <echo>Compiling resources</echo>
52           
53            <echo>getting the template resource script</echo>
54            <copy todir="${basedir}/wrapped-installer/build" file="${wirk2.home}/windows/wrapper/wrapper.rc" overwrite="true"/>
55           
56            <echo>copying the small resource files into place</echo>
57            <copy todir="${basedir}/wrapped-installer/build" overwrite="true">
58                <fileset dir="${wirk2.home}/windows/wrapper" includes="*.bmp"/>
59                <fileset dir="${wirk2.home}/greenstone2/wrapper" includes="*.bmp"/>
60                <fileset dir="${wirk2.home}/greenstone2/icon" includes="icon.ico"/>
61            </copy>
62           
63            <echo>adding greenstone2.jar to the resource script as chunks</echo>
64            <rsplit
65                resource="${basedir}/installer/Greenstone-${version}-win32.jar"
66                outputDir="${basedir}/wrapped-installer/build"
67                resourceScript="${basedir}/wrapped-installer/build/wrapper.rc"
68                resourceName="JAR"
69                resourceType="JAR"
70                chunkSize="${resources.chunksize}"
71                />
72           
73            <echo>adding ${windows-java.installer} to the copy as chunks</echo>
74            <rsplit
75                resource="${wirk2.home}/windows/wrapper/${windows-java.installer}"
76                outputDir="${basedir}/wrapped-installer/build"                 
77                resourceScript="${basedir}/wrapped-installer/build/wrapper.rc"
78                resourceName="JAVA"
79                resourceType="EXE"
80                chunkSize="${resources.chunksize}"/>
81           
82            <echo>resource compiling the generated resource script</echo>
83            <exec executable="rc" dir="${basedir}/wrapped-installer/build">
84                <arg line="wrapper.rc"/>
85            </exec>
86           
87        <!--
88            <else>
89                <echo>Resourses are up-to-date, will not compile</echo>
90            </else>
91        </if>
92        -->
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">
106        <exec executable="link" dir="${basedir}/wrapped-installer/build">
107            <arg line="/OUT:..\..\products\Greenstone-${version}-win32.exe gdi32.lib advapi32.lib shell32.lib user32.lib libsearch4j.obj wrapper.obj wrapper.res"/>
108        </exec>
109    </target>
110
111</project>
Note: See TracBrowser for help on using the browser.