[jhbuild] config: Add an 'extra_prefixes' variable



commit c8a8603e2e69c5c6d01a25612c31a088b7e6a020
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Mar 12 17:15:15 2014 -0400

    config: Add an 'extra_prefixes' variable
    
    Add an extra_prefixes variable that will instruct jhbuild to act as it
    has been run inside of itself with two separate prefixes.  This allows
    setting up a 'cascading' environment where you could have multiple
    layers of jhbuild on top of each other (for different sets of work).
    
    It also allows for proper handling of /usr/local on systems that install
    software there (and we set 'extra_prefixes' to contain '/usr/local' by
    default on those systems).
    
    The extra_prefixes list is traversed so that the first entry has highest
    precedence.

 doc/C/index.docbook        |   19 +++++++++++++++++++
 jhbuild/config.py          |    5 ++++-
 jhbuild/defaults.jhbuildrc |    2 ++
 3 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index d544936..35dd6b8 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -1733,6 +1733,25 @@ Optional packages: (JHBuild will build the missing packages)
               supported by Git and Bazaar repositories.</simpara>
           </listitem>
         </varlistentry>
+        <varlistentry id="cfg-extra-prefixes">
+          <term>
+            <varname>extra_prefixes</varname>
+          </term>
+          <listitem>
+            <simpara>A list of strings specifying, in precedence order, the list
+              of extra prefixes.  JHBuild sets many environment variables (such
+              as <envar>LD_LIBRARY_PATH</envar>, <envar>PKG_CONFIG_PATH</envar>
+              and <envar>XDG_DATA_DIRS</envar>) based on the
+              <varname>prefix</varname> variable.  Adding directories to
+              <varname>extra_prefixes</varname> will cause these prefixes to be
+              included as well, at a lower precedence than the JHBuild
+              <varname>prefix</varname>, but at a higher precendence than system
+              directories.  This variable is empty by default except on systems
+              that install software in <filename>/usr/local</filename>, in which
+              case it contains this directory.
+            </simpara>
+          </listitem>
+        </varlistentry>
         <varlistentry id="cfg-help-website">
           <term>
             <varname>help_website</varname>
diff --git a/jhbuild/config.py b/jhbuild/config.py
index f41192e..0135a33 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -64,7 +64,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
                 'print_command_pattern', 'static_analyzer',
                 'module_static_analyzer', 'static_analyzer_template',
                 'static_analyzer_outputdir', 'check_sysdeps', 'system_prefix',
-                'help_website', 'conditions'
+                'help_website', 'conditions', 'extra_prefixes'
               ]
 
 env_prepends = {}
@@ -213,6 +213,9 @@ class Config:
         self.create_directories()
 
         setup_env_defaults(self.system_libdirs)
+
+        for prefix in reversed(self.extra_prefixes):
+            setup_env(prefix)
         setup_env(self.prefix)
 
         self.apply_env_prepends()
diff --git a/jhbuild/defaults.jhbuildrc b/jhbuild/defaults.jhbuildrc
index 9872b67..672a3b4 100644
--- a/jhbuild/defaults.jhbuildrc
+++ b/jhbuild/defaults.jhbuildrc
@@ -136,6 +136,7 @@ module_checkout_mode = {}
 copy_dir = None
 
 # attempt to detect the system library path
+extra_prefixes = []
 try:
     # Debian-style multiarch
     system_libdirs = ['/usr/lib/' + sys._multiarch, '/usr/lib']
@@ -146,6 +147,7 @@ except AttributeError:
     for path in sys.path:
         if path.startswith('/usr/local/lib/') and not '/usr/local/lib' in system_libdirs:
             system_libdirs.append('/usr/local/lib')
+            extra_prefixes = ['/usr/local']
 
         elif path.startswith('/usr/lib64/') and not '/usr/lib64' in system_libdirs:
             system_libdirs.append('/usr/lib64')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]