[jhbuild/wip/path-env: 5/6] Drop use_lib64



commit d3d07a7b0798b3a8190b713c3e280910dbc066d2
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Mar 10 00:42:25 2014 -0400

    Drop use_lib64
    
    Drop use_lib64 from jhbuildrc and stop using --libdir.
    
    We now never pass --libdir= to build systems, which means that libraries
    will always be installed into the default location of ${prefix}/lib.
    
    We replace use_lib64 with a new variable called 'system_libdirs' which
    is a list of system library paths.  The default value is determined in a
    system-specific way which knows about /usr/local/lib, /usr/lib64 and
    Debian-style multiarch directories.
    
    We keep a few odd bits around for backwards compatibility reasons such
    as the ${libdir} expansion and JHBUILD_LIBDIR environment variable.
    
    Some examples of the detected default value on various systems:
    
      Ubuntu:     ['/usr/lib/x86_64-linux-gnu', '/usr/lib']
      Fedora:     ['/usr/lib64']
      FreeBSD:    ['/usr/local/lib', '/usr/lib']

 doc/C/index.docbook           |   24 ++++++++++--------------
 jhbuild/commands/bot.py       |    3 ---
 jhbuild/config.py             |   34 +++++++++++-----------------------
 jhbuild/defaults.jhbuildrc    |   27 +++++++++++++++++----------
 jhbuild/modtypes/__init__.py  |    5 +----
 jhbuild/modtypes/autotools.py |    8 +-------
 jhbuild/modtypes/cmake.py     |    8 ++------
 jhbuild/modtypes/waf.py       |    2 --
 8 files changed, 42 insertions(+), 69 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 73e96ef..feddc7d 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -2157,6 +2157,16 @@ Optional packages: (JHBuild will build the missing packages)
               <literal>svn</literal>.</simpara>
           </listitem>
         </varlistentry>
+        <varlistentry id="cfg-system-libdirs">
+          <term>
+            <varname>system_libdirs</varname>
+          </term>
+          <listitem>
+            <simpara>A list of strings specifying the system library paths.
+              This is used when setting the default values of some environment
+              variables, such as <envar>PKG_CONFIG_PATH</envar>.</simpara>
+          </listitem>
+        </varlistentry>
         <varlistentry id="cfg-tarballdir">
           <term>
             <varname>tarballdir</varname>
@@ -2196,20 +2206,6 @@ Optional packages: (JHBuild will build the missing packages)
             </simpara>
           </listitem>
         </varlistentry>
-        <varlistentry id="cfg-use-lib64">
-          <term>
-            <varname>use_lib64</varname>
-          </term>
-          <listitem>
-            <simpara>A boolean value that specifies whether to install
-              libraries to <filename>lib64</filename> directories. If set,
-              <literal>--libdir=\${exec_prefix}/lib64</literal> will be passed
-              to configure. Defaults to <constant>True</constant> if running on
-              <literal>x86_64</literal>, <literal>ppc64</literal> or
-              <literal>s390x</literal> Linux, and <constant>False</constant> on
-              other systems.</simpara>
-          </listitem>
-        </varlistentry>
         <varlistentry id="cfg-use-local-modulesets">
           <term>
             <varname>use_local_modulesets</varname>
diff --git a/jhbuild/commands/bot.py b/jhbuild/commands/bot.py
index 49902c3..fce9497 100644
--- a/jhbuild/commands/bot.py
+++ b/jhbuild/commands/bot.py
@@ -109,9 +109,6 @@ class cmd_bot(Command):
             pythonversion = 'python' + str(sys.version_info[0]) + '.' + str(sys.version_info[1])
             pythonpath = os.path.join(config.prefix, 'lib', pythonversion, 'site-packages')
             site.addsitedir(pythonpath)
-            if config.use_lib64:
-                pythonpath = os.path.join(config.prefix, 'lib64', pythonversion, 'site-packages')
-                site.addsitedir(pythonpath)
             try:
                 import buildbot
             except ImportError:
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 47a5d90..b5e357e 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -46,7 +46,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
                 'builddir_pattern', 'module_autogenargs', 'module_makeargs',
                 'interact', 'buildscript', 'nonetwork', 'nobuild',
                 'alwaysautogen', 'noinstall', 'makeclean', 'makedistclean',
-                'makecheck', 'module_makecheck', 'use_lib64',
+                'makecheck', 'module_makecheck', 'system_libdirs',
                 'tinderbox_outputdir', 'sticky_date', 'tarballdir',
                 'pretty_print', 'svn_program', 'makedist', 'makedistcheck',
                 'nonotify', 'notrayicon', 'cvs_program', 'checkout_mode',
