1From 613cfb43622f0138edfcf3ad7a8fecc568e17db4 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 19 Jun 2019 17:53:34 +0800
4Subject: [PATCH] tdb: Add configure options for packages
5
6Add configure options for the following packages:
7 - acl
8 - attr
9 - libbsd
10 - libcap
11 - valgrind
12
13Upstream-Status: Inappropriate [oe deterministic build specific]
14
15Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
16
17Update to 1.4.0
18
19Signed-off-by: Changqing Li <changqing.li@windriver.com>
20
21Rebase to 1.4.9
22Remove libaio option
23Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
24
25Rebase to 1.4.10
26Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
27---
28 lib/replace/wscript | 101 ++++++++++++++++++++++++++++++--------------
29 wscript             |   6 +++
30 2 files changed, 76 insertions(+), 31 deletions(-)
31
32diff --git a/lib/replace/wscript b/lib/replace/wscript
33index 77e655b..e6d50b3 100644
34--- a/lib/replace/wscript
35+++ b/lib/replace/wscript
36@@ -25,6 +25,34 @@ def options(opt):
37     opt.PRIVATE_EXTENSION_DEFAULT('')
38     opt.RECURSE('buildtools/wafsamba')
39
40+    opt.add_option('--with-acl',
41+                   help=("Enable use of acl"),
42+                   action="store_true", dest='enable_acl')
43+    opt.add_option('--without-acl',
44+                   help=("Disable use of acl"),
45+                   action="store_false", dest='enable_acl', default=False)
46+
47+    opt.add_option('--with-attr',
48+                   help=("Enable use of attr"),
49+                   action="store_true", dest='enable_attr')
50+    opt.add_option('--without-attr',
51+                   help=("Disable use of attr"),
52+                   action="store_false", dest='enable_attr', default=False)
53+
54+    opt.add_option('--with-libbsd',
55+                   help=("Enable use of libbsd"),
56+                   action="store_true", dest='enable_libbsd')
57+    opt.add_option('--without-libbsd',
58+                   help=("Disable use of libbsd"),
59+                   action="store_false", dest='enable_libbsd', default=False)
60+
61+    opt.add_option('--with-libcap',
62+                   help=("Enable use of libcap"),
63+                   action="store_true", dest='enable_libcap')
64+    opt.add_option('--without-libcap',
65+                   help=("Disable use of libcap"),
66+                   action="store_false", dest='enable_libcap', default=False)
67+
68 @Utils.run_once
69 def configure(conf):
70     conf.RECURSE('buildtools/wafsamba')
71@@ -38,12 +66,21 @@ def configure(conf):
72     conf.DEFINE('HAVE_LIBREPLACE', 1)
73     conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1)
74
75-    conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h')
76-    conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h')
77+    conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h')
78+    conf.CHECK_HEADERS('compat.h ctype.h dustat.h')
79     conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h')
80     conf.CHECK_HEADERS('locale.h ndir.h pwd.h')
81-    conf.CHECK_HEADERS('shadow.h sys/acl.h')
82-    conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
83+    conf.CHECK_HEADERS('shadow.h')
84+    conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h')
85+    if Options.options.enable_acl:
86+        conf.CHECK_HEADERS('acl/libacl.h sys/acl.h')
87+
88+    if Options.options.enable_attr:
89+        conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h')
90+
91+    if Options.options.enable_libcap:
92+        conf.CHECK_HEADERS('sys/capability.h')
93+
94     conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h')
95     conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h')
96     conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h')
97@@ -113,8 +150,9 @@ def configure(conf):
98     conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h')
99     conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h')
100
101-    conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h')
102-    conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h valgrind/callgrind.h')
103+    if Options.options.enable_valgrind:
104+        conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h')
105+        conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h valgrind/callgrind.h')
106     conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h')
107     conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h')
108     conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h')
109@@ -443,31 +481,32 @@ def configure(conf):
110
111     strlcpy_in_bsd = False
112
113-    # libbsd on some platforms provides strlcpy and strlcat
114-    if not conf.CHECK_FUNCS('strlcpy strlcat'):
115-        if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
116-                               checklibc=True):
117-            strlcpy_in_bsd = True
118-    elif conf.env.enable_fuzzing:
119-        # Just to complicate it more, some versions of Honggfuzz have
120-        # got strlcpy and strlcat in libc, but not in <string.h>
121-        # (unless it is there coincidentally, on a BSD). Therefore we
122-        # can't use CHECK_FUNCS alone to decide whether to add the
123-        # headers to replace.h.
124-        #
125-        # As this is only known to happen on a fuzzing compiler, we'll
126-        # skip the check when not in fuzzing mode.
127-        conf.CHECK_HEADERS('bsd/string.h')
128-
129-    if not conf.CHECK_FUNCS('getpeereid'):
130-        conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
131-    if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
132-        conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
133-    if not conf.CHECK_FUNCS('setproctitle_init'):
134-        conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
135-
136-    if not conf.CHECK_FUNCS('closefrom'):
137-        conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
138+    if Options.options.enable_libbsd:
139+        # libbsd on some platforms provides strlcpy and strlcat
140+        if not conf.CHECK_FUNCS('strlcpy strlcat'):
141+            if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
142+                                   checklibc=True):
143+                strlcpy_in_bsd = True
144+        elif conf.env.enable_fuzzing:
145+            # Just to complicate it more, some versions of Honggfuzz have
146+            # got strlcpy and strlcat in libc, but not in <string.h>
147+            # (unless it is there coincidentally, on a BSD). Therefore we
148+            # can't use CHECK_FUNCS alone to decide whether to add the
149+            # headers to replace.h.
150+            #
151+            # As this is only known to happen on a fuzzing compiler, we'll
152+            # skip the check when not in fuzzing mode.
153+            conf.CHECK_HEADERS('bsd/string.h')
154+
155+        if not conf.CHECK_FUNCS('getpeereid'):
156+            conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
157+        if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
158+            conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
159+        if not conf.CHECK_FUNCS('setproctitle_init'):
160+            conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
161+
162+        if not conf.CHECK_FUNCS('closefrom'):
163+            conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
164
165     conf.CHECK_CODE('''
166                 struct ucred cred;
167diff --git a/wscript b/wscript
168index 2c587fb..b2164b2 100644
169--- a/wscript
170+++ b/wscript
171@@ -69,6 +69,12 @@ def options(opt):
172                    action="store_true", dest='disable_tdb_mutex_locking',
173                    default=False)
174
175+    opt.add_option('--with-valgrind',
176+                   help=("enable use of valgrind"),
177+                   action="store_true", dest='enable_valgrind')
178+    opt.add_option('--without-valgrind',
179+                   help=("disable use of valgrind"),
180+                   action="store_false", dest='enable_valgrind', default=False)
181
182 def configure(conf):
183     conf.env.disable_tdb_mutex_locking = getattr(Options.options,
184--
1852.34.1
186
187