On Sun, 9 Oct 2011 23:25:52 +0300, Mehmet Emre Atasever <[email protected]> wrote:
On Sun, 9 Oct 2011 12:32:55 +0300
Gökçen Eraslan <[email protected]> wrote:
...
Ekteki yama nasıl? Binutils uygulamalarının başına HOST ekleyen
bölümleri sildim. Fakat bu işlem get modülünde önceden de yapıldığı
için orda da değişiklik gerekti. Sadece bu işi yapan
getBinutilsInfo fonksiyonu vardı, onu da sildim. Kullananı olabilir
ihtimaliyle bırakabiliriz isterseniz. Önemli olan NM() LD() gibi
fonksiyonlarda bunu kullanmamak nasılsa.


Benim sorunumu çözer bu ancak util.py'de şu kısım eksik:
554     def run_strip(f, flags=""):
555         p = os.popen("strip %s %s" %(flags, f))
556         ret = p.close()
557         if ret:
558 ctx.ui.warning(_("strip command failed for file '%s'!") % f)

strip için şöyle bir workaround kullandım ben (trunk/playground/memre/pisi/pisi/util.py):
583     def run_strip(f, flags=""):
584 strip_cmd = "strip" if not ctx.config.values.build.crosscompiling else "%s-strip" ctx.config.values.build.host
585         p = os.popen("%s %s %s" % (strip_cmd, flags, f))
586         ret = p.close()
587         if ret:
588 ctx.ui.warning(_("strip command failed for file '%s'!") % f)

İnşaya başlamadan önce STRIP değişkenini export ederek bu işi çözdüm ama daha temiz bir çözüm bulunabilir tabii ki.

PS: arm için strip işlemini arm cross-compiler'ı içerisinde bulunan arm-pardus-linux-gnueabi-strip ile yapmaktayım.


strip ve objcopy'yi de pisi.conf'tan alacak şekilde değiştirdim yamayı.

Bu arada, bu yamayı içeren pisiyi depoya aldığımız zaman, pisi
paketiyle gelen pisi.conf'ların içine host önekli toolchain
adlarını yazalım diyorum (mesela gcc=x86_64-pc-linux-gnu-gcc gibi).
Bu sayede her ihtimalde hostlu olanları kullanmaya devam etmiş
oluruz. Tabi isteyen yine pisi.conf'tan bunu ezebilir.


Aslında conf içerisinde ${host}-gcc gibi ifadeler kullanabilsek ne güzel olur dimi :)

Bu özellik zaten ConfigParser modülünde ne zamandır varmış. Interpolation diye geçiyor, misal:

cc = %(host)s-gcc
cxx = %(host)s-g++
host = x86_64-pc-linux-gnu

yazılabiliyor. Pisi paketinden gelen öntanımlı pisi.conf'larda bu şekilde kullanabiliriz belki.

--
Gökcen Eraslan
Index: operations/build.py
===================================================================
--- operations/build.py	(revision 38330)
+++ operations/build.py	(working copy)
@@ -407,12 +407,14 @@
         # First check icecream, if not found use ccache
         # TODO: Add support for using both of them
         if ctx.config.values.build.buildhelper == "icecream":
-            if os.path.exists("/opt/icecream/bin/gcc"):
+            if os.path.exists("/opt/icecream/bin/%s" % ctx.config.values.build.cc):
                 self.has_icecream = True
                 os.environ["PATH"] = "/opt/icecream/bin:%(PATH)s" % os.environ
+            else:
+                ctx.ui.warning(_("Specified compiler is not supported by icecream, it will be disabled."))
 
         elif ctx.config.values.build.buildhelper == "ccache":
-            if os.path.exists("/usr/lib/ccache/bin/gcc"):
+            if os.path.exists("/usr/lib/ccache/bin/%s" % ctx.config.values.build.cc):
                 self.has_ccache = True
 
                 os.environ["PATH"] = "/usr/lib/ccache/bin:%(PATH)s" \
@@ -420,6 +422,8 @@
                 # Force ccache to use /root/.ccache instead of $HOME/.ccache
                 # as $HOME can be modified through actions.py
                 os.environ["CCACHE_DIR"] = "/root/.ccache"
+            else:
+                ctx.ui.warning(_("Specified compiler is not supported by ccache, it will be disabled."))
 
     def fetch_files(self):
         self.fetch_actionsfile()
Index: actionsapi/variables.py
===================================================================
--- actionsapi/variables.py	(revision 38330)
+++ actionsapi/variables.py	(working copy)
@@ -14,6 +14,7 @@
 
 # Pisi-Core Modules
 import pisi.context as ctx
+import pisi.util
 
 # Set individual information, that are generally needed for ActionsAPI
 
@@ -35,8 +36,9 @@
     os.environ['JOBS'] = values.build.jobs
 
     # http://liste.pardus.org.tr/gelistirici/2009-January/016442.html
-    os.environ['CC'] = "%s-gcc" % values.build.host
-    os.environ['CXX'] = "%s-g++" % values.build.host
+    os.environ['CC'] = values.build.cc
+    os.environ['CXX'] = values.build.cxx
+    os.environ['LD'] = values.build.ld
 
 class Env(object):
     '''General environment variables used in actions API'''
