source: release-kits/wirk2/ant-scripts/wrap.xml@ 16745

Last change on this file since 16745 was 16745, checked in by oranfry, 13 years ago

changes to wirk2 after ant cleaned up

File size: 5.0 KB
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-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="${wirk2.home}/windows/wrapper/wrapper.cpp" overwrite="true"/>
19 <copy todir="${basedir}/wrapped-installer/build" file="${wirk2.home}/packages/search4j/libsearch4j.cpp" overwrite="true"/>
20 <copy todir="${basedir}/wrapped-installer/build" file="${wirk2.home}/packages/search4j/libsearch4j.h" overwrite="true"/>
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.installer@" replacement="${windows-java.installer}"/>
27 <rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
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="${wirk2.home}/greenstone2/icon" includes="gs2.ico"/>
37 <srcfiles dir="${wirk2.home}/windows/wrapper" includes="${windows-java.installer}"/>
38 <srcfiles dir="${wirk2.home}/windows/wrapper" includes="*.bmp"/>
39 <srcfiles dir="${wirk2.home}/greenstone2/wrapper" includes="*.bmp"/>
40 <srcfiles dir="${wirk2.home}/windows/wrapper" includes="*.rc"/>
41 <srcfiles dir="${basedir}/installer" includes="greenstone2.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="${wirk2.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" overwrite="true">
53 <fileset dir="${wirk2.home}/windows/wrapper" includes="*.bmp"/>
54 <fileset dir="${wirk2.home}/greenstone2/wrapper" includes="*.bmp"/>
55 <fileset dir="${wirk2.home}/greenstone2/icon" includes="icon.ico"/>
56 </copy>
57
58 <echo>adding greenstone2.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" overwrite="true"/>
75
76 <echo>adding ${windows-java.installer} to the copy as chunks</echo>
77 <rsplit
78 resource="${wirk2.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 repository browser.