1From 100d16aaa6fe9a28a5ba77b2de2bde81a3fa3dac Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 1 Jul 2019 16:14:16 +0800
4Subject: [PATCH] ldb: Add configure options for packages
5
6Add configure options for the following packages:
7 - acl
8 - attr
9 - libaio
10 - libbsd
11 - libcap
12 - valgrind
13
14Upstream-Status: Inappropriate [oe deterministic build specific]
15
16Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
17
18upgrade to version 1.5.4
19Signed-off-by: Changqing Li <changqing.li@windriver.com>
20
21Rebase to 2.3.0
22Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
23---
24 lib/replace/wscript | 90 +++++++++++++++++++++++++++++++++++----------
25 wscript             |  8 ++++
26 2 files changed, 78 insertions(+), 20 deletions(-)
27
28diff --git a/lib/replace/wscript b/lib/replace/wscript
29index 2c856b6..36b696d 100644
30--- a/lib/replace/wscript
31+++ b/lib/replace/wscript
32@@ -25,6 +25,41 @@ def options(opt):
33     opt.PRIVATE_EXTENSION_DEFAULT('')
34     opt.RECURSE('buildtools/wafsamba')
35
36+    opt.add_option('--with-acl',
37+                   help=("Enable use of acl"),
38+                   action="store_true", dest='enable_acl')
39+    opt.add_option('--without-acl',
40+                   help=("Disable use of acl"),
41+                   action="store_false", dest='enable_acl', default=False)
42+
43+    opt.add_option('--with-attr',
44+                   help=("Enable use of attr"),
45+                   action="store_true", dest='enable_attr')
46+    opt.add_option('--without-attr',
47+                   help=("Disable use of attr"),
48+                   action="store_false", dest='enable_attr', default=False)
49+
50+    opt.add_option('--with-libaio',
51+                   help=("Enable use of libaio"),
52+                   action="store_true", dest='enable_libaio')
53+    opt.add_option('--without-libaio',
54+                   help=("Disable use of libaio"),
55+                   action="store_false", dest='enable_libaio', default=False)
56+
57+    opt.add_option('--with-libbsd',
58+                   help=("Enable use of libbsd"),
59+                   action="store_true", dest='enable_libbsd')
60+    opt.add_option('--without-libbsd',
61+                   help=("Disable use of libbsd"),
62+                   action="store_false", dest='enable_libbsd', default=False)
63+
64+    opt.add_option('--with-libcap',
65+                   help=("Enable use of libcap"),
66+                   action="store_true", dest='enable_libcap')
67+    opt.add_option('--without-libcap',
68+                   help=("Disable use of libcap"),
69+                   action="store_false", dest='enable_libcap', default=False)
70+
71 @Utils.run_once
72 def configure(conf):
73     conf.RECURSE('buildtools/wafsamba')
74@@ -35,12 +70,25 @@ def configure(conf):
75     conf.DEFINE('HAVE_LIBREPLACE', 1)
76     conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1)
77
78-    conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h')
79-    conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h')
80+    conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h')
81+    conf.CHECK_HEADERS('compat.h ctype.h dustat.h')
82     conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h')
83     conf.CHECK_HEADERS('locale.h ndir.h pwd.h')
84-    conf.CHECK_HEADERS('shadow.h sys/acl.h')
85-    conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
86+    conf.CHECK_HEADERS('shadow.h')
87+    conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h')
88+
89+    if Options.options.enable_acl:
90+        conf.CHECK_HEADERS('acl/libacl.h sys/acl.h')
91+
92+    if Options.options.enable_attr:
93+        conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h')
94+
95+    if Options.options.enable_libaio:
96+        conf.CHECK_HEADERS('libaio.h')
97+
98+    if Options.options.enable_libcap:
99+        conf.CHECK_HEADERS('sys/capability.h')
100+
101     conf.CHECK_HEADERS('port.h')
102     conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h')
103     conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h')
104@@ -121,8 +169,9 @@ def configure(conf):
105     conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h')
106     conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h')
107
108-    conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h')
109-    conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h')
110+    if Options.options.enable_valgrind:
111+        conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h')
112+        conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h')
113     conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h')
114     conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h')
115     conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h')
116@@ -418,20 +467,21 @@ def configure(conf):
117
118     strlcpy_in_bsd = False
119
120-    # libbsd on some platforms provides strlcpy and strlcat
121-    if not conf.CHECK_FUNCS('strlcpy strlcat'):
122-        if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
123-                               checklibc=True):
124-            strlcpy_in_bsd = True
125-    if not conf.CHECK_FUNCS('getpeereid'):
126-        conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
127-    if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
128-        conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
129-    if not conf.CHECK_FUNCS('setproctitle_init'):
130-        conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
131-
132-    if not conf.CHECK_FUNCS('closefrom'):
133-        conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
134+    if Options.options.enable_libbsd:
135+        # libbsd on some platforms provides strlcpy and strlcat
136+        if not conf.CHECK_FUNCS('strlcpy strlcat'):
137+            if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
138+                                   checklibc=True):
139+                strlcpy_in_bsd = True
140+        if not conf.CHECK_FUNCS('getpeereid'):
141+            conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
142+        if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
143+            conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
144+        if not conf.CHECK_FUNCS('setproctitle_init'):
145+            conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
146+
147+        if not conf.CHECK_FUNCS('closefrom'):
148+            conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
149
150     conf.CHECK_CODE('''
151                 struct ucred cred;
152diff --git a/wscript b/wscript
153index bf6129b..722fdf6 100644
154--- a/wscript
155+++ b/wscript
156@@ -39,6 +39,14 @@ def options(opt):
157                    help='disable new LMDB backend for LDB',
158                    action='store_true', dest='without_ldb_lmdb', default=False)
159
160+    opt.add_option('--with-valgrind',
161+                   help=("enable use of valgrind"),
162+                   action="store_true", dest='enable_valgrind')
163+    opt.add_option('--without-valgrind',
164+                   help=("disable use of valgrind"),
165+                   action="store_false", dest='enable_valgrind', default=False)
166+
167+
168
169 def configure(conf):
170     conf.RECURSE('lib/tdb')
171--
1722.17.1
173
174