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

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