[jhbuild] autotools: Add supports-unknown-configure-options attribute



commit 0b8f95d6c7407946137febe65c48dc92cf204477
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Jul 22 19:38:07 2017 -0700

    autotools: Add supports-unknown-configure-options attribute
    
    According to https://github.com/cgwalters/build-api,
    
    "The configure script MUST either ignore unknown options that start with
    --enable- and --disable-, or accept an argument --help which prints valid
    options."
    
    For packages that choose the latter in hand-rolled configure scripts, add
    a module attribute: supports-unknown-configure-options="no". This is
    currently used for mozjs, and is also required for building some
    dependencies on macOS.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785257

 doc/C/index.docbook                            |    6 ++++++
 jhbuild/modtypes/autotools.py                  |   15 ++++++++++++---
 modulesets/gnome-suites-core-deps-3.26.modules |    1 +
 modulesets/moduleset.dtd                       |    1 +
 modulesets/moduleset.rnc                       |    1 +
 5 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 36cd2da..86e3a5e 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -2915,6 +2915,7 @@ Optional packages: (JHBuild will build the missing packages)
              [ check-target="<replaceable>check-target</replaceable>" ]
              [ supports-non-srcdir-builds="<replaceable>supports-non-srcdir-builds</replaceable>" ]
              [ force-non-srcdir-builds="<replaceable>force-non-srcdir-builds</replaceable>" ]
+             [ 
supports-unknown-configure-options="<replaceable>supports-unknown-configure-options</replaceable>" ]
              [ supports-static-analyzer="<replaceable>supports-static-analyzer</replaceable>" ]&gt;
 
   &lt;branch [ ... ] &gt;
@@ -2994,6 +2995,11 @@ Optional packages: (JHBuild will build the missing packages)
           attribute must be specified (with false as value) for modules which
           don’t support being built under a static analysis tool such as
           <command>scan-build</command>.</para>
+
+        <para>The <sgmltag class="attribute">supports-unknown-configure-options</sgmltag>
+          attribute is used to mark modules that will error out if an unknown
+          option is passed to <filename>configure</filename>. Global configure
+          options will not be used for that module.</para>
       </section>
 
       <section id="moduleset-syntax-defs-cmake">
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index fa37280..8093539 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -62,7 +62,8 @@ class AutogenModule(MakeModule, DownloadableModule):
                  autogen_template=None,
                  check_target=True,
                  supports_static_analyzer=True,
-                 needs_gmake=True):
+                 needs_gmake=True,
+                 supports_unknown_configure_options=True):
         MakeModule.__init__(self, name, branch=branch, makeargs=makeargs,
                             makeinstallargs=makeinstallargs, makefile=makefile, needs_gmake=needs_gmake)
         self.autogenargs = autogenargs
@@ -75,6 +76,7 @@ class AutogenModule(MakeModule, DownloadableModule):
         self.check_target = check_target
         self.supports_install_destdir = True
         self.supports_static_analyzer = supports_static_analyzer
+        self.supports_unknown_configure_options = supports_unknown_configure_options
 
     def get_srcdir(self, buildscript):
         return self.branch.srcdir
@@ -112,10 +114,12 @@ class AutogenModule(MakeModule, DownloadableModule):
         else:
             template = ("%(srcdir)s/%(autogen-sh)s --prefix %(prefix)s %(autogenargs)s ")
 
+        default_autogenargs = (self.config.autogenargs
+            if self.supports_unknown_configure_options else '')
         autogenargs = self.autogenargs + ' ' + self.config.module_autogenargs.get(
-                self.name, self.config.autogenargs)
+                self.name, default_autogenargs)
 
-        if self.config.disable_Werror:
+        if self.config.disable_Werror and self.supports_unknown_configure_options:
             autogenargs = '--disable-Werror' + ' ' + autogenargs
 
         vars = {'prefix': os.path.splitdrive(buildscript.config.prefix)[1],
@@ -345,6 +349,8 @@ class AutogenModule(MakeModule, DownloadableModule):
                  ('makeinstallargs', 'makeinstallargs', ''),
                  ('supports-non-srcdir-builds',
                   'supports_non_srcdir_builds', True),
+                 ('supports-unknown-configure-options',
+                  'supports_unknown_configure_options', True),
                  ('skip-autogen', 'skip_autogen', False),
                  ('skip-install', 'skip_install_phase', False),
                  ('uninstall-before-install', 'uninstall_before_install', False),
@@ -382,6 +388,9 @@ def parse_autotools(node, config, uri, repositories, default_repo):
     if node.hasAttribute('supports-non-srcdir-builds'):
         instance.supports_non_srcdir_builds = \
                 (node.getAttribute('supports-non-srcdir-builds') != 'no')
+    if node.hasAttribute('supports-unknown-configure-options'):
+        instance.supports_unknown_configure_options = \
+                (node.getAttribute('supports-unknown-configure-options') != 'no')
     if node.hasAttribute('skip-autogen'):
         skip_autogen = node.getAttribute('skip-autogen')
         if skip_autogen == 'true':
diff --git a/modulesets/gnome-suites-core-deps-3.26.modules b/modulesets/gnome-suites-core-deps-3.26.modules
index 47215e3..d5a1143 100644
--- a/modulesets/gnome-suites-core-deps-3.26.modules
+++ b/modulesets/gnome-suites-core-deps-3.26.modules
@@ -1560,6 +1560,7 @@
   </autotools>
 
   <autotools id="mozjs52" autogen-sh="js/src/configure"
+             supports-unknown-configure-options="no"
              autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s %(autogenargs)s"
              autogenargs="--enable-posix-nspr-emulation --with-system-zlib --with-intl-api 
AUTOCONF=autoconf">
     <!-- prefix option must have an = sign in mozilla's configure -->
diff --git a/modulesets/moduleset.dtd b/modulesets/moduleset.dtd
index 06eeb2a..bee1a6a 100644
--- a/modulesets/moduleset.dtd
+++ b/modulesets/moduleset.dtd
@@ -65,6 +65,7 @@
        uninstall-before-install (true|false) "false"
        supports-non-srcdir-builds (yes|no) "yes"
        supports-parallel-builds (yes|no) "yes"
+       supports-unknown-configure-options (yes|no) "yes"
        autogen-template CDATA  #IMPLIED
        check-target    (true|false) "true">
 
diff --git a/modulesets/moduleset.rnc b/modulesets/moduleset.rnc
index 3b8b7f3..a67abed 100644
--- a/modulesets/moduleset.rnc
+++ b/modulesets/moduleset.rnc
@@ -94,6 +94,7 @@ attlist.autotools &=
   attribute uninstall-before-install { "true" | "false" }?,
   attribute supports-non-srcdir-builds { "yes" | "no" }?,
   attribute supports-parallel-builds { "yes" | "no" }?,
+  attribute supports-unknown-configure-options { "yes" | "no" }?,
   attribute autogen-template { text }?,
   [ a:defaultValue = "true" ]
   attribute check-target { "true" | "false" }?


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