blob: 2b0fbff8e71bbfd8525f635063c9c7e09fbb440c [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From 515f2455b4b69f5fcd2c61a532663280785db737 Mon Sep 17 00:00:00 2001
Andrew Geisslere231d582020-05-05 08:53:09 -05002From: Peter Kjellerstedt <pkj@axis.com>
3Date: Tue, 28 Apr 2020 02:05:33 +0200
4Subject: [PATCH] Add options to configure the use of libbsd
5
6Upstream-Status: Inappropriate [oe deterministic build specific]
7Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Andrew Geissler69721092021-07-23 12:57:00 -04008
9Rebase to 4.14.4
10Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Andrew Geisslere231d582020-05-05 08:53:09 -050011---
Andrew Geissler69721092021-07-23 12:57:00 -040012 buildtools/wafsamba/wscript | 7 +++++++
13 lib/replace/wscript | 29 +++++++++++++++--------------
14 lib/texpect/wscript | 8 +++++++-
15 3 files changed, 29 insertions(+), 15 deletions(-)
Andrew Geisslere231d582020-05-05 08:53:09 -050016
17diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
Andrew Geissler517393d2023-01-13 08:55:19 -060018index 8729b08..1c55428 100644
Andrew Geisslere231d582020-05-05 08:53:09 -050019--- a/buildtools/wafsamba/wscript
20+++ b/buildtools/wafsamba/wscript
Andrew Geissler517393d2023-01-13 08:55:19 -060021@@ -145,6 +145,13 @@ Currently the only tested value is 'smbtorture,smbd/smbd' for Samba'''),
Andrew Geisslere231d582020-05-05 08:53:09 -050022 help=("Disable use of gettext"),
23 action="store_true", dest='disable_gettext', default=False)
24
25+ opt.add_option('--with-libbsd',
26+ help=("Enable use of libbsd"),
27+ action="store_true", dest='enable_libbsd')
28+ opt.add_option('--without-libbsd',
29+ help=("Disable use of libbsd"),
30+ action="store_false", dest='enable_libbsd', default=False)
31+
32 gr = opt.option_group('developer options')
33
34 gr.add_option('-C',
Andrew Geisslere231d582020-05-05 08:53:09 -050035diff --git a/lib/replace/wscript b/lib/replace/wscript
Andrew Geissler517393d2023-01-13 08:55:19 -060036index 9ef9bd9..d47de4f 100644
Andrew Geisslere231d582020-05-05 08:53:09 -050037--- a/lib/replace/wscript
38+++ b/lib/replace/wscript
Andrew Geissler517393d2023-01-13 08:55:19 -060039@@ -439,20 +439,21 @@ def configure(conf):
Andrew Geisslere231d582020-05-05 08:53:09 -050040
41 strlcpy_in_bsd = False
42
43- # libbsd on some platforms provides strlcpy and strlcat
44- if not conf.CHECK_FUNCS('strlcpy strlcat'):
45- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
46- checklibc=True):
47- strlcpy_in_bsd = True
48- if not conf.CHECK_FUNCS('getpeereid'):
49- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
50- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
51- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
52- if not conf.CHECK_FUNCS('setproctitle_init'):
53- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
54-
55- if not conf.CHECK_FUNCS('closefrom'):
56- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
57+ if Options.options.enable_libbsd:
58+ # libbsd on some platforms provides strlcpy and strlcat
59+ if not conf.CHECK_FUNCS('strlcpy strlcat'):
60+ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
61+ checklibc=True):
62+ strlcpy_in_bsd = True
63+ if not conf.CHECK_FUNCS('getpeereid'):
64+ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
65+ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
66+ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
67+ if not conf.CHECK_FUNCS('setproctitle_init'):
68+ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
69+
70+ if not conf.CHECK_FUNCS('closefrom'):
71+ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
72
73 conf.CHECK_CODE('''
74 struct ucred cred;
75diff --git a/lib/texpect/wscript b/lib/texpect/wscript
Andrew Geissler517393d2023-01-13 08:55:19 -060076index 44f92a8..79e8d09 100644
Andrew Geisslere231d582020-05-05 08:53:09 -050077--- a/lib/texpect/wscript
78+++ b/lib/texpect/wscript
Andrew Geissler69721092021-07-23 12:57:00 -040079@@ -1,7 +1,13 @@
Andrew Geisslere231d582020-05-05 08:53:09 -050080 #!/usr/bin/env python
Andrew Geisslere231d582020-05-05 08:53:09 -050081
Andrew Geissler69721092021-07-23 12:57:00 -040082+from waflib import Options
83+
Andrew Geisslere231d582020-05-05 08:53:09 -050084 def configure(conf):
85- conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers='pty.h util.h bsd/libutil.h libutil.h')
86+ hdrs = 'pty.h util.h'
87+ if Options.options.enable_libbsd:
88+ hdrs += ' bsd/libutil.h'
89+ hdrs += ' libutil.h'
90+ conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers=hdrs)
91
92 def build(bld):
Andrew Geissler69721092021-07-23 12:57:00 -040093 bld.SAMBA_BINARY('texpect',
94--
Andrew Geissler517393d2023-01-13 08:55:19 -0600952.25.1
Andrew Geissler69721092021-07-23 12:57:00 -040096