@@ -430,11 +430,7 @@ class Config:
             os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = 'unix:path=/var/run/dbus/system_bus_socket'
 
         # LD_LIBRARY_PATH
-        if self.use_lib64:
-            libdir = os.path.join(self.prefix, 'lib64')
-        else:
-            libdir = os.path.join(self.prefix, 'lib')
-        self.libdir = libdir
+        libdir = os.path.join(self.prefix, 'lib')
         addpath('LD_LIBRARY_PATH', libdir)
         os.environ['JHBUILD_LIBDIR'] = libdir
 
@@ -470,8 +466,8 @@ class Config:
 
         # PKG_CONFIG_PATH
         if os.environ.get('PKG_CONFIG_PATH') is None:
-            for dirname in ('share', 'lib', 'lib64'):
-                full_name = '/usr/%s/pkgconfig' % dirname
+            for dirname in reversed(self.system_libdirs + ['/usr/share']):
+                full_name = os.path.join(dirname, 'pkgconfig')
                 if os.path.exists(full_name):
                     addpath('PKG_CONFIG_PATH', full_name)
         pkgconfigdatadir = os.path.join(self.prefix, 'share', 'pkgconfig')
@@ -481,13 +477,11 @@ class Config:
 
         # GI_TYPELIB_PATH
         if not 'GI_TYPELIB_PATH' in os.environ:
-            if self.use_lib64:
-                full_name = '/usr/lib64/girepository-1.0'
-            else:
-                full_name = '/usr/lib/girepository-1.0'
-            if os.path.exists(full_name):
-                addpath('GI_TYPELIB_PATH', full_name)
-        typelibpath = os.path.join(self.libdir, 'girepository-1.0')
+            for dirname in reversed(self.system_libdirs):
+                full_name = os.path.join(dirname, 'girepository-1.0')
+                if os.path.exists(full_name):
+                    addpath('GI_TYPELIB_PATH', full_name)
+        typelibpath = os.path.join(libdir, 'girepository-1.0')
         addpath('GI_TYPELIB_PATH', typelibpath)
 
         # XDG_DATA_DIRS
@@ -507,12 +501,12 @@ class Config:
         addpath('XCURSOR_PATH', xcursordir)
 
         # GST_PLUGIN_PATH
-        gstplugindir = os.path.join(self.libdir , 'gstreamer-0.10')
+        gstplugindir = os.path.join(libdir , 'gstreamer-0.10')
         if os.path.exists(gstplugindir):
             addpath('GST_PLUGIN_PATH', gstplugindir)
 
         # GST_PLUGIN_PATH_1_0
-        gstplugindir = os.path.join(self.libdir , 'gstreamer-1.0')
+        gstplugindir = os.path.join(libdir , 'gstreamer-1.0')
         if os.path.exists(gstplugindir):
             addpath('GST_PLUGIN_PATH_1_0', gstplugindir)
 
@@ -582,12 +576,6 @@ class Config:
                 logging.warn(_('Unable to determine python site-packages directory using the '
                                'PYTHON environment variable (%s). Using default "%s"')
                              % (os.environ['PYTHON'], python_packages_dir))
-            
-        if self.use_lib64:
-            pythonpath = os.path.join(self.prefix, 'lib64', pythonversion, python_packages_dir)
-            addpath('PYTHONPATH', pythonpath)
-            if not os.path.exists(pythonpath):
-                os.makedirs(pythonpath)
 
         pythonpath = os.path.join(self.prefix, 'lib', pythonversion, python_packages_dir)
         addpath('PYTHONPATH', pythonpath)
diff --git a/jhbuild/defaults.jhbuildrc b/jhbuild/defaults.jhbuildrc
index 9340664..188ae79 100644
--- a/jhbuild/defaults.jhbuildrc
+++ b/jhbuild/defaults.jhbuildrc
@@ -135,18 +135,25 @@ module_checkout_mode = {}
 # checkout dir
 copy_dir = None
 
-# whether to install to lib64 directories?  Currently this will default to
-# True on Linux AMD64, PPC64 or S390x systems, and False everywhere else.
-# Patches accepted to fix the default for other architectures.
+# attempt to detect the system library path
 try:
-    uname = os.uname()
-    use_lib64 = (uname[0], uname[4]) in [ ('Linux', 'x86_64'),
-                                          ('Linux', 'ppc64'),
-                                          ('Linux', 's390x') ]
-    del uname
+    # Debian-style multiarch
+    system_libdirs = ['/usr/lib/' + sys._multiarch, '/usr/lib']
+
 except AttributeError:
