changeset 4499:b616cc712965

Rework C/LD/LD_LIB path settings in toolsbuild and targetbuild.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Fri, 24 Oct 2008 21:32:18 +0200
parents 411120db6fb5
children 79562531c2cf
files gub/misc.py gub/specs/git.py gub/targetbuild.py gub/toolsbuild.py
diffstat 4 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gub/misc.py	Fri Oct 24 21:03:52 2008 +0200
+++ b/gub/misc.py	Fri Oct 24 21:32:18 2008 +0200
@@ -514,6 +514,11 @@
         return u.split ('::')
     return platform, u
 
+def append_path (elt):
+    if elt:
+        return ':' + elt
+    return ''
+
 def test ():
     print forall (x for x in [1, 1])
     print dissect_url ('git://anongit.freedesktop.org/git/fontconfig?revision=1234')
--- a/gub/specs/git.py	Fri Oct 24 21:03:52 2008 +0200
+++ b/gub/specs/git.py	Fri Oct 24 21:32:18 2008 +0200
@@ -32,8 +32,7 @@
         pass
 
     def makeflags (self):
-        # FIXME: why are C_INCLUDE_PATH, LIBRARY_PATH not in env dict?
-        return 'V=1 SCRIPT_PERL= C_INCLUDE_PATH=%(system_prefix)s/include LIBRARY_PATH=%(system_prefix)s/lib'
+        return 'V=1 SCRIPT_PERL='
 
 class Git (targetbuild.TargetBuild):
 
--- a/gub/targetbuild.py	Fri Oct 24 21:03:52 2008 +0200
+++ b/gub/targetbuild.py	Fri Oct 24 21:32:18 2008 +0200
@@ -1,6 +1,6 @@
 import os
 import re
-
+#
 from gub import build
 from gub import context
 from gub import misc
@@ -156,7 +156,8 @@
 #            'LDFLAGS': '-L%(system_prefix)s/lib -L%(system_prefix)s/bin -L%(system_prefix)s/lib/w32api',
             'LDFLAGS': '',
             'LD': '%(toolchain_prefix)sld',
-            'LD_LIBRARY_PATH': '%(tools_prefix)s/lib', # prepend to os.environ[]?
+            'LD_LIBRARY_PATH': '%(tools_prefix)s/lib'
+            + misc.append_path (os.environ.get ('LD_LIBRARY_PATH', '')),
             'NM': '%(toolchain_prefix)snm',
             'PKG_CONFIG_PATH': '%(system_prefix)s/lib/pkgconfig',
             'PATH': '%(cross_prefix)s/bin:%(toolchain_prefix)s/bin:' + os.environ['PATH'],
--- a/gub/toolsbuild.py	Fri Oct 24 21:03:52 2008 +0200
+++ b/gub/toolsbuild.py	Fri Oct 24 21:32:18 2008 +0200
@@ -1,8 +1,8 @@
-from gub import misc
 import os
 import re
-
+#
 from gub import build
+from gub import misc
 from gub import loggedos
 
 class ToolsBuild (build.UnixBuild):
@@ -55,10 +55,15 @@
 
     def get_substitution_dict (self, env={}):
         dict = {
-            'C_INCLUDE_PATH': '%(toolchain_prefix)s/include',
-            'LIBRARY_PATH': '%(toolchain_prefix)s/lib',
-            'CPLUS_INCLUDE_PATH': '%(toolchain_prefix)s/include',
-            'LD_LIBRARY_PATH': '%(toolchain_prefix)s/lib',
+            'C_INCLUDE_PATH': '%(system_prefix)s/include'
+            + misc.append_path (os.environ.get ('C_INCLUDE_PATH', '')),
+            'LIBRARY_PATH': '%(system_prefix)s/lib'
+            + misc.append_path (os.environ.get ('LIBRARY_PATH', '')),
+            'CPLUS_INCLUDE_PATH': '%(system_prefix)s/include'
+            + misc.append_path (os.environ.get ('CPLUS_INCLUDE_PATH', '')),
+            'LD_LIBRARY_PATH': '%(system_prefix)s/lib'
+            + misc.append_path (os.environ.get ('LD_LIBRARY_PATH', '')),
+            'PATH': '%(system_prefix)s/bin:' + os.environ['PATH'],
         }
         dict.update (env)
         d = build.UnixBuild.get_substitution_dict (self, dict).copy ()