[jhbuild/desrt/packagedb: 11/21] MakeModule: add needs_gmake flag



commit 36b09d8e08147dc35d066cd217e8759818de542b
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Jan 4 11:37:27 2015 -0500

    MakeModule: add needs_gmake flag
    
    Add a needs_gmake flag for MakeModule.
    
    If this is set to True (which is the default for autotools) and the
    'gmake' condition is set then the 'gmake' command will be used instead
    of 'make'.
    
    This helps with systems where the system 'make' is not GNU make.
    
    This patch effectively establishes an assumption that all autotools
    packages will require gmake.  In the unlikely event that this proves to
    cause trouble for someone, we could easily add a needs-gmake attribute
    to the XML to allow people to set it back to 'false'.
    
    Since the make command might now be 'gmake', make sure we take the
    correct one for the creation of virtual sysdeps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742292

 jhbuild/modtypes/__init__.py  |   11 +++++++++--
 jhbuild/modtypes/autotools.py |    7 ++++---
 jhbuild/modtypes/cmake.py     |    2 +-
 jhbuild/moduleset.py          |    1 +
 4 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index cb0631d..2468ccf 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -500,11 +500,12 @@ class MakeModule(Package):
     '''A base class for modules that use the command 'make' within the build
     process.'''
     def __init__(self, name, branch=None, makeargs='', makeinstallargs='',
-                  makefile='Makefile'):
+                  makefile='Makefile', needs_gmake=False):
         Package.__init__(self, name, branch=branch)
         self.makeargs = makeargs
         self.makeinstallargs = makeinstallargs
         self.makefile = makefile
+        self.needs_gmake = needs_gmake
 
     def get_makeargs(self, buildscript, add_parallel=True):
         makeargs = ' %s %s' % (self.makeargs,
@@ -519,8 +520,14 @@ class MakeModule(Package):
             makeargs = re.sub(r'-j\w*\d+', '', makeargs) + ' -j 1'
         return self.eval_args(makeargs).strip()
 
+    def get_makecmd(self, config):
+        if self.needs_gmake and 'gmake' in config.conditions:
+            return 'gmake'
+        else:
+            return 'make'
+
     def make(self, buildscript, target='', pre='', makeargs=None):
-        makecmd = os.environ.get('MAKE', 'make')
+        makecmd = os.environ.get('MAKE', self.get_makecmd(buildscript.config))
 
         if makeargs is None:
             makeargs = self.get_makeargs(self, buildscript)
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 257f722..d5c43cf 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -63,9 +63,10 @@ class AutogenModule(MakeModule, DownloadableModule):
                  makefile='Makefile',
                  autogen_template=None,
                  check_target=True,
-                 supports_static_analyzer=True):
+                 supports_static_analyzer=True,
+                 needs_gmake=True):
         MakeModule.__init__(self, name, branch=branch, makeargs=makeargs,
-                            makeinstallargs=makeinstallargs, makefile=makefile)
+                            makeinstallargs=makeinstallargs, makefile=makefile, needs_gmake=needs_gmake)
         self.autogenargs = autogenargs
         self.supports_non_srcdir_builds = supports_non_srcdir_builds
         self.skip_autogen = skip_autogen
@@ -373,7 +374,7 @@ def collect_args(instance, node, argtype):
 def parse_autotools(node, config, uri, repositories, default_repo):
     instance = AutogenModule.parse_from_xml(node, config, uri, repositories, default_repo)
 
-    instance.dependencies += ['automake', 'libtool', 'make']
+    instance.dependencies += ['automake', 'libtool', instance.get_makecmd(config)]
 
     instance.autogenargs = collect_args (instance, node, 'autogenargs')
     instance.makeargs = collect_args (instance, node, 'makeargs')
diff --git a/jhbuild/modtypes/cmake.py b/jhbuild/modtypes/cmake.py
index 044fd4b..519cc90 100644
--- a/jhbuild/modtypes/cmake.py
+++ b/jhbuild/modtypes/cmake.py
@@ -129,7 +129,7 @@ class CMakeModule(MakeModule, DownloadableModule):
 def parse_cmake(node, config, uri, repositories, default_repo):
     instance = CMakeModule.parse_from_xml(node, config, uri, repositories, default_repo)
 
-    instance.dependencies += ['cmake', 'make']
+    instance.dependencies += ['cmake', instance.get_makecmd(config)]
 
     if node.hasAttribute('supports-non-srcdir-builds'):
         instance.supports_non_srcdir_builds = \
diff --git a/jhbuild/moduleset.py b/jhbuild/moduleset.py
index 87a2655..5609e09 100644
--- a/jhbuild/moduleset.py
+++ b/jhbuild/moduleset.py
@@ -52,6 +52,7 @@ virtual_sysdeps = [
     'cmake',
     'cvs',
     'git',
+    'gmake',
     'hg',
     'libtool',
     'make',


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