Commit 123e8afb authored by Gustavo Zacarias's avatar Gustavo Zacarias Committed by Thomas Petazzoni
Browse files

samba4: bump to version 4.2.0



Now with support for AD DC, ADS and clustering features.
All dropped patches are upstream.

[Thomas: move indentation fixes to a separate patch.]

Signed-off-by: default avatarGustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
parent 7152a505
Loading
Loading
Loading
Loading
+0 −56
Original line number Diff line number Diff line
From 16d88e7813a7739c070a7a1cf6388fd4f236fd99 Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Fri, 31 Jan 2014 06:45:18 -0300
Subject: [PATCHv2] build: find FILE_OFFSET_BITS via array

This makes cross-compiling happy, use a trick similar to autoconf's
AC_CHECK_SIZEOF macro.
Basically we make an array:

static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)];

This gives -1 multiplied by the negation of the condition
(sizeof(off_t) < 8) cast to a long int.
So if the condition is true it gives array[(-1 * 0)] (remember the
condition is cast and negated) thus passing a build test with a 0-sized
array.
If it's false it gives array[(-1 * 1)] thus failing with a
negative-sized array.

Status: Upstream.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 lib/ccan/wscript | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 59b8205..81039d0 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -127,15 +127,18 @@ def configure(conf):
     # Only check for FILE_OFFSET_BITS=64 if off_t is normally small:
     # use raw routines because wrappers include previous _GNU_SOURCE
     # or _FILE_OFFSET_BITS defines.
+    # The math for these tests is:
+    # array[-1 * !((int)(condition)) ] (condition is true) = array[0] = builds
+    # array[-1 * !((int)(condition)) ] (condition is false) = array[-1] = fails
     conf.check(fragment="""#include <sys/types.h>
-               int main(void) { return !(sizeof(off_t) < 8); }""",
-               execute=True, msg='Checking for small off_t',
+               int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; }""",
+               msg='Checking for small off_t',
                define_name='SMALL_OFF_T')
     # Unreliable return value above, hence use define.
     if conf.CONFIG_SET('SMALL_OFF_T'):
         conf.check(fragment="""#include <sys/types.h>
-                   int main(void) { return !(sizeof(off_t) >= 8); }""",
-                   execute=True, msg='Checking for -D_FILE_OFFSET_BITS=64',
+		   int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) >= 8)]; }""",
+                   msg='Checking for -D_FILE_OFFSET_BITS=64',
                    ccflags='-D_FILE_OFFSET_BITS=64',
                    define_name='HAVE_FILE_OFFSET_BITS')
 
-- 
1.8.3.2
+6 −6
Original line number Diff line number Diff line
@@ -5,10 +5,10 @@ and bsd/unistd.h get included.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

diff -Nura samba-4.1.7.orig/lib/replace/wscript samba-4.1.7/lib/replace/wscript
--- samba-4.1.7.orig/lib/replace/wscript	2014-04-17 04:59:14.000000000 -0300
+++ samba-4.1.7/lib/replace/wscript	2014-05-19 09:17:25.561947774 -0300
@@ -253,15 +253,6 @@
diff -Nura samba-4.2.0rc1.orig/lib/replace/wscript samba-4.2.0rc1/lib/replace/wscript
--- samba-4.2.0rc1.orig/lib/replace/wscript	2014-10-01 06:17:32.000000000 -0300
+++ samba-4.2.0rc1/lib/replace/wscript	2014-10-01 07:21:13.559498987 -0300
@@ -282,15 +282,6 @@
     conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign')
     conf.CHECK_FUNCS('prctl')
 
