Andrew Geissler | e231d58 | 2020-05-05 08:53:09 -0500 | [diff] [blame^] | 1 | From 1e8d31c138395122df4cc2a3e0edd6cd3fad736c Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Kjellerstedt <pkj@axis.com> |
| 3 | Date: Tue, 28 Apr 2020 02:05:33 +0200 |
| 4 | Subject: [PATCH] Add options to configure the use of libbsd |
| 5 | |
| 6 | Upstream-Status: Inappropriate [oe deterministic build specific] |
| 7 | Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> |
| 8 | --- |
| 9 | buildtools/wafsamba/wscript | 7 +++++++ |
| 10 | lib/crypto/wscript_configure | 2 +- |
| 11 | lib/replace/wscript | 29 +++++++++++++++-------------- |
| 12 | lib/texpect/wscript | 7 ++++++- |
| 13 | 4 files changed, 29 insertions(+), 16 deletions(-) |
| 14 | |
| 15 | diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript |
| 16 | index 7b8fb01..a8e4b0a 100644 |
| 17 | --- a/buildtools/wafsamba/wscript |
| 18 | +++ b/buildtools/wafsamba/wscript |
| 19 | @@ -88,6 +88,13 @@ def options(opt): |
| 20 | help=("Disable use of gettext"), |
| 21 | action="store_true", dest='disable_gettext', default=False) |
| 22 | |
| 23 | + opt.add_option('--with-libbsd', |
| 24 | + help=("Enable use of libbsd"), |
| 25 | + action="store_true", dest='enable_libbsd') |
| 26 | + opt.add_option('--without-libbsd', |
| 27 | + help=("Disable use of libbsd"), |
| 28 | + action="store_false", dest='enable_libbsd', default=False) |
| 29 | + |
| 30 | gr = opt.option_group('developer options') |
| 31 | |
| 32 | gr.add_option('-C', |
| 33 | diff --git a/lib/crypto/wscript_configure b/lib/crypto/wscript_configure |
| 34 | index 09dfe04..e871718 100644 |
| 35 | --- a/lib/crypto/wscript_configure |
| 36 | +++ b/lib/crypto/wscript_configure |
| 37 | @@ -2,7 +2,7 @@ |
| 38 | from waflib import Options |
| 39 | from waflib import Errors, Logs |
| 40 | |
| 41 | -if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h', |
| 42 | +if not Options.options.enable_libbsd or not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h', |
| 43 | checklibc=True): |
| 44 | conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h', |
| 45 | checklibc=True) |
| 46 | diff --git a/lib/replace/wscript b/lib/replace/wscript |
| 47 | index 0020d2a..cd9228f 100644 |
| 48 | --- a/lib/replace/wscript |
| 49 | +++ b/lib/replace/wscript |
| 50 | @@ -407,20 +407,21 @@ def configure(conf): |
| 51 | |
| 52 | strlcpy_in_bsd = False |
| 53 | |
| 54 | - # libbsd on some platforms provides strlcpy and strlcat |
| 55 | - if not conf.CHECK_FUNCS('strlcpy strlcat'): |
| 56 | - if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', |
| 57 | - checklibc=True): |
| 58 | - strlcpy_in_bsd = True |
| 59 | - if not conf.CHECK_FUNCS('getpeereid'): |
| 60 | - conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') |
| 61 | - if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): |
| 62 | - conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') |
| 63 | - if not conf.CHECK_FUNCS('setproctitle_init'): |
| 64 | - conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') |
| 65 | - |
| 66 | - if not conf.CHECK_FUNCS('closefrom'): |
| 67 | - conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') |
| 68 | + if Options.options.enable_libbsd: |
| 69 | + # libbsd on some platforms provides strlcpy and strlcat |
| 70 | + if not conf.CHECK_FUNCS('strlcpy strlcat'): |
| 71 | + if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', |
| 72 | + checklibc=True): |
| 73 | + strlcpy_in_bsd = True |
| 74 | + if not conf.CHECK_FUNCS('getpeereid'): |
| 75 | + conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') |
| 76 | + if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): |
| 77 | + conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') |
| 78 | + if not conf.CHECK_FUNCS('setproctitle_init'): |
| 79 | + conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') |
| 80 | + |
| 81 | + if not conf.CHECK_FUNCS('closefrom'): |
| 82 | + conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') |
| 83 | |
| 84 | conf.CHECK_CODE(''' |
| 85 | struct ucred cred; |
| 86 | diff --git a/lib/texpect/wscript b/lib/texpect/wscript |
| 87 | index e14c048..a91de59 100644 |
| 88 | --- a/lib/texpect/wscript |
| 89 | +++ b/lib/texpect/wscript |
| 90 | @@ -1,7 +1,12 @@ |
| 91 | #!/usr/bin/env python |
| 92 | +from waflib import Options |
| 93 | |
| 94 | def configure(conf): |
| 95 | - conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers='pty.h util.h bsd/libutil.h libutil.h') |
| 96 | + hdrs = 'pty.h util.h' |
| 97 | + if Options.options.enable_libbsd: |
| 98 | + hdrs += ' bsd/libutil.h' |
| 99 | + hdrs += ' libutil.h' |
| 100 | + conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers=hdrs) |
| 101 | |
| 102 | def build(bld): |
| 103 | bld.SAMBA_BINARY('texpect', 'texpect.c', deps='popt util replace', install=False) |