build: Move socket_wrapper to third_party
authorAndreas Schneider <asn@samba.org>
Tue, 7 Nov 2017 09:51:11 +0000 (10:51 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Sat, 25 Nov 2017 09:14:13 +0000 (10:14 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
buildtools/wafsamba/samba_third_party.py
ctdb/wscript
lib/README
third_party/socket_wrapper/socket_wrapper.c [moved from lib/socket_wrapper/socket_wrapper.c with 99% similarity]
third_party/socket_wrapper/wscript [moved from lib/socket_wrapper/wscript with 95% similarity]
third_party/wscript
wscript
wscript_build

index ac77be74f5ac5050f9aa2466ceb31c59542967e2..170c101099aa38c2ca1190d60d36bc9054d77f59 100644 (file)
@@ -39,3 +39,8 @@ def CHECK_CMOCKA(conf):
     return conf.CHECK_BUNDLED_SYSTEM_PKG('cmocka', minversion='1.1.1')
 
 Build.BuildContext.CHECK_CMOCKA = CHECK_CMOCKA
+
+@conf
+def CHECK_SOCKET_WRAPPER(conf):
+    return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.1.7')
+Build.BuildContext.CHECK_SOCKET_WRAPPER = CHECK_SOCKET_WRAPPER
index fdd187b7d26c99550f911385aafc322b40ac0ec7..f5a248191d2a7d3fc3a6ad24522413e79ce99258 100644 (file)
@@ -30,7 +30,7 @@ default_prefix = Options.default_prefix = '/usr/local'
 
 samba_dist.DIST_DIRS('''ctdb:. lib/replace:lib/replace lib/talloc:lib/talloc
                         lib/tevent:lib/tevent lib/tdb:lib/tdb
-                        lib/socket_wrapper:lib/socket_wrapper
+                        third_party/socket_wrapper:third_party/socket_wrapper
                         third_party/popt:third_party/popt
                         lib/util:lib/util lib/tdb_wrap:lib/tdb_wrap
                         lib/ccan:lib/ccan libcli/util:libcli/util
@@ -112,20 +112,29 @@ def configure(conf):
 
     if conf.CHECK_FOR_THIRD_PARTY():
         conf.RECURSE('third_party/popt')
+        if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'):
+            conf.RECURSE('third_party/socket_wrapper')
+            conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH')
     else:
         if not conf.CHECK_POPT():
             raise Utils.WafError('popt development packages have not been found\nIf third_party is installed, check that it is in the proper place.')
         else:
             conf.define('USING_SYSTEM_POPT', 1)
+        conf.env.SOCKET_WRAPPER_SO_PATH = ''
+
+
+        if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'):
+            if not conf.CHECK_SOCKET_WRAPPER():
+                raise Utils.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
+            else:
+                conf.define('USING_SYSTEM_SOCKET_WRAPPER', 1)
+                conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH')
 
     conf.RECURSE('lib/util')
 
     conf.RECURSE('lib/talloc')
     conf.RECURSE('lib/tevent')
     conf.RECURSE('lib/tdb')
-    if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'):
-        conf.RECURSE('lib/socket_wrapper')
-        conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH')
 
     conf.CHECK_HEADERS('sched.h')
     conf.CHECK_HEADERS('procinfo.h')
@@ -315,6 +324,8 @@ def build(bld):
     bld.RECURSE('lib/replace')
     if bld.CHECK_FOR_THIRD_PARTY():
         bld.RECURSE('third_party/popt')
+        if bld.env.standalone_ctdb or bld.CONFIG_GET('SOCKET_WRAPPER'):
+            bld.RECURSE('third_party/socket_wrapper')
 
     bld.RECURSE('lib/tdb_wrap')
     bld.RECURSE('lib/util')
@@ -323,8 +334,6 @@ def build(bld):
     bld.RECURSE('lib/talloc')
     bld.RECURSE('lib/tevent')
     bld.RECURSE('lib/tdb')
-    if bld.env.standalone_ctdb or bld.CONFIG_GET('SOCKET_WRAPPER'):
-        bld.RECURSE('lib/socket_wrapper')
 
     if bld.env.standalone_ctdb:
         # If a combined build is implemented, CTDB will want to
index 85b7952db8faa0fe06c288385ad05a294a019854..971438b05769cd40ba8f2ce8b4079583c7182045 100644 (file)
@@ -5,8 +5,6 @@ nss_wrapper - Wrapper for the user and group NSS API allowing the use
 popt - Command-line option parsing library
 replace - Provides replacements for standard (POSIX, C99) functions 
           not provided by the host platform.
-socket_wrapper - Wrapper library allowing TCP/IP traffic to be redirected 
-                 over Unix domain sockets.
 subunit - Utilities and bindings for working with the Subunit test result 
           reporting protocol.
 talloc - Hierarchical pool based memory allocator 
similarity index 99%
rename from lib/socket_wrapper/socket_wrapper.c
rename to third_party/socket_wrapper/socket_wrapper.c
index ba289e6fbaf96866a8467f708cf7a372d82fa739..43b92f76f1e55d5499f69d4f59a9e71a643c5e7a 100644 (file)
@@ -1233,7 +1233,7 @@ static int convert_in_un_alloc(struct socket_info *si, const struct sockaddr *in
 
                if (addr == 0) {
                        /* 0.0.0.0 */
-                       is_bcast = 0;
+                       is_bcast = 0;
                        type = d_type;
                        iface = socket_wrapper_default_iface();
                } else if (a_type && addr == 0xFFFFFFFF) {
@@ -2019,7 +2019,7 @@ static int swrap_pcap_get_fd(const char *fname)
        if (fd != -1) {
                struct swrap_file_hdr file_hdr;
                file_hdr.magic          = 0xA1B2C3D4;
-               file_hdr.version_major  = 0x0002;       
+               file_hdr.version_major  = 0x0002;
                file_hdr.version_minor  = 0x0004;
                file_hdr.timezone       = 0x00000000;
                file_hdr.sigfigs        = 0x00000000;
similarity index 95%
rename from lib/socket_wrapper/wscript
rename to third_party/socket_wrapper/wscript
index dbefa83ea330cc951cf5b5b2fcdeacfc82004b9f..514265b92b6925d059cdb93e5b14a9dd4ab8af76 100644 (file)
@@ -5,7 +5,7 @@ import os
 VERSION="1.1.7"
 
 def configure(conf):
-    if conf.CHECK_BUNDLED_SYSTEM('socket_wrapper', minversion=VERSION, set_target=False):
+    if conf.CHECK_SOCKET_WRAPPER():
         conf.DEFINE('USING_SYSTEM_SOCKET_WRAPPER', 1)
         libsocket_wrapper_so_path = 'libsocket_wrapper.so'
     else:
@@ -97,7 +97,7 @@ def configure(conf):
 
         # Create full path to socket_wrapper
         blddir = os.path.realpath(conf.blddir)
-        libsocket_wrapper_so_path = blddir + '/default/lib/socket_wrapper/libsocket-wrapper.so'
+        libsocket_wrapper_so_path = blddir + '/default/third_party/socket_wrapper/libsocket-wrapper.so'
 
     conf.DEFINE('LIBSOCKET_WRAPPER_SO_PATH', libsocket_wrapper_so_path)
     conf.DEFINE('SOCKET_WRAPPER', 1)
index 7c2923f611e679f6e3478146d864a0d399d26bde..a5192eb5f1cbe3c21b1ffa68b8938bf6f6bfd246 100644 (file)
@@ -51,6 +51,8 @@ def configure(conf):
     conf.RECURSE('popt')
     conf.RECURSE('zlib')
     conf.RECURSE('aesni-intel')
+    if conf.CONFIG_GET('ENABLE_SELFTEST'):
+        conf.RECURSE('socket_wrapper')
 
 
 def build(bld):
@@ -75,3 +77,5 @@ def build(bld):
     bld.RECURSE('zlib')
     bld.RECURSE('popt')
     bld.RECURSE('aesni-intel')
+    if bld.CONFIG_GET('SOCKET_WRAPPER'):
+        bld.RECURSE('socket_wrapper')
diff --git a/wscript b/wscript
index 35cb9d1b08d86fffeee748200ac0705c5d2680f6..f7bdb1f3d395c24f5bb709c60a8f4b673da19d3d 100644 (file)
--- a/wscript
+++ b/wscript
@@ -135,6 +135,7 @@ def configure(conf):
         raise Utils.WafError('Python version 3.x is not supported by Samba yet')
 
     conf.RECURSE('dynconfig')
+    conf.RECURSE('selftest')
 
     if conf.CHECK_FOR_THIRD_PARTY():
         conf.RECURSE('third_party')
@@ -154,6 +155,11 @@ def configure(conf):
         else:
             conf.define('USING_SYSTEM_CMOCKA', 1)
 
+        if conf.CONFIG_GET('ENABLE_SELFTEST'):
+            if not conf.CHECK_SOCKET_WRAPPER():
+                raise Utils.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
+            else:
+                conf.define('USING_SYSTEM_SOCKET_WRAPPER', 1)
 
     conf.RECURSE('lib/ldb')
 
@@ -182,11 +188,9 @@ def configure(conf):
     conf.RECURSE('libcli/smbreadline')
     conf.RECURSE('lib/crypto')
     conf.RECURSE('pidl')
-    conf.RECURSE('selftest')
     if conf.CONFIG_GET('ENABLE_SELFTEST'):
         conf.RECURSE('lib/nss_wrapper')
         conf.RECURSE('lib/resolv_wrapper')
-        conf.RECURSE('lib/socket_wrapper')
         conf.RECURSE('lib/uid_wrapper')
         if Options.options.with_pam:
             conf.RECURSE('lib/pam_wrapper')
index 52f8de1c13b1e9d2948702b2f19e143d3a774447..4d8c098e9afd591895f2a48a57317e381ba96fe8 100644 (file)
@@ -71,8 +71,6 @@ if bld.CONFIG_GET('NSS_WRAPPER'):
     bld.RECURSE('lib/nss_wrapper')
 if bld.CONFIG_GET('PAM_WRAPPER') and Options.options.with_pam:
     bld.RECURSE('lib/pam_wrapper')
-if bld.CONFIG_GET('SOCKET_WRAPPER'):
-    bld.RECURSE('lib/socket_wrapper')
 if bld.CONFIG_GET('RESOLV_WRAPPER'):
     bld.RECURSE('lib/resolv_wrapper')
 if bld.CONFIG_GET('UID_WRAPPER'):