@@ -18,8 +18,8 @@ diff -Nura samba-4.1.7.orig/lib/replace/wscript samba-4.1.7/lib/replace/wscript
-                checklibc=True)
-    if not conf.CHECK_FUNCS('getpeereid'):
-        conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
-    if not conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h'):
-        conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h')
-    if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
-        conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
-
     conf.CHECK_CODE('''
                 struct ucred cred;
+0 −47
Original line number Diff line number Diff line
From fdbdf04a9ab3f3a204e95106c4f8f6729d0bab1a Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Tue, 4 Feb 2014 14:11:52 -0300
Subject: [PATCH] build: allow some python variable overrides

The python variables (settings) are fetched from a running python
interpreter which usually isn't the target one when cross compiling,
hence libraries and flags aren't the same and can pollute the target
build.
Allow some of these variables to be redefined via environment variables
in order to aid cross-compiling.
According to testing python_LDFLAGS and python_LIBDIR should be enough.

Status: Upstream.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 buildtools/wafadmin/Tools/python.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/buildtools/wafadmin/Tools/python.py b/buildtools/wafadmin/Tools/python.py
index ab1e817..35c61c2 100644
--- a/buildtools/wafadmin/Tools/python.py
+++ b/buildtools/wafadmin/Tools/python.py
@@ -193,6 +193,19 @@ MACOSX_DEPLOYMENT_TARGET = %r
 """ % (python, python_prefix, python_SO, python_SYSLIBS, python_LDFLAGS, python_SHLIBS,
 	python_LIBDIR, python_LIBPL, INCLUDEPY, Py_ENABLE_SHARED, python_MACOSX_DEPLOYMENT_TARGET))
 
+	# Allow some python overrides from env vars for cross-compiling
+	os_env = dict(os.environ)
+
+	override_python_LDFLAGS = os_env.get('python_LDFLAGS', None)
+	if override_python_LDFLAGS is not None:
+		conf.log.write("python_LDFLAGS override from environment = %r\n" % (override_python_LDFLAGS))
+		python_LDFLAGS = override_python_LDFLAGS
+
+	override_python_LIBDIR = os_env.get('python_LIBDIR', None)
+	if override_python_LIBDIR is not None:
+		conf.log.write("python_LIBDIR override from environment = %r\n" % (override_python_LIBDIR))
+		python_LIBDIR = override_python_LIBDIR
+
 	if python_MACOSX_DEPLOYMENT_TARGET:
 		conf.env['MACOSX_DEPLOYMENT_TARGET'] = python_MACOSX_DEPLOYMENT_TARGET
 		conf.environ['MACOSX_DEPLOYMENT_TARGET'] = python_MACOSX_DEPLOYMENT_TARGET
-- 
1.8.3.2
+0 −54
Original line number Diff line number Diff line
From 934f8c8e9439de4f15b2e61016d5d29233d8d5fa Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Wed, 16 Apr 2014 08:01:36 -0300
Subject: [PATCH 5/5] build: find blkcnt_t size via array

Using the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e
find blkcnt_t size via an array so that it can be determined via build
rather than running it.

Status: Upstream.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 source3/wscript | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/source3/wscript b/source3/wscript
index aade503..6a5728f 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -277,18 +277,20 @@ int main(int argc, char **argv)
                                 headers='sys/types.h sys/stat.h unistd.h')
 
     if "HAVE_BLKCNT_T" in conf.env:
-	conf.CHECK_CODE('''
-	return sizeof(blkcnt_t) == 4 ? 0 : 1''',
-		'SIZEOF_BLKCNT_T_4', execute=True,
-		headers='replace.h sys/types.h sys/stat.h unistd.h',
-		msg="Checking whether blkcnt_t is 32 bit")
+        conf.CHECK_CODE('''
+        static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
+                'SIZEOF_BLKCNT_T_4',
+                headers='replace.h sys/types.h sys/stat.h unistd.h',
+                msg="Checking whether blkcnt_t is 32 bit")
 
+    # If sizeof is 4 it can't be 8
     if "HAVE_BLKCNT_T" in conf.env:
