Tweak configure.sh script to pick up newest version of configure classes.
[jnode:svn-mirror.git] / all / build-x86.xml
1 <project name="JNode-x86" default="all" basedir=".">
2
3         <property name="my-build.dir" value="${build.dir}/x86" />
4         <property name="my-lib.dir" value="${basedir}/lib/x86" />
5         <property name="my-conf.dir" value="${basedir}/conf/x86" />
6
7         <property name="src.native.dir" value="${root.dir}/core/src/native" />
8         <property name="build.netboot.dir" value="${my-build.dir}/netboot" />
9         <property name="jnode.disk" value="${my-build.dir}/jnodedisk${jnode.bits}.dat" />
10         <property name="jnode.disk.pln" value="${my-build.dir}/jnodedisk${jnode.bits}.pln" />
11         <property name="jnode.disk.geometry" value="64/16/63" />
12
13         <property name="jnode.virtual.memsize" value="512" />
14         <property name="logFile" value="${build.dir}/debugger.txt" />
15
16         <property name="grub-ver" value="grub-0.97-i386-pc" />
17         <property name="grub.dir" value="${my-build.dir}/${grub-ver}/boot/grub" />
18         <property name="grub.dist" value="${my-lib.dir}/${grub-ver}.tar.gz" />
19
20         <property name="grub.stage1.name" value="stage1" />
21         <property name="grub.stage2.name" value="stage2" />
22         <property name="grub.menu" value="${my-conf.dir}/menu.lst" />
23         <property name="grub.menu.cdrom" value="${my-conf.dir}/menu-cdrom.lst" />
24
25   <!-- Properties for building the boot files for windows NT/2K/XP -->
26   <property name="jnode.install-nt.dir" value="C:\jnode" />
27   <!-- (hd0,0) stands for harddisk 0, partition 0 -->
28   <property name="partition-nt.grub.menu" value="(hd0,0)" />
29   <!-- patch -->
30   <property name="partition-nt.grub.menu.final" value="${partition-nt.grub.menu}/jnode" />
31   <property name="partition-nt" value="C:" />
32
33         <property name="bin-nt.dir" value="${basedir}\bin-nt" />
34         <property name="conf-nt.dir" value="${basedir}\conf\x86-nt" />
35         <property name="lib-nt.dir" value="${basedir}\lib\x86-nt" />
36
37         <property name="grub.stage1-nt.name" value="stage1-nt" />
38         <property name="grub.stage2-nt.name" value="stage2-nt" />
39
40         <property name="grub.stage1-nt" value="${lib-nt.dir}\${grub.stage1-nt.name}" />
41         <property name="grub.stage2-nt" value="${lib-nt.dir}\${grub.stage2-nt.name}" />
42
43         <property name="grub.install-nt.exe" value="${bin-nt.dir}\grubinstall-nt.exe" />
44         <!-- end of Properties for building the boot files for windows NT/2K/XP -->
45
46         <path id="cp-x86">
47                 <pathelement location="${jnode-mmtk.jar}" />
48                 <pathelement location="${jnode-builder.jar}" />
49                 <pathelement location="${jnode-core.jar}" />
50                 <pathelement location="${jnode-fs.jar}" />
51                 <pathelement location="${jnode-shell.jar}" />
52                 <pathelement location="${jnode-net.jar}" />
53                 <pathelement location="${jnode-gui.jar}" />
54                 <path refid="cp" />
55                 <pathelement location="${my-conf.dir}" />
56                 <pathelement location="${grub.dir}" />
57                 <pathelement location="${descriptors.dir}" />
58                 <pathelement location="${dom4j.jar}" />
59                 <pathelement location="${mmtk.jar}" />
60         </path>
61
62         <target name="test-properties">
63                 <condition property="x86-properties.exists">
64                         <available file="build-x86.properties" />
65                 </condition>
66         </target>
67         <target name="load-properties" if="x86-properties.exists">
68                 <property file="build-x86.properties" />
69         </target>
70         <target name="default-properties" unless="x86-properties.exists">
71                 <property name="jnodedrive.dir" value="${my-build.dir}" />
72         </target>
73
74         <target name="prepare-props" depends="test-properties,load-properties,default-properties">
75                 <property name="jnode.kernel.dir" value="${jnodedrive.dir}" />
76                 <property name="jnode.kernel" value="${jnode.kernel.dir}/jnode${jnode.bits}.gz" />
77                 <property name="jnode.compiler" value="default" />
78
79                 <property name="build.native.dir" value="${my-build.dir}/${jnode.bits}bits/native" />
80                 <property name="build.bootimage.dir" value="${my-build.dir}/${jnode.bits}bits/bootimage" />
81         </target>
82
83         <!-- Initialize all project directories -->
84         <target name="prepare-dirs" depends="prepare-props">
85                 <mkdir dir="${build.native.dir}" />
86                 <mkdir dir="${build.native.dir}/output" />
87                 <mkdir dir="${build.native.dir}/src" />
88                 <mkdir dir="${build.bootimage.dir}" />
89                 <mkdir dir="${build.netboot.dir}" />
90         </target>
91
92         <target name="test-grub">
93                 <available file="${grub.dir}" property="grub.exists" />
94         </target>
95
96         <target name="grub" depends="prepare-dirs,test-grub" unless="grub.exists">
97                 <untar src="${grub.dist}" dest="${my-build.dir}" compression="gzip" />
98         </target>
99
100         <!-- Initialize all project properties -->
101         <target name="prepare" depends="grub">
102                 <copy todir="${grub.dir}">
103                         <fileset dir="${my-lib.dir}">
104                                 <include name="nbgrub-*" />
105                                 <include name="pxegrub-*" />
106                         </fileset>
107                         <fileset dir="${my-conf.dir}">
108                                 <include name="menu-nb.lst" />
109                                 <include name="menu-pxe.lst*" />
110                         </fileset>
111                 </copy>
112         </target>
113
114         <target name="asm-native" depends="prepare">
115                 <taskdef name="genconst" classname="org.jnode.build.x86.AsmConstBuilder" classpathref="cp-x86" />
116                 <taskdef name="asm" classname="org.jnode.ant.taskdefs.Asm" classpathref="cp-x86" />
117
118                 <genconst destfile="${build.native.dir}/src/java.inc" bits="${jnode.bits}" classesURL="file:///${jnode-core.jar}/">
119                         <class classname="java.lang.Throwable" />
120                         <class classname="org.jnode.build.x86.BootImageBuilder" static="on" />
121                         <class classname="org.jnode.vm.SoftByteCodes" static="on" />
122                         <class classname="org.jnode.vm.scheduler.VmProcessor" />
123                         <class classname="org.jnode.vm.scheduler.VmProcessor" static="on" />
124                         <class classname="org.jnode.vm.scheduler.VmThread" />
125                         <class classname="org.jnode.vm.scheduler.VmThread" static="on" />
126                         <class classname="org.jnode.vm.classmgr.ObjectLayout" static="on" />
127                         <class classname="org.jnode.vm.classmgr.TIBLayout" static="on" />
128                         <class classname="org.jnode.vm.classmgr.VmArray" static="on" />
129                         <class classname="org.jnode.vm.classmgr.VmMethod" />
130                         <class classname="org.jnode.vm.classmgr.VmStatics" /> 
131                         <class classname="org.jnode.vm.classmgr.VmType" /> 
132                         <class classname="org.jnode.vm.x86.MSR" />
133                         <class classname="org.jnode.vm.x86.VmX86Processor" />
134                         <class classname="org.jnode.vm.x86.VmX86StackReader" static="on" /> 
135                         <class classname="org.jnode.vm.x86.VmX86Thread" />
136                         <class classname="org.jnode.vm.x86.VmX86Thread" static="on" />
137                         <class classname="org.jnode.vm.x86.VmX86Thread64" />
138                 </genconst>
139
140                 <dependset>
141                         <srcfileset dir="${src.native.dir}/x86" />
142                         <srcfileset dir="${build.native.dir}/src" />
143                         <targetfileset dir="${build.native.dir}/output" />
144                 </dependset>
145
146                 <asm srcdir="${src.native.dir}/x86" 
147                         destdir="${build.native.dir}/output" 
148                         outputFormat="elf" 
149                         extension="o" 
150                         bits="${jnode.bits}" 
151                         listfile="${build.native.dir}/jnodenative.lst"
152                         enablejnasm="${jnode.enable.jnasm}"
153                         version="${jnode-ver} ${TODAY}">
154                                 <includedir dir="${src.native.dir}/x86" />
155                                 <includedir dir="${build.native.dir}/src" />
156                                 <include name="jnode.asm" />
157                 </asm>
158         </target>
159
160         <!-- Build the java object file  -->
161         <target name="java-image" depends="asm-native">
162                 <taskdef name="bootimage" classname="org.jnode.build.x86.BootImageBuilder" classpathref="cp-x86" />
163
164                 <bootimage 
165                         destfile="${build.bootimage.dir}/bootimage.bin" 
166                         listfile="${build.bootimage.dir}/bootimage.lst" 
167                         debugfile="${build.bootimage.dir}/bootimage.debug" 
168                         kernelfile="${build.native.dir}/output/jnode.o" 
169                         pluginList="${system-plugin-list}" 
170                         pluginDir="${plugins.dir}" 
171                         targetArch="x86" 
172                         memMgrPluginId="${jnode.memmgr.plugin.id}" 
173                         cpu="${cpu}" 
174                         version="${jnode-ver}" 
175                         jnodeCompiler="${jnode.compiler}" 
176                         bits="${jnode.bits}"
177                         enableJNasm="${jnode.enable.jnasm}">
178
179                         <nanokernelsources srcfile="${src.native.dir}/x86/jnode.asm">
180                                 <includedir dir="${src.native.dir}/x86" />
181                                 <includedir dir="${build.native.dir}/src" />
182                         </nanokernelsources>
183                         
184             </bootimage>                        
185
186                 <gzip src="${build.bootimage.dir}/bootimage.bin" zipfile="${jnode.kernel}" />
187         </target>
188
189         <!-- Build the boot disk -->
190         <target name="boot-disk" depends="java-image" unless="no.bootdisk">
191                 <taskdef name="bootdisk" classname="org.jnode.build.BootDiskBuilder" classpathref="cp-x86" />
192
193                 <property name="bootdisk.dir" value="${my-build.dir}/${jnode.bits}bits/bootdisk" />
194
195                 <mkdir dir="${bootdisk.dir}" />
196                 <mkdir dir="${bootdisk.dir}/boot/grub" />
197                 <copy file="${jnode.kernel}" todir="${bootdisk.dir}" />
198                 <copy file="${grub.menu}" todir="${bootdisk.dir}/boot/grub" />
199                 <copy todir="${bootdisk.dir}">
200                         <fileset dir="${initjars.dir}">
201                                 <!-- Limit the size of the bootdisk -->
202                                 <include name="default.jgz"/>
203                                 <include name="full.jgz"/>
204                         </fileset>      
205                 </copy>
206
207                 <bootdisk destfile="${jnode.disk}" stage1ResourceName="${grub.stage1.name}" stage2ResourceName="${grub.stage2.name}" plnfile="${jnode.disk.pln}" geometry="${jnode.disk.geometry}">
208                         <fileset dir="${bootdisk.dir}" />
209                 </bootdisk>
210         </target>
211
212         <!-- Build the boot files for windows NT/2K/XP (with NTLDR) -->
213         <target name="boot-files-winNT" depends="java-image">
214                 <mkdir dir="${jnode.install-nt.dir}" />
215
216                 <copy file="${jnode.kernel}" todir="${jnode.install-nt.dir}" overwrite ="yes" />
217                 <copy file="${grub.menu}" todir="${jnode.install-nt.dir}" overwrite ="yes" />
218                 <copy todir="${jnode.install-nt.dir}" overwrite ="yes">
219                         <fileset dir="${initjars.dir}" />
220                 </copy>
221                 <copy file="${grub.stage1-nt}" todir="${jnode.install-nt.dir}" overwrite ="yes" />
222                 <copy file="${grub.stage2-nt}" todir="${jnode.install-nt.dir}" overwrite ="yes" />
223
224                 <replace file="${jnode.install-nt.dir}/menu.lst"
225                         token="(hd0,0)" value="${partition-nt.grub.menu}"/>
226
227     <!-- patch -->
228                 <replace file="${jnode.install-nt.dir}/menu.lst"
229                         token="${partition-nt.grub.menu}" value="${partition-nt.grub.menu.final}"/>
230
231
232                 <echo message="${grub.install-nt.exe} -d ${partition-nt} -1 ${jnode.install-nt.dir}\${grub.stage1-nt.name} -2 ${jnode.install-nt.dir}\${grub.stage2-nt.name} -m ${jnode.install-nt.dir}\menu.lst" />
233
234                 <!-- the following wait is needed else grubinstall will fail finding stage2 -->
235                 <sleep seconds="20" />
236
237                 <exec executable="${grub.install-nt.exe}">
238                         <arg line="-d ${partition-nt} -1 ${jnode.install-nt.dir}\${grub.stage1-nt.name} -2 ${jnode.install-nt.dir}\${grub.stage2-nt.name} -m ${jnode.install-nt.dir}\menu.lst" />
239                 </exec>
240
241     <!-- patch
242                 <replace file="${jnode.install-nt.dir}/menu.lst"
243                         token="${partition-nt.grub.menu}" value="${partition-nt.grub.menu.final}"/>
244                          -->
245         </target>
246
247         <macrodef name="create-cdrom">
248                 <attribute name="dir" />
249                 <attribute name="destfile" />
250                 <sequential>
251                         <mkdir dir="@{dir}/boot/grub" />
252                         <copy todir="@{dir}">
253                                 <fileset dir="${jnode.kernel.dir}" includes="jnode*.gz"/>
254                         </copy>
255                         <copy todir="@{dir}">
256                                 <fileset dir="${initjars.dir}" />
257                         </copy>
258                         <copy file="${my-lib.dir}/eltorito.s2" todir="@{dir}/boot/grub" />
259             <copy file="${my-lib.dir}/fat.s15" todir="@{dir}/boot/grub" />
260             <copy file="${my-lib.dir}/grub.s1" todir="@{dir}/boot/grub" />
261             <copy file="${my-lib.dir}/grub.s2" todir="@{dir}/boot/grub" />
262             <copy file="${grub.menu.cdrom}" tofile="@{dir}/boot/grub/menu.lst" />
263             <exec executable="mkisofs">
264                                 <arg line="-o @{destfile} -R -b boot/grub/eltorito.s2 -no-emul-boot -boot-load-size 4 -boot-info-table @{dir}" />
265                         </exec>
266                 </sequential>
267         </macrodef>
268
269         <!-- Create a full distributable bootable CDROM image -->
270         <target name="cdrom" depends="prepare">
271                 <copy file="${sources.dist.tar.gz}" todir="${my-build.dir}/cdrom-full" />
272                 <create-cdrom destfile="${jnode-x86.iso}" dir="${my-build.dir}/cdrom-full" />
273
274                 <taskdef name="vmware" classname="org.jnode.build.VMwareBuilderTask" classpathref="cp-x86" />
275                 <vmware 
276                         isofile="${jnode-x86.iso}"
277                         logFile="${logFile}"
278                         memsize="${jnode.virtual.memsize}"
279                 />
280         </target>
281
282         <!-- Create a bootable CDROM image -->
283         <target name="cdrom-lite" depends="prepare">
284                 <create-cdrom destfile="${jnode-x86-lite.iso}" dir="${my-build.dir}/cdrom-lite" />
285
286                 <taskdef name="vmware" classname="org.jnode.build.VMwareBuilderTask" classpathref="cp-x86" />
287                 
288                 <vmware 
289                         isofile="${jnode-x86-lite.iso}"
290                         logFile="${logFile}"
291                         memsize="${jnode.virtual.memsize}"
292                 />
293         </target>
294
295         <target name="cdrom_64-lite" depends="prepare">
296                 <create-cdrom destfile="${jnode-x86_64-lite.iso}" dir="${my-build.dir}/cdrom-lite" />
297
298                 <taskdef name="vmware" classname="org.jnode.build.VMwareBuilderTask" classpathref="cp-x86" />
299
300                 <vmware
301                         isofile="${jnode-x86_64-lite.iso}"
302                         logFile="${logFile}"
303                         memsize="${jnode.virtual.memsize}"
304                 />
305         </target>
306
307         <!-- Prepare for netboot -->
308         <target name="netboot" depends="java-image" unless="no.netboot">
309                 <copy file="${jnode.kernel}" todir="${build.netboot.dir}" />
310                 <copy todir="${build.netboot.dir}">
311                         <fileset dir="${initjars.dir}" />
312                 </copy>
313                 <copy todir="${build.netboot.dir}">
314                         <fileset dir="${my-lib.dir}">
315                                 <include name="nbgrub-*" />
316                                 <include name="pxegrub-*" />
317                         </fileset>
318                         <fileset dir="${my-conf.dir}">
319                                 <include name="menu-nb.lst" />
320                                 <include name="menu-pxe.lst*" />
321                         </fileset>
322                 </copy>
323                 <mkdir dir="${build.netboot.dir}/plugins" />
324                 <copy todir="${build.netboot.dir}/plugins">
325                         <fileset dir="${plugins.dir}" />
326                 </copy>
327         </target>
328
329         <!-- Run all required targets -->
330         <target name="all" depends="boot-disk,netboot">
331         </target>
332
333 </project>
334
335