[PATCHSET] fix regedit build (Re: [SCM] Samba Shared Repository - branch master updated)

Michael Adam obnox at samba.org
Mon May 6 06:31:13 MDT 2013


Hi Matthieu,

(Note: I am pulling this to samba-technical instead of samba-cvs.)

Matthieu Patou wrote:
> Hi Andreas and Micheal,
> 
> On 04/29/2013 06:03 AM, Michael Adam wrote:
> >The branch, master has been updated
> >        via  08d7cae regedit: Use color only when available.
> ...
> >        via  86f88ee waf: Create a better wscript for finding ncurses.
> With this patch (and maybe some others) we have a strong dependency on 
> ncurses lib and headers but the configure script is not failing if they 
> are not found.
> Can you fix this so either we don't build the program that depends on 
> ncurses or that the configure fails it would be nicer than the build 
> (it's currently what is happening).

Thanks for pointing this out and sorry for the inconvenience..

Attached find a patchset that fixes the configure checks so that:

- if --with-regedit=no or --without-regedit is specified, no
  ncurses configure checks are done.
- if --with-regedit is specified and ncurses is not found,
  then configure fails with an error
- if --with-regedit=auto is specified (and this is now the
  default behaviour), then regedit is built if and only if
  ncurses is found. And it is not an error if ncurses is not
  found.

Comments (or reviewed push) welcome. :-)

Cheers - Michael

> Ps: there is a bug for this: https://bugzilla.samba.org/show_bug.cgi?id=9850

Ok. Not quite sure what to do here, since the regedit and
corresponding checks are not in any release. This discussion
here, I consider sufficient for master.

-------------- next part --------------
From 5d6e80daeed73929b7f5eac4f41ba3c95d93c4b3 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Mon, 6 May 2013 13:19:24 +0200
Subject: [PATCH 1/3] build: simplify ncurses checks: --with-regedit does not
 take a path list

--with-regedit is defined using SAMBA3_ADD_OPTION(), and can hence
take the values "yes", "no", and "auto". So it is not possible to
hand in paths to look for ncurses-config via this option.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/wscript_configure_system_ncurses |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/source3/wscript_configure_system_ncurses b/source3/wscript_configure_system_ncurses
index e8c4ab5..e7596be 100644
--- a/source3/wscript_configure_system_ncurses
+++ b/source3/wscript_configure_system_ncurses
@@ -2,14 +2,9 @@ import Logs, Options, sys
 
 Logs.info("Looking for ncurses features")
 
-if isinstance(Options.options.with_regedit, list):
-    path_ncurses_config = [x+'/bin' for x in Options.options.with_regedit]
-else:
-    path_ncurses_config = None
-
-conf.find_program('ncurses5-config', path_list=path_ncurses_config, var='NCURSES_CONFIG')
+conf.find_program('ncurses5-config', var='NCURSES_CONFIG')
 if not conf.env.NCURSES_CONFIG:
-    conf.find_program('ncurses6-config', path_list=path_ncurses_config, var='NCURSES_CONFIG')
+    conf.find_program('ncurses6-config', var='NCURSES_CONFIG')
 
 if conf.env.NCURSES_CONFIG:
     conf.check_cfg(path=conf.env.NCURSES_CONFIG, args="--cflags --libs",
-- 
1.7.9.5


From 91c9c5eecb27e0d11d727c2e74e0aceda82bbe7d Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Mon, 6 May 2013 14:14:02 +0200
Subject: [PATCH 2/3] build: fix --with-regedit to properly honour the
 yes/no/auto scheme

I.e. fail configure when ncurses support is not found but
regedit build was requested.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/wscript                          |   17 ++++++++++++++++-
 source3/wscript_configure_system_ncurses |    9 ++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/source3/wscript b/source3/wscript
index 28fa11f..72ab18a 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1713,8 +1713,23 @@ main() {
     if conf.CHECK_HEADERS('cephfs/libcephfs.h', False, False, 'cephfs') and conf.CHECK_LIB('cephfs'):
         conf.DEFINE('HAVE_CEPH', '1')
 
-    if Options.options.with_regedit:
+    conf.env.build_regedit = False
+    if not Options.options.with_regedit == False:
         conf.PROCESS_SEPARATE_RULE('system_ncurses')
+        if conf.CONFIG_SET('HAVE_NCURSES'):
+            conf.env.build_regedit = True
+
+    if conf.env.build_regedit:
+        Logs.info("building regedit")
+    else:
+        if Options.options.with_regedit == False:
+            Logs.info("not building regedit (--without-regedit)")
+        elif Options.options.with_regedit == True:
+            Logs.error("ncurses not available, cannot build regedit")
+            conf.fatal("ncurses not available, but --with-regedit was specified")
+        else:
+            Logs.info("ncurses not available, not building regedit")
+
 
     default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam
                                       auth_sam auth_unix auth_winbind auth_wbc
diff --git a/source3/wscript_configure_system_ncurses b/source3/wscript_configure_system_ncurses
index e7596be..5c80429 100644
--- a/source3/wscript_configure_system_ncurses
+++ b/source3/wscript_configure_system_ncurses
@@ -9,7 +9,6 @@ if not conf.env.NCURSES_CONFIG:
 if conf.env.NCURSES_CONFIG:
     conf.check_cfg(path=conf.env.NCURSES_CONFIG, args="--cflags --libs",
                package="", uselib_store="NCURSES")
-    conf.env.build_regedit = True
 
 conf.CHECK_HEADERS('ncurses.h menu.h panel.h form.h', lib='ncurses')
 
@@ -17,3 +16,11 @@ conf.CHECK_FUNCS_IN('initscr', 'ncurses')
 conf.CHECK_FUNCS_IN('set_menu_items item_count', 'menu')
 conf.CHECK_FUNCS_IN('new_panel show_panel', 'panel')
 conf.CHECK_FUNCS_IN('new_field new_form', 'form')
+
+if conf.CONFIG_SET('HAVE_NCURSES_H') and \
+   conf.CONFIG_SET('HAVE_MENU_H') and \
+   conf.CONFIG_SET('HAVE_PANEL_H') and \
+   conf.CONFIG_SET('HAVE_FORM_H'):
+    conf.DEFINE('HAVE_NCURSES', '1')
+else:
+    conf.undefine('HAVE_NCURSES')
-- 
1.7.9.5


From 999643bcea216be46736fab2a4be1856f3ab337f Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Mon, 6 May 2013 13:16:49 +0200
Subject: [PATCH 3/3] build: default --with-regedit to "auto" instead of "yes"

This means we don't build regedit when there is no ncurses
and this is not an error for the overall build.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/wscript |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/wscript b/source3/wscript
index 72ab18a..5e45fac 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -47,7 +47,7 @@ def set_options(opt):
 
     opt.SAMBA3_ADD_OPTION('cluster-support', default=None)
 
-    opt.SAMBA3_ADD_OPTION('regedit', default=True)
+    opt.SAMBA3_ADD_OPTION('regedit', default=None)
 
     opt.add_option('--with-ctdb-dir',
                    help=("Directory under which ctdb is installed"),
-- 
1.7.9.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 206 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130506/2c7b4f63/attachment.pgp>


More information about the samba-technical mailing list