-	conf.CHECK_CODE('''
-	return sizeof(blkcnt_t) == 8 ? 0 : 1''',
-		'SIZEOF_BLKCNT_T_8', execute=True,
-		headers='replace.h sys/types.h sys/stat.h unistd.h',
-		msg="Checking whether blkcnt_t is 64 bit")
+        if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
+            conf.CHECK_CODE('''
+            static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
+                    'SIZEOF_BLKCNT_T_8',
+                    headers='replace.h sys/types.h sys/stat.h unistd.h',
+                    msg="Checking whether blkcnt_t is 64 bit")
 
     # Check for POSIX capability support
     conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
-- 
1.8.3.2
+0 −165
Original line number Diff line number Diff line
From ee4e06b7223fb2925bc887c89216a66029d44862 Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Tue, 1 Apr 2014 06:41:47 -0300
Subject: [PATCH 2/5] build: unify and fix endian tests

Unify the endian tests out of lib/ccan/wscript into wafsamba since
they're almost cross-compile friendly.
While at it fix them to be so by moving the preprocessor directives out
of main scope since that will fail.
And keep the WORDS_BIGENDIAN, HAVE_LITTLE_ENDIAN and HAVE_BIG_ENDIAN
defines separate because of different codebases.

Status: Upstream.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 buildtools/wafsamba/wscript | 65 ++++++++++++++++++++++++++++++++++++++++++---
 lib/ccan/wscript            | 55 --------------------------------------
 2 files changed, 62 insertions(+), 58 deletions(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 7984227..1a2cfe6 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -390,9 +390,68 @@ def configure(conf):
     else:
         conf.define('SHLIBEXT', "so", quote=True)
 
-    conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]',
-                    execute=True,
-                    define='WORDS_BIGENDIAN')
+    # First try a header check for cross-compile friendlyness
+    conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
+                        #define B __BYTE_ORDER
+                        #elif defined(BYTE_ORDER)
+                        #define B BYTE_ORDER
+                        #endif
+
+                        #ifdef __LITTLE_ENDIAN
+                        #define LITTLE __LITTLE_ENDIAN
+                        #elif defined(LITTLE_ENDIAN)
+                        #define LITTLE LITTLE_ENDIAN
+                        #endif
+
+                        #if !defined(LITTLE) || !defined(B) || LITTLE != B
+                        #error Not little endian.
+                        #endif
+                        int main(void) { return 0; }""",
+                            addmain=False,
+                            headers="endian.h sys/endian.h",
+                            define="HAVE_LITTLE_ENDIAN")
+    conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
+                        #define B __BYTE_ORDER
+                        #elif defined(BYTE_ORDER)
+                        #define B BYTE_ORDER
+                        #endif
+
+                        #ifdef __BIG_ENDIAN
+                        #define BIG __BIG_ENDIAN
+                        #elif defined(BIG_ENDIAN)
+                        #define BIG BIG_ENDIAN
+                        #endif
+
+                        #if !defined(BIG) || !defined(B) || BIG != B
+                        #error Not big endian.
+                        #endif
+                        int main(void) { return 0; }""",
+                            addmain=False,
+                            headers="endian.h sys/endian.h",
+                            define="HAVE_BIG_ENDIAN")
+
+    if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
+        # That didn't work!  Do runtime test.
+        conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
+            u.i = 0x01020304;
+            return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""",
+                          addmain=True, execute=True,
+                          define='HAVE_LITTLE_ENDIAN',
+                          msg="Checking for HAVE_LITTLE_ENDIAN - runtime")
+        conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
+            u.i = 0x01020304;
+            return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""",
+                          addmain=True, execute=True,
+                          define='HAVE_BIG_ENDIAN',
+                          msg="Checking for HAVE_BIG_ENDIAN - runtime")
+
+    # Extra sanity check.
+    if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
+        Logs.error("Failed endian determination.  The PDP-11 is back?")
+	sys.exit(1)
+    else:
+        if conf.CONFIG_SET("HAVE_BIG_ENDIAN"):
+            conf.DEFINE('WORDS_BIGENDIAN', 1)
 
     # check if signal() takes a void function
     if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1',
diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 1c5f337..0e540db 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -25,61 +25,6 @@ def configure(conf):
     conf.CHECK_CODE('int __attribute__((used)) func(int x) { return x; }',
                     addmain=False, link=False, cflags=conf.env['WERROR_CFLAGS'],
                     define='HAVE_ATTRIBUTE_USED')
-    # We try to use headers for a compile-time test.
-    conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
-                        #define B __BYTE_ORDER
-                        #elif defined(BYTE_ORDER)
-                        #define B BYTE_ORDER
-                        #endif
-
-                        #ifdef __LITTLE_ENDIAN
-                        #define LITTLE __LITTLE_ENDIAN
-                        #elif defined(LITTLE_ENDIAN)
-                        #define LITTLE LITTLE_ENDIAN
-                        #endif
-
-                        #if !defined(LITTLE) || !defined(B) || LITTLE != B
-                        #error Not little endian.
-                        #endif""",
-                           headers="endian.h sys/endian.h",
-                           define="HAVE_LITTLE_ENDIAN")
-    conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
-                        #define B __BYTE_ORDER
-                        #elif defined(BYTE_ORDER)
-                        #define B BYTE_ORDER
-                        #endif
-
-                        #ifdef __BIG_ENDIAN
-                        #define BIG __BIG_ENDIAN
-                        #elif defined(BIG_ENDIAN)
-                        #define BIG BIG_ENDIAN
-                        #endif
-
-                        #if !defined(BIG) || !defined(B) || BIG != B
-                        #error Not big endian.
-                        #endif""",
-                           headers="endian.h sys/endian.h",
-                           define="HAVE_BIG_ENDIAN")
-
-    if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
-        # That didn't work!  Do runtime test.
-        conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
-	  u.i = 0x01020304;
-	  return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""",
-                        addmain=True, execute=True,
-                        define='HAVE_LITTLE_ENDIAN',
-                        msg="Checking for HAVE_LITTLE_ENDIAN - runtime")
-        conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
-	  u.i = 0x01020304;
-	  return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""",
-                        addmain=True, execute=True,
-                        define='HAVE_BIG_ENDIAN',
-                        msg="Checking for HAVE_BIG_ENDIAN - runtime")
-
-    # Extra sanity check.
-    if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
-        Logs.error("Failed endian determination.  The PDP-11 is back?")
-        sys.exit(1)
 
     conf.CHECK_CODE('return __builtin_choose_expr(1, 0, "garbage");',
                     link=True,
-- 
1.8.3.2
Loading