]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
naoki: Add multiple arches support.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Feb 2010 18:59:18 +0000 (19:59 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Feb 2010 18:59:18 +0000 (19:59 +0100)
This will allow us to compile ipfire on a 64bit host in
a 32 bit architecture.

config/architectures.conf [new file with mode: 0644]
config/naoki.conf
naoki/chroot.py
naoki/constants.py
naoki/util.py

diff --git a/config/architectures.conf b/config/architectures.conf
new file mode 100644 (file)
index 0000000..0cf691f
--- /dev/null
@@ -0,0 +1,44 @@
+
+[i686]
+
+machine = i686
+personality = linux32
+
+cflags = -O2 -fomit-frame-pointer -pipe
+
+
+[i586]
+
+machine = i586
+personality = linux32
+
+cflags = -O2 -fomit-frame-pointer -pipe
+
+
+[i486]
+
+machine = i486
+personality = linux32
+
+cflags = -O2 -fomit-frame-pointer -pipe
+
+
+[alix]
+
+; While i586 works fine on a Geode LX, i486 should be a more performant choice
+; right now due to the way Geode LX CPU pipeline ans scheduling works. glibc 
+; i586 assembler optimized routines are measureably slower than the i486 ones on
+; a  Geode LX.
+machine = i486
+personality = linux32
+
+cflags = -Os -march=geode -fno-align-jumps -fno-align-functions -fno-align-labels -fno-align-loops -fomit-frame-pointer -pipe
+cxxflags = %(cflags)s
+
+
+[x86_64]
+
+machine = x86_64
+personality = linux64
+
+cflags = -O2 -fomit-frame-pointer -pipe
index 940b7328fa7c5586f46110133085ef9b670de9b3..f39182fe943804bbd82afda1bb3528e9626da646 100644 (file)
@@ -1,3 +1,10 @@
+
+[architecture]
+
+config = config/architectures.conf
+
+arch = i686
+
 [distro]
 
 ; Name of the distribution we build.
index c1fd21259bd085d7b57f7501d7d06173b4bb9539..1d4df266e69c44f5aa1cb3dfef2153b2e8d60fe6 100644 (file)
@@ -15,6 +15,8 @@ from logger import getLog
 class Environment(object):
        def __init__(self, package):
                self.package = package
+
+               self.arch = arches.current
                self.config = config
 
                self.toolchain = Toolchain()
@@ -144,7 +146,7 @@ class Environment(object):
                        if not kwargs.has_key("chrootPath"):
                                kwargs["chrootPath"] = self.chrootPath()
 
-                       ret = util.do(command,
+                       ret = util.do(command, personality=self.arch["personality"],
                                shell=shell, env=env, logger=self.log, *args, **kwargs)
 
                finally:
index 8e48b33cfb31eb2c6bb444a94063f81834ce406a..92dfd8eb928e0fc017d7ac9495309e162b3df268 100644 (file)
@@ -93,5 +93,44 @@ class Config(object):
                        "PARALLELISMFLAGS" : "-j6",
                }
 
+
+class Architectures(object):
+       def __init__(self, configfile):
+               parser = ConfigParser.ConfigParser()
+               parser.read(configfile)
+
+               arches = {}
+               for arch in parser.sections():
+                       arches[arch] = { "name" : arch }
+                       for key, val in parser.items(arch):
+                               arches[arch][key] = val
+
+               self._arches = arches
+               self.__current = None
+
+       def set(self, arch):
+               self.__current = arch
+
+       @property
+       def all(self):
+               return self._arches
+
+       @property
+       def default(self):
+               return self._arches.get("i686")
+
+       @property
+       def current(self):
+               if not self.__current:
+                       return self.default
+               return self._arches[self.__current]
+
+       def __getitem__(self, key):
+               return self._arches[key]
+
+
 # Create a globally useable instance of the configuration
 config = Config()
+
+arches = Architectures(config["architecture_config"])
+arches.set(config["architecture_arch"])
index caad3c417468f01805ae023b53da06eab3a94413..7e1766844fce07574995c8d185da4a684e1870ea 100644 (file)
@@ -9,6 +9,7 @@ import subprocess
 import sys
 import time
 
+from constants import *
 from exception import *
 from logger import getLog
 
@@ -24,19 +25,8 @@ CLONE_NEWNS = 0x00020000
 PER_LINUX32=0x0008
 PER_LINUX=0x0000
 personality_defs = {
-       'x86_64': PER_LINUX,
-       'ppc64': PER_LINUX,
-       'sparc64': PER_LINUX,
-       'i386': PER_LINUX32,
-       'i586': PER_LINUX32,
-       'i686': PER_LINUX32,
-       'ppc': PER_LINUX32,
-       'sparc': PER_LINUX32,
-       'sparcv9': PER_LINUX32,
-       'ia64' : PER_LINUX,
-       'alpha' : PER_LINUX,
-       's390' : PER_LINUX32,
-       's390x' : PER_LINUX,
+       'linux64': PER_LINUX,
+       'linux32': PER_LINUX32,
 }
 
 def touch(filename):
@@ -128,7 +118,7 @@ def condChdir(cwd):
         os.chdir(cwd)
 
 def condPersonality(per=None):
-    if per is None or per in ('noarch',):
+    if not per:
         return
     if personality_defs.get(per, None) is None:
         return