-    # some platforms don't have os.uname (ie. Win32)
-    use_lib64 = False
+    # Check the python path and make some reasonable guesses
+    system_libdirs = []
+    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')
+
+        elif path.startswith('/usr/lib64/') and not '/usr/lib64' in system_libdirs:
+            system_libdirs.append('/usr/lib64')
+    del path
+
+    # Make sure we have at least one of /usr/lib64 or /usr/lib, but not both
+    if not '/usr/lib64' in system_libdirs:
+        system_libdirs.append('/usr/lib')
 
 # default buildscript.  You should probably leave this as the default.
 # In particular, don't set it to 'gtk'.
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 06ed13b..991e25e 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -189,10 +189,7 @@ class Package:
 
     def eval_args(self, args):
         args = args.replace('${prefix}', self.config.prefix)
-        libsubdir = 'lib'
-        if self.config.use_lib64:
-            libsubdir = 'lib64'
-        libdir = os.path.join(self.config.prefix, libsubdir)
+        libdir = os.path.join(self.config.prefix, 'lib')
         args = args.replace('${libdir}', libdir)
         return args
 
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 41e4b12..0271ac4 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -107,8 +107,7 @@ class AutogenModule(MakeModule, DownloadableModule):
         if self.autogen_template:
             template = self.autogen_template
         else:
-            template = ("%(srcdir)s/%(autogen-sh)s --prefix %(prefix)s"
-                        " --libdir %(libdir)s %(autogenargs)s ")
+            template = ("%(srcdir)s/%(autogen-sh)s --prefix %(prefix)s %(autogenargs)s ")
 
         autogenargs = self.autogenargs + ' ' + self.config.module_autogenargs.get(
                 self.name, self.config.autogenargs)
@@ -122,11 +121,6 @@ class AutogenModule(MakeModule, DownloadableModule):
         else:
             vars['srcdir'] = '.'
 
-        if buildscript.config.use_lib64:
-            vars['libdir'] = "'${exec_prefix}/lib64'"
-        else:
-            vars['libdir'] = "'${exec_prefix}/lib'"
-
         cmd = self.static_analyzer_pre_cmd(buildscript) + template % vars
 
         if self.autogen_sh == 'autoreconf':
diff --git a/jhbuild/modtypes/cmake.py b/jhbuild/modtypes/cmake.py
index e20ea09..a6c8d4b 100644
--- a/jhbuild/modtypes/cmake.py
+++ b/jhbuild/modtypes/cmake.py
@@ -48,10 +48,7 @@ class CMakeModule(MakeModule, DownloadableModule):
 
     def eval_args(self, args):
         args = Package.eval_args(self, args)
-        libsuffix = ''
-        if self.config.use_lib64:
-            libsuffix = '64'
-        args = args.replace('${libsuffix}', libsuffix)
+        args = args.replace('${libsuffix}', '')
         return args
 
     def get_srcdir(self, buildscript):
@@ -80,8 +77,7 @@ class CMakeModule(MakeModule, DownloadableModule):
         prefix = os.path.expanduser(buildscript.config.prefix)
         if not inpath('cmake', os.environ['PATH'].split(os.pathsep)):
             raise CommandError(_('%s not found') % 'cmake')
-        baseargs = '-DCMAKE_INSTALL_PREFIX=%s -DLIB_INSTALL_DIR=%s -Dlibdir=%s' % (
-                        prefix, buildscript.config.libdir, buildscript.config.libdir)
+        baseargs = '-DCMAKE_INSTALL_PREFIX=%s' % prefix
         cmakeargs = self.get_cmakeargs()
         # CMake on Windows generates VS projects or NMake makefiles by default.
         # When using MSYS "MSYS Makefiles" is the best guess. "Unix Makefiles"
diff --git a/jhbuild/modtypes/waf.py b/jhbuild/modtypes/waf.py
index e62e0a5..2d6eab3 100644
--- a/jhbuild/modtypes/waf.py
+++ b/jhbuild/modtypes/waf.py
@@ -77,8 +77,6 @@ class WafModule(Package, DownloadableModule):
         if buildscript.config.buildroot and not os.path.exists(builddir):
             os.makedirs(builddir)
         cmd = [self.waf_cmd, 'configure', '--prefix', buildscript.config.prefix]
-        if buildscript.config.use_lib64:
-            cmd += ["--libdir", os.path.join(buildscript.config.prefix, "lib64")]
         buildscript.execute(cmd, cwd=builddir, extra_env={'PYTHON': self.python_cmd})
     do_configure.depends = [PHASE_CHECKOUT]
     do_configure.error_phases = [PHASE_FORCE_CHECKOUT]


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