# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
# $Id: $
+ 13 Feb 2007; Chris Gianelloni <wolf31o2@gentoo.org> arch/alpha.py,
+ arch/amd64.py, arch/arm.py, arch/hppa.py, arch/ia64.py, arch/mips.py,
+ arch/ppc.py, arch/ppc64.py, arch/s390.py, arch/sh.py, arch/sparc.py,
+ arch/sparc64.py, arch/x86.py, catalyst, modules/generic_stage_target.py:
+ Added a patch from Andrew Gaffney <agaffney@gentoo.org> to fix up the
+ problems with using all of the various subarch settings.
+
13 Feb 2007; Chris Gianelloni <wolf31o2@gentoo.org>
targets/support/bootloader-setup.sh, targets/support/create-iso.sh:
Disabled deleting of /boot so we actually can work with EFI/grub, made EFI
self.settings["CHOST"]="alphaev67-unknown-linux-gnu"
self.settings["HOSTUSE"]=["ev6"]
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({ "alpha":arch_alpha, "ev4":arch_ev4, "ev45":arch_ev45,
+ return ({ "alpha":arch_alpha, "ev4":arch_ev4, "ev45":arch_ev45,
"ev5":arch_ev5, "ev56":arch_ev56, "pca56":arch_pca56,
- "ev6":arch_ev6, "ev67":arch_ev67 })
+ "ev6":arch_ev6, "ev67":arch_ev67 },
+ ("alpha", ))
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CHOST"]="x86_64-pc-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"amd64":arch_amd64})
+ return ({"amd64":arch_amd64}, ("x86_64", ))
self.settings["CFLAGS"]+=" -mcpu=xscale"
self.settings["CHOST"]="armv5b-unknown-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({
+ return ({
"arm" : arch_arm,
"armv4l" : arch_armv4l,
"armeb" : arch_armeb,
"armv5b" : arch_armv5b
+ }, ("arm", "armv4l", "armeb", "armv5b") )
- })
self.settings["CFLAGS"]+=" -march=2.0"
self.settings["CHOST"]="hppa2.0-unknown-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({
+ return ({
"hppa": arch_hppa,
"hppa1.1": arch_hppa1_1,
"hppa2.0": arch_hppa2_0
- })
+ }, ("parisc","parisc64","hppa","hppa64") )
+
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CHOST"]="ia64-unknown-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({ "ia64":arch_ia64 })
+ return ({ "ia64":arch_ia64 }, ("ia64", ))
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({
+ return ({
"mips" :arch_mips1,
"mips1" :arch_mips1,
"mips2" :arch_mips2,
"sgir5k" :arch_mips4,
"sgir10kplus" :arch_mips4,
"cobalt" :arch_mipsel4
- })
+ }, ("mips","mips64"))
self.settings["CFLAGS"]="-O2 -mcpu=G5 -mtune=G5 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
self.settings["HOSTUSE"]=["altivec"]
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"ppc":arch_ppc,"power":arch_power,"power-ppc":arch_power_ppc,"g3":arch_g3,"g4":arch_g4,"g5":arch_g5})
+ return ({"ppc":arch_ppc,"power":arch_power,"power-ppc":arch_power_ppc,"g3":arch_g3,"g4":arch_g4,"g5":arch_g5},
+ ("ppc","powerpc"))
self.settings["CFLAGS"]="-O2 -pipe -mcpu=power5 -mtune=power5"
self.settings["CXXFLAGS"]="-O2 -pipe -mcpu=power5 -mtune=power5"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"ppc64":arch_ppc64,"970":arch_970,"power3":arch_power3,"power4":arch_power4,"power5":arch_power5})
+ return ({"ppc64":arch_ppc64,"970":arch_970,"power3":arch_power3,"power4":arch_power4,"power5":arch_power5},
+ ("ppc64","powerpc64"))
+
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CHOST"]="s390-ibm-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"s390":arch_s390})
+ return ({"s390":arch_s390}, ("s390", ))
self.settings["CFLAGS"]="-O2 -m4 -pipe"
self.settings["CHOST"]="sh4eb-unknown-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({
+ return ({
"sh" :arch_sh,
"sh2" :arch_sh2,
"sh3" :arch_sh3,
"sh2eb" :arch_sh2eb,
"sh3eb" :arch_sh3eb,
"sh4eb" :arch_sh4eb
- })
+ }, ("sh2","sh3","sh4","sh2eb","sh3eb","sh4eb"))
self.settings["CXXFLAGS"]="-O2 -pipe"
self.settings["CHOST"]="sparc-unknown-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"sparc":arch_sparc})
+ return ({"sparc":arch_sparc}, ("sparc", ))
self.settings["CXXFLAGS"]="-O2 -mcpu=ultrasparc -pipe"
self.settings["CHOST"]="sparc-unknown-linux-gnu"
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"sparc64":arch_sparc64})
+ return ({"sparc64":arch_sparc64}, ("sparc64", ))
self.settings["CHOST"]="i686-pc-linux-gnu"
self.settings["HOSTUSE"]=["mmx","sse"]
-def register(foo):
+def register():
"Inform main catalyst program of the contents of this plugin."
- foo.update({"pentium4":arch_pentium4,"x86":arch_x86,"i386":arch_i386,"i486":arch_i486,"i586":arch_i586,"i686":arch_i686,"athlon":arch_athlon,
- "athlon-xp":arch_athlon_xp,"athlon-mp":arch_athlon_xp,"pentium3":arch_pentium3,"pentium-mmx":arch_pentium_mmx})
+ return ({"pentium4":arch_pentium4,"x86":arch_x86,"i386":arch_i386,"i486":arch_i486,"i586":arch_i586,"i686":arch_i686,"athlon":arch_athlon,
+ "athlon-xp":arch_athlon_xp,"athlon-mp":arch_athlon_xp,"pentium3":arch_pentium3,"pentium-mmx":arch_pentium_mmx},
+ ('i386', 'i486', 'i586', 'i686'))
import pdb
__maintainer__="Chris Gianelloni <wolf31o2@gentoo.org>"
-__version__="2.0.2"
+__version__="2.0.3_pre2"
conf_values={}
self.set_valid_build_kernel_vars(addlargs)
generic_target.__init__(self,myspec,addlargs)
- machinemap={
- "i386" : "x86",
- "i486" : "x86",
- "i586" : "x86",
- "i686" : "x86",
- "x86_64" : "amd64",
- "sparc" : "sparc",
- "sparc64" : "sparc64",
- "ia64" : "ia64",
- "alpha" : "alpha",
- "sh2" : "sh",
- "sh3" : "sh",
- "sh4" : "sh",
- "sh2eb" : "sh",
- "sh3eb" : "sh",
- "sh4eb" : "sh",
- "s390" : "s390",
- "ppc" : "ppc",
- "ppc64" : "ppc64",
- "powerpc" : "ppc",
- "powerpc64" : "ppc64",
- "parisc" : "hppa",
- "parisc64" : "hppa",
- "hppa" : "hppa",
- "hppa64" : "hppa",
- "mips" : "mips",
- "mips64" : "mips",
- "arm" : "arm",
- "armv4l" : "arm",
- "armeb" : "arm",
- "armv5b" : "arm"
- }
+
+ # The semantics of subarchmap and machinemap changed a bit in 2.0.3 to
+ # work better with vapier's CBUILD stuff. I've removed the "monolithic"
+ # machinemap from this file and split up its contents amongst the various
+ # arch/foo.py files.
+ #
+ # When register() is called on each module in the arch/ dir, it now returns
+ # a tuple instead of acting on the subarchmap dict that is passed to it.
+ # The tuple contains the values that were previously added to subarchmap
+ # as well as a new list of CHOSTs that go along with that arch. This allows
+ # us to build machinemap on the fly based on the keys in subarchmap and
+ # the values of the 2nd list returned (tmpmachinemap).
+ #
+ # Also, after talking with vapier. I have a slightly better idea of what
+ # certain variables are used for and what they should be set to. Neither
+ # 'buildarch' or 'hostarch' are used directly, so their value doesn't
+ # really matter. They are just compared to determine if we are
+ # cross-compiling. Because of this, they are just set to the name of the
+ # module in arch/ that the subarch is part of to make things simpler. The
+ # entire build process is still based off of 'subarch' like it was
+ # previously. -agaffney
+
+ self.archmap = {}
+ self.subarchmap = {}
+ machinemap = {}
+ for x in [x[:-3] for x in os.listdir(self.settings["sharedir"]+"/arch/") if x.endswith(".py")]:
+ try:
+ fh=open(self.settings["sharedir"]+"/arch/"+x+".py")
+ # This next line loads the plugin as a module and assigns it to
+ # archmap[x]
+ self.archmap[x]=imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
+ # This next line registers all the subarches supported in the
+ # plugin
+ tmpsubarchmap, tmpmachinemap = self.archmap[x].register()
+ self.subarchmap.update(tmpsubarchmap)
+ for machine in tmpmachinemap:
+ machinemap[machine] = x
+ for subarch in tmpsubarchmap:
+ machinemap[subarch] = x
+ fh.close()
+ except IOError:
+ # This message should probably change a bit, since everything in the dir should
+ # load just fine. If it doesn't, it's probably a syntax error in the module
+ msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
if self.settings.has_key("chost"):
hostmachine = self.settings["chost"].split("-")[0]
raise CatalystError, "Unknown build machine type "+buildmachine
self.settings["buildarch"] = machinemap[buildmachine]
self.settings["crosscompile"] = (self.settings["hostarch"] != self.settings["buildarch"])
- self.archmap = {}
- self.subarchmap = {}
- x = self.settings["hostarch"]
- try:
- fh = open(self.settings["sharedir"]+"/arch/"+x+".py")
- # this next line loads the plugin as a module and assigns it to archmap[x]
- self.archmap[x] = imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
- # this next line registers all the subarches supported in the plugin
- self.archmap[x].register(self.subarchmap)
- fh.close()
- except IOError:
- msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
# Call arch constructor, pass our settings
try:
self.arch=self.subarchmap[self.settings["subarch"]](self.settings)