scummvm random work
[patches.git] / catalyst-cbuild.patch
1 Index: modules/generic_stage_target.py
2 ===================================================================
3 --- modules/generic_stage_target.py (revision 1203)
4 +++ modules/generic_stage_target.py (working copy)
5 @@ -18,40 +18,21 @@
6
7 self.valid_values.extend(["version_stamp","target","subarch",\
8 "rel_type","profile","snapshot","source_subpath","portage_confdir",\
9 - "cflags","cxxflags","ldflags","chost","hostuse","portage_overlay",\
10 + "cflags","cxxflags","ldflags","cbuild","chost","hostuse","portage_overlay",\
11 "distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
12
13 self.set_valid_build_kernel_vars(addlargs)
14 generic_target.__init__(self,myspec,addlargs)
15 - # map the mainarch we are running under to the mainarches we support for
16 - # building stages and LiveCDs. (for example, on amd64, we can build
17 - # stages for x86 or amd64.
18 - targetmap={
19 - "x86" : ["x86"],
20 - "amd64" : ["x86","amd64"],
21 - "sparc64" : ["sparc","sparc64"],
22 - "ia64" : ["ia64"],
23 - "alpha" : ["alpha"],
24 - "sparc" : ["sparc"],
25 - "sh" : ["sh"],
26 - "s390" : ["s390"],
27 - "ppc" : ["ppc"],
28 - "ppc64" : ["ppc","ppc64"],
29 - "hppa" : ["hppa"],
30 - "mips" : ["mips"],
31 - "arm" : ["arm"]
32 - }
33 -
34 - machinemap={
35 + machinemap={
36 "i386" : "x86",
37 "i486" : "x86",
38 "i586" : "x86",
39 "i686" : "x86",
40 "x86_64" : "amd64",
41 + "sparc" : "sparc",
42 "sparc64" : "sparc64",
43 "ia64" : "ia64",
44 "alpha" : "alpha",
45 - "sparc" : "sparc",
46 "sh2" : "sh",
47 "sh3" : "sh",
48 "sh4" : "sh",
49 @@ -61,8 +42,12 @@
50 "s390" : "s390",
51 "ppc" : "ppc",
52 "ppc64" : "ppc64",
53 - "parisc" : "hppa",
54 - "parisc64" : "hppa",
55 + "powerpc" : "powerpc",
56 + "powerpc64" : "powerpc64",
57 + "parisc" : "parisc",
58 + "parisc64" : "parisc",
59 + "hppa" : "hppa",
60 + "hppa64" : "hppa",
61 "mips" : "mips",
62 "mips64" : "mips",
63 "arm" : "arm",
64 @@ -71,31 +56,38 @@
65 "armv5b" : "arm"
66 }
67
68 - mymachine=os.uname()[4]
69 - if not machinemap.has_key(mymachine):
70 - raise CatalystError, "Unknown machine type "+mymachine
71 -
72 - self.settings["hostarch"]=machinemap[mymachine]
73 - self.archmap={}
74 - self.subarchmap={}
75 + if self.settings.has_key("chost"):
76 + hostmachine = self.settings["chost"].split("-")[0]
77 + else:
78 + hostmachine = os.uname()[4]
79 + if not machinemap.has_key(hostmachine):
80 + raise CatalystError, "Unknown host machine type "+hostmachine
81 + self.settings["hostarch"] = machinemap[hostmachine]
82 + if self.settings.has_key("cbuild"):
83 + buildmachine = self.settings["cbuild"].split("-")[0]
84 + else:
85 + buildmachine = os.uname()[4]
86 + if not machinemap.has_key(buildmachine):
87 + raise CatalystError, "Unknown build machine type "+buildmachine
88 + self.settings["buildarch"] = machinemap[buildmachine]
89 + self.settings["crosscompile"] = (self.settings["hostarch"] != self.settings["buildarch"])
90 + self.archmap = {}
91 + self.subarchmap = {}
92
93 - for x in targetmap[self.settings["hostarch"]]:
94 - try:
95 - fh=open(self.settings["sharedir"]+"/arch/"+x+".py")
96 - # This next line loads the plugin as a module and assigns it to
97 - # archmap[x]
98 - self.archmap[x]=imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
99 - # This next line registers all the subarches supported in the
100 - # plugin
101 - self.archmap[x].register(self.subarchmap)
102 - fh.close()
103 -
104 - except IOError:
105 - msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
106 + x = self.settings["hostarch"]
107 + try:
108 + fh = open(self.settings["sharedir"]+"/arch/"+x+".py")
109 + # this next line loads the plugin as a module and assigns it to archmap[x]
110 + self.archmap[x] = imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
111 + # this next line registers all the subarches supported in the plugin
112 + self.archmap[x].register(self.subarchmap)
113 + fh.close()
114 + except IOError:
115 + msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
116 # Call arch constructor, pass our settings
117 try:
118 self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
119 - except:
120 + except:
121 print "Invalid subarch: "+self.settings["subarch"]
122 print "Choose one of the following:",
123 for x in self.subarchmap:
124 @@ -104,14 +96,16 @@
125 sys.exit(2)
126
127 print "Using target:",self.settings["target"]
128 - # self.settings["mainarch"] should now be set by our arch constructor,
129 - # so we print a nice informational message:
130 - if self.settings["mainarch"]==self.settings["hostarch"]:
131 + # print a nice informational message:
132 + if self.settings["buildarch"]==self.settings["hostarch"]:
133 print "Building natively for",self.settings["hostarch"]
134 -
135 + elif self.settings["crosscompile"]:
136 + print "Cross-compiling on",self.settings["buildarch"],"for different machine type",\
137 + self.settings["hostarch"]
138 else:
139 - print "Building on",self.settings["hostarch"],"for alternate machine type",\
140 - self.settings["mainarch"]
141 + print "Building on",self.settings["buildarch"],"for alternate personality type",\
142 + self.settings["hostarch"]
143 +
144 # This should be first to be set as other set_ options depend on this
145 self.set_spec_prefix()
146
147 @@ -205,6 +199,10 @@
148 # for the chroot:
149 self.env["CCACHE_DIR"]="/var/tmp/ccache"
150
151 + def override_cbuild(self):
152 + if self.makeconf.has_key("CBUILD"):
153 + self.settings["CBUILD"]=self.makeconf["CBUILD"]
154 +
155 def override_chost(self):
156 if self.makeconf.has_key("CHOST"):
157 self.settings["CHOST"]=self.makeconf["CHOST"]
158 @@ -832,7 +830,8 @@
159
160 def chroot_setup(self):
161 self.makeconf=read_makeconf(self.settings["chroot_path"]+"/etc/make.conf")
162 - self.override_chost()
163 + self.override_cbuild()
164 + self.override_chost()
165 self.override_cflags()
166 self.override_cxxflags()
167 self.override_ldflags()
168 @@ -869,7 +868,8 @@
169 cmd("mv "+self.settings["chroot_path"]+"/etc/hosts "+self.settings["chroot_path"]+\
170 "/etc/hosts.bck", "Could not backup /etc/hosts",env=self.env)
171 cmd("cp /etc/hosts "+self.settings["chroot_path"]+"/etc/hosts", "Could not copy /etc/hosts",env=self.env)
172 - #self.override_chost()
173 + #self.override_cbuild()
174 + #self.override_chost()
175 #self.override_cflags()
176 #self.override_cxxflags()
177 #self.override_ldflags()
178 @@ -888,6 +888,8 @@
179 if self.settings.has_key("LDFLAGS"):
180 myf.write('LDFLAGS="'+self.settings["LDFLAGS"]+'"\n')
181 myf.write("# This should not be changed unless you know exactly what you are doing. You\n# should probably be using a different stage, instead.\n")
182 + if self.settings.has_key("CBUILD"):
183 + myf.write('CBUILD="'+self.settings["CBUILD"]+'"\n')
184 myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
185
186 # Figure out what our USE vars are for building
187 @@ -1078,7 +1080,7 @@
188 self.purge()
189
190 for x in self.settings["action_sequence"]:
191 - print "Running action sequence: "+x
192 + print "--- Running action sequence: "+x
193 sys.stdout.flush()
194 try:
195 apply(getattr(self,x))
196 Index: targets/netboot/netboot-combine.sh
197 ===================================================================
198 --- targets/netboot/netboot-combine.sh (revision 1203)
199 +++ targets/netboot/netboot-combine.sh (working copy)
200 @@ -15,7 +15,7 @@
201
202 # First install the boot package that we need
203 booter=""
204 -case ${clst_mainarch} in
205 +case ${clst_hostarch} in
206 alpha)
207 booter=""
208 ;;
209 @@ -51,7 +51,7 @@
210 create_normal_loop ${clst_chroot_path}/tmp/staging/initrd-${kname} ${clst_target_path} initrd-${kname}.igz
211 rm -r ${clst_chroot_path}/tmp/staging/initrd-${kname}
212
213 - case ${clst_mainarch} in
214 + case ${clst_hostarch} in
215 alpha)
216 # Until aboot is patched this is broken currently.
217 # please use catalyst 1.1.5 or older
218 @@ -93,10 +93,10 @@
219 ;;
220 sparc*)
221 #TEST TEST TEST TEST
222 - #elftoaout -o /netboot-${kname}.${clst_mainarch} /usr/src/linux/vmlinux
223 - #elftoaout -o /netboot-${kname}.${clst_mainarch} /${kname}
224 - #piggy=${clst_mainarch/sparc/piggyback}
225 - #${piggy} /netboot-${kname}.${clst_mainarch} /usr/src/linux/System.map /initrd-${kname}.igz
226 + #elftoaout -o /netboot-${kname}.${clst_hostarch} /usr/src/linux/vmlinux
227 + #elftoaout -o /netboot-${kname}.${clst_hostarch} /${kname}
228 + #piggy=${clst_hostarch/sparc/piggyback}
229 + #${piggy} /netboot-${kname}.${clst_hostarch} /usr/src/linux/System.map /initrd-${kname}.igz
230 ;;
231 x86)
232 mknbi-linux \
233 Index: targets/support/functions.sh
234 ===================================================================
235 --- targets/support/functions.sh (revision 1203)
236 +++ targets/support/functions.sh (working copy)
237 @@ -211,3 +211,7 @@
238 ;;
239 esac
240 }
241 +
242 +run_crossdev() {
243 + crossdev ${clst_CHOST}
244 +}
245 Index: targets/support/netboot2-final.sh
246 ===================================================================
247 --- targets/support/netboot2-final.sh (revision 1203)
248 +++ targets/support/netboot2-final.sh (working copy)
249 @@ -21,7 +21,7 @@
250
251 # Any post-processing necessary for each architecture can be done here. This
252 # may include things like sparc's elftoaout, x86's PXE boot, etc.
253 -case ${clst_mainarch} in
254 +case ${clst_hostarch} in
255 alpha)
256 sleep 0
257 ;;
258 Index: targets/support/bootloader-setup.sh
259 ===================================================================
260 --- targets/support/bootloader-setup.sh (revision 1203)
261 +++ targets/support/bootloader-setup.sh (working copy)
262 @@ -13,7 +13,7 @@
263
264 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
265
266 -case ${clst_mainarch} in
267 +case ${clst_hostarch} in
268 alpha)
269 # NO SOFTLEVEL SUPPORT YET
270 acfg=$1/etc/aboot.conf
271 Index: targets/support/create-iso.sh
272 ===================================================================
273 --- targets/support/create-iso.sh (revision 1203)
274 +++ targets/support/create-iso.sh (working copy)
275 @@ -7,7 +7,7 @@
276 ## START RUNSCRIPT
277
278 # Check for our CD ISO creation tools
279 -case ${clst_mainarch} in
280 +case ${clst_hostarch} in
281 mips)
282 cdmaker="sgibootcd"
283 cdmakerpkg="sys-boot/sgibootcd"
284 @@ -28,7 +28,7 @@
285 then
286 case ${clst_livecd_type} in
287 gentoo-*)
288 - case ${clst_mainarch} in
289 + case ${clst_hostarch} in
290 alpha)
291 clst_iso_volume_id="Gentoo Linux - Alpha"
292 ;;
293 @@ -76,7 +76,7 @@
294 fi
295
296 # Here we actually create the ISO images for each architecture
297 -case ${clst_mainarch} in
298 +case ${clst_hostarch} in
299 alpha)
300 case ${clst_fstype} in
301 zisofs)
302 Index: targets/support/pre-kmerge.sh
303 ===================================================================
304 --- targets/support/pre-kmerge.sh (revision 1203)
305 +++ targets/support/pre-kmerge.sh (working copy)
306 @@ -13,7 +13,7 @@
307 # Setup case structure for livecd_type
308 case ${clst_livecd_type} in
309 gentoo-release-minimal | gentoo-release-universal)
310 - case ${clst_mainarch} in
311 + case ${clst_hostarch} in
312 amd64|x86)
313 sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /' /usr/share/genkernel/genkernel
314 ;;
315 @@ -32,14 +32,14 @@
316 sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \
317 -e "s/@@RELVER@@/${clst_version_stamp}/g" \
318 ${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \
319 - > ${clst_root_path}usr/share/genkernel/${clst_mainarch}/linuxrc
320 + > ${clst_root_path}usr/share/genkernel/${clst_hostarch}/linuxrc
321
322 echo ">>> Copying support files to ${clst_root_path} ..."
323 cp -pPRf ${clst_root_path}usr/share/genkernel/netboot/misc/* \
324 ${clst_merge_path}
325
326 echo ">>> Copying busybox config ..."
327 - cp -f ${clst_root_path}usr/share/genkernel/${clst_mainarch}/nb-busybox.cf \
328 - ${clst_root_path}usr/share/genkernel/${clst_mainarch}/busy-config
329 + cp -f ${clst_root_path}usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
330 + ${clst_root_path}usr/share/genkernel/${clst_hostarch}/busy-config
331 ;;
332 esac
333 Index: arch/hppa.py
334 ===================================================================
335 --- arch/hppa.py (revision 1203)
336 +++ arch/hppa.py (working copy)
337 @@ -7,7 +7,6 @@
338 "Abstract base class for all hppa builders"
339 def __init__(self,myspec):
340 builder.generic.__init__(self,myspec)
341 - self.settings["mainarch"]="hppa"
342 self.settings["CHROOT"]="chroot"
343 self.settings["CFLAGS"]="-O2 -pipe"
344 self.settings["CXXFLAGS"]="-O2 -pipe"
345 Index: arch/mips.py
346 ===================================================================
347 --- arch/mips.py (revision 1203)
348 +++ arch/mips.py (working copy)
349 @@ -7,7 +7,6 @@
350 "Abstract base class for all mips builders [Big-endian]"
351 def __init__(self,myspec):
352 builder.generic.__init__(self,myspec)
353 - self.settings["mainarch"]="mips"
354 self.settings["CHROOT"]="chroot"
355 self.settings["CHOST"]="mips-unknown-linux-gnu"
356
357 @@ -15,7 +14,6 @@
358 "Abstract base class for all mipsel builders [Little-endian]"
359 def __init__(self,myspec):
360 builder.generic.__init__(self,myspec)
361 - self.settings["mainarch"]="mips"
362 self.settings["CHROOT"]="chroot"
363 self.settings["CHOST"]="mipsel-unknown-linux-gnu"
364
365 Index: arch/sparc.py
366 ===================================================================
367 --- arch/sparc.py (revision 1203)
368 +++ arch/sparc.py (working copy)
369 @@ -7,11 +7,11 @@
370 "abstract base class for all sparc builders"
371 def __init__(self,myspec):
372 builder.generic.__init__(self,myspec)
373 - self.settings["mainarch"]="sparc"
374 - if self.settings["hostarch"]=="sparc64":
375 + if self.settings["buildarch"]=="sparc64":
376 if not os.path.exists("/bin/linux32"):
377 raise CatalystError,"required /bin/linux32 executable not found (\"emerge setarch\" to fix.)"
378 self.settings["CHROOT"]="linux32 chroot"
379 + self.settings["crosscompile"] = False;
380 else:
381 self.settings["CHROOT"]="chroot"
382
383 Index: arch/sh.py
384 ===================================================================
385 --- arch/sh.py (revision 1203)
386 +++ arch/sh.py (working copy)
387 @@ -7,14 +7,12 @@
388 "Abstract base class for all sh builders [Little-endian]"
389 def __init__(self,myspec):
390 builder.generic.__init__(self,myspec)
391 - self.settings["mainarch"]="sh"
392 self.settings["CHROOT"]="chroot"
393
394 class generic_sheb(builder.generic):
395 "Abstract base class for all sheb builders [Big-endian]"
396 def __init__(self,myspec):
397 builder.generic.__init__(self,myspec)
398 - self.settings["mainarch"]="sh"
399 self.settings["CHROOT"]="chroot"
400
401 class arch_sh(generic_sh):
402 Index: arch/amd64.py
403 ===================================================================
404 --- arch/amd64.py (revision 1203)
405 +++ arch/amd64.py (working copy)
406 @@ -6,7 +6,6 @@
407 "abstract base class for all amd64 builders"
408 def __init__(self,myspec):
409 builder.generic.__init__(self,myspec)
410 - self.settings["mainarch"]="amd64"
411 self.settings["CHROOT"]="chroot"
412
413 class arch_amd64(generic_amd64):
414 Index: arch/ppc64.py
415 ===================================================================
416 --- arch/ppc64.py (revision 1203)
417 +++ arch/ppc64.py (working copy)
418 @@ -6,7 +6,6 @@
419 "abstract base class for all ppc64 builders"
420 def __init__(self,myspec):
421 builder.generic.__init__(self,myspec)
422 - self.settings["mainarch"]="ppc64"
423 self.settings["CHROOT"]="chroot"
424
425 class arch_ppc64(generic_ppc64):
426 Index: arch/s390.py
427 ===================================================================
428 --- arch/s390.py (revision 1203)
429 +++ arch/s390.py (working copy)
430 @@ -7,7 +7,6 @@
431 "abstract base class for all s390 builders"
432 def __init__(self,myspec):
433 builder.generic.__init__(self,myspec)
434 - self.settings["mainarch"]="s390"
435 self.settings["CHROOT"]="chroot"
436
437 class arch_s390(generic_s390):
438 Index: arch/arm.py
439 ===================================================================
440 --- arch/arm.py (revision 1203)
441 +++ arch/arm.py (working copy)
442 @@ -7,7 +7,6 @@
443 "Abstract base class for all arm (little endian) builders"
444 def __init__(self,myspec):
445 builder.generic.__init__(self,myspec)
446 - self.settings["mainarch"]="arm"
447 self.settings["CHROOT"]="chroot"
448 self.settings["CFLAGS"]="-O2 -pipe"
449 self.settings["CXXFLAGS"]="-O1 -pipe"
450 @@ -16,7 +15,6 @@
451 "Abstract base class for all arm (big endian) builders"
452 def __init__(self,myspec):
453 builder.generic.__init__(self,myspec)
454 - self.settings["mainarch"]="arm"
455 self.settings["CHROOT"]="chroot"
456 self.settings["CFLAGS"]="-O2 -pipe"
457 self.settings["CXXFLAGS"]="-O1 -pipe"
458 Index: arch/ppc.py
459 ===================================================================
460 --- arch/ppc.py (revision 1203)
461 +++ arch/ppc.py (working copy)
462 @@ -12,12 +12,12 @@
463 "abstract base class for all ppc builders"
464 def __init__(self,myspec):
465 builder.generic.__init__(self,myspec)
466 - self.settings["mainarch"]="ppc"
467 self.settings["CHOST"]="powerpc-unknown-linux-gnu"
468 - if self.settings["hostarch"]=="ppc64":
469 + if self.settings["buildarch"]=="ppc64":
470 if not os.path.exists("/bin/linux32"):
471 raise CatalystError,"required /bin/linux32 executable not found (\"emerge setarch\" to fix."
472 self.settings["CHROOT"]="linux32 chroot"
473 + self.settings["crosscompile"] = False;
474 else:
475 self.settings["CHROOT"]="chroot"
476
477 Index: arch/sparc64.py
478 ===================================================================
479 --- arch/sparc64.py (revision 1203)
480 +++ arch/sparc64.py (working copy)
481 @@ -7,7 +7,6 @@
482 "abstract base class for all sparc64 builders"
483 def __init__(self,myspec):
484 builder.generic.__init__(self,myspec)
485 - self.settings["mainarch"]="sparc64"
486 self.settings["CHROOT"]="chroot"
487
488 class arch_sparc64(generic_sparc64):
489 Index: arch/ia64.py
490 ===================================================================
491 --- arch/ia64.py (revision 1203)
492 +++ arch/ia64.py (working copy)
493 @@ -7,7 +7,6 @@
494 "builder class for ia64"
495 def __init__(self,myspec):
496 builder.generic.__init__(self,myspec)
497 - self.settings["mainarch"]="ia64"
498 self.settings["CHROOT"]="chroot"
499 self.settings["CFLAGS"]="-O2 -pipe"
500 self.settings["CFLAGS"]="-O2 -pipe"
501 Index: arch/alpha.py
502 ===================================================================
503 --- arch/alpha.py (revision 1203)
504 +++ arch/alpha.py (working copy)
505 @@ -7,7 +7,6 @@
506 "abstract base class for all alpha builders"
507 def __init__(self,myspec):
508 builder.generic.__init__(self,myspec)
509 - self.settings["mainarch"]="alpha"
510 self.settings["CHROOT"]="chroot"
511 self.settings["CFLAGS"]="-mieee -pipe"
512
513 Index: arch/x86.py
514 ===================================================================
515 --- arch/x86.py (revision 1203)
516 +++ arch/x86.py (working copy)
517 @@ -7,11 +7,11 @@
518 "abstract base class for all x86 builders"
519 def __init__(self,myspec):
520 builder.generic.__init__(self,myspec)
521 - self.settings["mainarch"]="x86"
522 - if self.settings["hostarch"]=="amd64":
523 + if self.settings["buildarch"]=="amd64":
524 if not os.path.exists("/bin/linux32"):
525 raise CatalystError,"required /bin/linux32 executable not found (\"emerge setarch\" to fix.)"
526 self.settings["CHROOT"]="linux32 chroot"
527 + self.settings["crosscompile"] = False;
528 else:
529 self.settings["CHROOT"]="chroot"
530