Index: actionsapi/get.py
===================================================================
--- actionsapi/get.py	(revision 38330)
+++ actionsapi/get.py	(working copy)
@@ -34,6 +34,7 @@
 # Globals
 env = pisi.actionsapi.variables.glb.env
 dirs = pisi.actionsapi.variables.glb.dirs
+config = pisi.actionsapi.variables.glb.config
 generals = pisi.actionsapi.variables.glb.generals
 
 def curDIR():
@@ -164,41 +165,29 @@
 
 # Binutils Variables
 
-def getBinutilsInfo(util):
-    cross_build_name = '%s-%s' % (HOST(), util)
-    if not pisi.util.search_executable(cross_build_name):
-        if not pisi.util.search_executable(util):
-            raise BinutilsError(_('Util %s cannot be found') % util)
-        else:
-            ctx.ui.debug(_('Warning: %s does not exist, using plain name %s') \
-                     % (cross_build_name, util))
-            return util
-    else:
-        return cross_build_name
-
 def AR():
-    return getBinutilsInfo('ar')
+    return config.values.build.ar
 
 def AS():
-    return getBinutilsInfo('as')
+    return config.values.build.assembler
 
 def CC():
-    return getBinutilsInfo('gcc')
+    return config.values.build.cc
 
 def CXX():
-    return getBinutilsInfo('g++')
+    return config.values.build.cxx
 
 def LD():
-    return getBinutilsInfo('ld')
+    return config.values.build.ld
 
 def NM():
-    return getBinutilsInfo('nm')
+    return config.values.build.nm
 
 def RANLIB():
-    return getBinutilsInfo('ranlib')
+    return config.values.build.ranlib
 
 def F77():
-    return getBinutilsInfo('g77')
+    return config.values.build.f77
 
 def GCJ():
-    return getBinutilsInfo('gcj')
+    return config.values.build.gcj
Index: util.py
===================================================================
--- util.py	(revision 38330)
+++ util.py	(working copy)
@@ -552,7 +552,7 @@
 def strip_file(filepath, fileinfo, outpath):
     """Strip an elf file from debug symbols."""
     def run_strip(f, flags=""):
-        p = os.popen("strip %s %s" %(flags, f))
+        p = os.popen("%s %s %s" %(ctx.config.values.build.strip, flags, f))
         ret = p.close()
         if ret:
             ctx.ui.warning(_("strip command failed for file '%s'!") % f)
@@ -566,13 +566,13 @@
 
     def save_elf_debug(f, o):
         """copy debug info into file.debug file"""
-        p = os.popen("objcopy --only-keep-debug %s %s%s" % (f, o, ctx.const.debug_file_suffix))
+        p = os.popen("%s --only-keep-debug %s %s%s" % (ctx.config.values.build.objcopy, f, o, ctx.const.debug_file_suffix))
         ret = p.close()
         if ret:
             ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f)
 
         """mark binary/shared objects to use file.debug"""
-        p = os.popen("objcopy --add-gnu-debuglink=%s%s %s" % (o, ctx.const.debug_file_suffix, f))
+        p = os.popen("%s --add-gnu-debuglink=%s%s %s" % (ctx.config.values.build.objcopy, o, ctx.const.debug_file_suffix, f))
         ret = p.close()
         if ret:
             ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f)
Index: configfile.py
===================================================================
--- configfile.py	(revision 38330)
+++ configfile.py	(working copy)
@@ -30,6 +30,17 @@
 #cflags= -mtune=generic -march=i686 -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2
 #cxxflags= -mtune=generic -march=i686 -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2
 #ldflags= -Wl,-O1 -Wl,-z,relro -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--sort-common
+#ar = "ar"
+#assembler = "as"
+#cc = "gcc"
+#cxx = "g++"
+#ld = "ld"
+#nm = "nm"
+#ranlib = "ranlib"
+#f77 = "g77"
+#gcj = "gcj"
+#strip = "strip"
+#objcopy= "objcopy"
 #buildhelper = None / ccache / icecream
 #compressionlevel = 1
 #fallback = "ftp://ftp.pardus.org.tr/pub/source/2011";
@@ -87,6 +98,20 @@
     enableSandbox = True
     cflags = "-mtune=generic -march=i686 -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2"
     cxxflags = "-mtune=generic -march=i686 -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2"
+
+    # Toolchain defaults
+    ar = "ar"
+    assembler = "as"
+    cc = "gcc"
+    cxx = "g++"
+    ld = "ld"
+    nm = "nm"
+    ranlib = "ranlib"
+    f77 = "g77"
+    gcj = "gcj"
+    strip = "strip"
+    objcopy= "objcopy"
+
     ldflags = "-Wl,-O1 -Wl,-z,relro -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--sort-common"
     buildhelper = None
     compressionlevel = 1
_______________________________________________
Gelistirici mailing list
[email protected]
http://liste.pardus.org.tr/mailman/listinfo/gelistirici

Cevap