All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv2 0/4] Samba4 package
@ 2014-02-11 11:57 Gustavo Zacarias
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 1/4] python: fixup python-config script Gustavo Zacarias
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Gustavo Zacarias @ 2014-02-11 11:57 UTC (permalink / raw)
  To: buildroot

Changes for v2:
depend on !BR2_PACKAGE_SAMBA as recommended by Arnout & Thomas.
Add comments to samba4 package as mentioned by Samuel Martin.
Make the samba(3) description useful and rename patches.

This patchset adds a samba 4.1.x package to buildroot.

Samba 4.1.x uses the waf build system which isn't very cross-compile
friendly, and also some tests are formulated in a way that isn't
cross-build friendly either by needing to run them.

For this reason the samba4 build system includes a way to define
answers for many of the tests, but this support isn't complete
and some tests still want to be executed.

Samba 3.6.x is being kept because 4.1.x has a bigger footprint, changes
usage in some tools (swat has been dropped for example), has more
toolchain dependencies and there may be validation issues for users
as well.
Samba 4.1.x also requires a proper answers file for each architecture,
and at the moment i've only tested for ARM and PowerPC so only those
architectures are supported to begin with. To add support for another
architecture basically copy one of the cache files to the proper name,
enable it in Config.in and adjust endianess and all of the "size of"
answers. I'm in the process of automating the sizeof and endianess
answers within the samba build system to make them cross friendly
to simplify the answers file to just one generic linux variant.
The 3.6.x branch is still security supported for the forseeable future.

I'm currently working with samba upstream to solve many of these
issues but this will probably happen with the yet unreleased
4.2 branch only.

The python patch is a backport from the 3.4 branch to avoid using
a runtime python for python-config (a pure shell implementation).

Heimdal patches are all upstream.


Gustavo Zacarias (4):
  python: fixup python-config script
  heimdal: new package
  samba4: new package
  samba: update description and rename patches

 package/Config.in                                  |   1 +
 .../heimdal/heimdal-0001-add-roken-h-process.patch | 195 ++++++++++++++++++++
 package/heimdal/heimdal-0002-use-Getopt-Std.patch  |  30 +++
 package/heimdal/heimdal-0003-vendor.patch          |  19 ++
 package/heimdal/heimdal-0004-compile_et.patch      |  28 +++
 package/heimdal/heimdal.mk                         |  30 +++
 .../python/python-2.7-017-fix-python-config.patch  | 205 +++++++++++++++++++++
 package/samba/Config.in                            |   6 +-
 ....patch => samba-0001-fix-smbd-libs-avahi.patch} |   0
 ...addrinfo.patch => samba-0002-getaddrinfo.patch} |   0
 package/samba4/Config.in                           |  24 +++
 package/samba4/S91smb                              |  56 ++++++
 package/samba4/arm-cache.txt                       |  65 +++++++
 package/samba4/powerpc-cache.txt                   |  65 +++++++
 ...-0001-build-don-t-execute-tests-summary.c.patch |  67 +++++++
 ...ld-don-t-execute-statfs-and-f_fsid-checks.patch |  31 ++++
 ...003-build-find-FILE_OFFSET_BITS-via-array.patch |  54 ++++++
 ...uild-allow-some-python-variable-overrides.patch |  45 +++++
 ...amba4-0005-builtin-heimdal-external-tools.patch |  42 +++++
 package/samba4/samba4.mk                           | 111 +++++++++++
 20 files changed, 1071 insertions(+), 3 deletions(-)
 create mode 100644 package/heimdal/heimdal-0001-add-roken-h-process.patch
 create mode 100644 package/heimdal/heimdal-0002-use-Getopt-Std.patch
 create mode 100644 package/heimdal/heimdal-0003-vendor.patch
 create mode 100644 package/heimdal/heimdal-0004-compile_et.patch
 create mode 100644 package/heimdal/heimdal.mk
 create mode 100644 package/python/python-2.7-017-fix-python-config.patch
 rename package/samba/{samba-fix-smbd-libs-avahi.patch => samba-0001-fix-smbd-libs-avahi.patch} (100%)
 rename package/samba/{samba-getaddrinfo.patch => samba-0002-getaddrinfo.patch} (100%)
 create mode 100644 package/samba4/Config.in
 create mode 100644 package/samba4/S91smb
 create mode 100644 package/samba4/arm-cache.txt
 create mode 100644 package/samba4/powerpc-cache.txt
 create mode 100644 package/samba4/samba4-0001-build-don-t-execute-tests-summary.c.patch
 create mode 100644 package/samba4/samba4-0002-build-don-t-execute-statfs-and-f_fsid-checks.patch
 create mode 100644 package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch
 create mode 100644 package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch
 create mode 100644 package/samba4/samba4-0005-builtin-heimdal-external-tools.patch
 create mode 100644 package/samba4/samba4.mk

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 1/4] python: fixup python-config script
  2014-02-11 11:57 [Buildroot] [PATCHv2 0/4] Samba4 package Gustavo Zacarias
@ 2014-02-11 11:57 ` Gustavo Zacarias
  2014-02-12  7:18   ` Arnout Vandecappelle
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 2/4] heimdal: new package Gustavo Zacarias
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Gustavo Zacarias @ 2014-02-11 11:57 UTC (permalink / raw)
  To: buildroot

From: Gustavo Zacarias <gustavo.zacarias@free-electrons.com>

The original version uses sysconfig from the python interpreter
(normally host-python) which isn't really suited to provide information
of the target python.
Use the pure shell preprocessed backport from the upcoming python 3.4

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 .../python/python-2.7-017-fix-python-config.patch  | 205 +++++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 package/python/python-2.7-017-fix-python-config.patch

diff --git a/package/python/python-2.7-017-fix-python-config.patch b/package/python/python-2.7-017-fix-python-config.patch
new file mode 100644
index 0000000..7f923b9
--- /dev/null
+++ b/package/python/python-2.7-017-fix-python-config.patch
@@ -0,0 +1,205 @@
+Add a backport of http://bugs.python.org/issue16235 so we can use
+python-config for cross builds.
+This basically replaces the python version of python-config with a pure-shell
+version that's already preprocessed when installed and doesn't depend
+on the sysconfig import that usually leads to bad data/results.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura Python-2.7.3.orig/configure.in Python-2.7.3/configure.in
+--- Python-2.7.3.orig/configure.in	2013-12-13 14:43:39.793541435 -0300
++++ Python-2.7.3/configure.in	2013-12-13 17:52:54.759489901 -0300
+@@ -764,6 +764,7 @@
+ 
+ # Other platforms follow
+ if test $enable_shared = "yes"; then
++  PY_ENABLE_SHARED=1
+   AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
+   case $ac_sys_system in
+     BeOS*)
+@@ -824,6 +825,7 @@
+ 
+   esac
+ else # shared is disabled
++  PY_ENABLE_SHARED=0
+   case $ac_sys_system in
+     CYGWIN*)
+           BLDLIBRARY='$(LIBRARY)'
+@@ -1747,6 +1749,9 @@
+ AC_SUBST(BLDSHARED)
+ AC_SUBST(CCSHARED)
+ AC_SUBST(LINKFORSHARED)
++AC_SUBST(PY_ENABLE_SHARED)
++LIBPL="${prefix}/lib/python${VERSION}/config"
++AC_SUBST(LIBPL)
+ # SO is the extension of shared libraries `(including the dot!)
+ # -- usually .so, .sl on HP-UX, .dll on Cygwin
+ AC_MSG_CHECKING(SO)
+@@ -4320,7 +4325,7 @@
+ AC_MSG_RESULT(done)
+ 
+ # generate output files
+-AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
++AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
+ AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
+ AC_OUTPUT
+ 
+diff -Nura Python-2.7.3.orig/Makefile.pre.in Python-2.7.3/Makefile.pre.in
+--- Python-2.7.3.orig/Makefile.pre.in	2013-12-13 14:43:39.401528527 -0300
++++ Python-2.7.3/Makefile.pre.in	2013-12-12 15:15:34.828640321 -0300
+@@ -152,7 +152,7 @@
+ SUBDIRSTOO=	Include Lib Misc Demo
+ 
+ # Files and directories to be distributed
+-CONFIGFILES=	configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
++CONFIGFILES=	configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in Misc/python-config.sh
+ DISTFILES=	README ChangeLog $(CONFIGFILES)
+ DISTDIRS=	$(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
+ DIST=		$(DISTFILES) $(DISTDIRS)
+@@ -366,7 +366,7 @@
+ 
+ # Default target
+ all:		build_all
+-build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
++build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks python-config
+ 
+ # Compile a binary with gcc profile guided optimization.
+ profile-opt:
+@@ -969,10 +969,12 @@
+ 	export EXE; EXE="$(BUILDEXE)"; \
+ 	cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
+ 
+-python-config: $(srcdir)/Misc/python-config.in
++python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
+ 	# Substitution happens here, as the completely-expanded BINDIR
+ 	# is not available in configure
+-	sed -e "s, at EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
++	sed -e "s, at EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py
++	# Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
++	sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' Misc/python-config.sh >python-config
+ 
+ # Install the include files
+ INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
+@@ -1031,7 +1033,7 @@
+ 	$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
+ 	$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
+ 	$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
+-	rm python-config
++	$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
+ 	@if [ -s Modules/python.exp -a \
+ 		"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
+ 		echo; echo "Installing support files for building shared extension modules on AIX:"; \
+@@ -1206,6 +1208,7 @@
+ 		config.cache config.log pyconfig.h Modules/config.c
+ 	-rm -rf build platform
+ 	-rm -rf $(PYTHONFRAMEWORKDIR)
++	-rm -f python-config.py python-config
+ 
+ # Make things extra clean, before making a distribution:
+ # remove all generated files, even Makefile[.pre]
+diff -Nura Python-2.7.3.orig/Misc/python-config.sh.in Python-2.7.3/Misc/python-config.sh.in
+--- Python-2.7.3.orig/Misc/python-config.sh.in	1969-12-31 21:00:00.000000000 -0300
++++ Python-2.7.3/Misc/python-config.sh.in	2013-12-13 17:53:07.752918023 -0300
+@@ -0,0 +1,102 @@
++#!/bin/sh
++
++exit_with_usage ()
++{
++	echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--configdir"
++	exit $1
++}
++
++if [ "$1" = "" ] ; then
++	exit_with_usage 1
++fi
++
++# Returns the actual prefix where this script was installed to.
++installed_prefix ()
++{
++	RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
++	if which readlink >/dev/null 2>&1 ; then
++	RESULT=$(readlink -f "$RESULT")
++	fi
++	echo $RESULT
++}
++
++prefix_build="@prefix@"
++prefix_real=$(installed_prefix "$0")
++
++# Use sed to fix paths from their built to locations to their installed to locations.
++prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
++exec_prefix_build="@exec_prefix@"
++exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
++includedir=$(echo "@includedir@")
++libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
++CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
++VERSION="@VERSION@"
++LIBM="@LIBM@"
++LIBC="@LIBC@"
++SYSLIBS="$LIBM $LIBC"
++LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}"
++BASECFLAGS="@BASECFLAGS@"
++LDLIBRARY="@LDLIBRARY@"
++LINKFORSHARED="@LINKFORSHARED@"
++OPT="@OPT@"
++PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
++LDVERSION="@LDVERSION@"
++LIBDEST=${prefix}/lib/python${VERSION}
++LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
++SO="@SO@"
++PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
++INCDIR="-I$includedir/python${VERSION}"
++PLATINCDIR="-I$includedir/python${VERSION}"
++
++# Scan for --help or unknown argument.
++for ARG in $*
++do
++	case $ARG in
++	--help)
++		exit_with_usage 0
++	;;
++	--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir)
++	;;
++	*)
++		exit_with_usage 1
++	;;
++esac
++done
++
++for ARG in "$@"
++do
++	case "$ARG" in
++	--prefix)
++		echo "$prefix"
++	;;
++	--exec-prefix)
++		echo "$exec_prefix"
++	;;
++	--includes)
++		 echo "$INCDIR $PLATINCDIR"
++	;;
++	--cflags)
++		echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
++	;;
++	--libs)
++		echo "$LIBS"
++	;;
++	--ldflags)
++		LINKFORSHAREDUSED=
++		if [ -z "$PYTHONFRAMEWORK" ] ; then
++			LINKFORSHAREDUSED=$LINKFORSHARED
++		fi
++		LIBPLUSED=
++		if [ "$PY_ENABLE_SHARED" = "0" ] ; then
++			LIBPLUSED="-L$LIBPL"
++		fi
++		echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED"
++	;;
++	--extension-suffix)
++		echo "$SO"
++	;;
++	--configdir)
++		echo "$LIBPL"
++	;;
++esac
++done
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 2/4] heimdal: new package
  2014-02-11 11:57 [Buildroot] [PATCHv2 0/4] Samba4 package Gustavo Zacarias
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 1/4] python: fixup python-config script Gustavo Zacarias
@ 2014-02-11 11:57 ` Gustavo Zacarias
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 3/4] samba4: " Gustavo Zacarias
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 4/4] samba: update description and rename patches Gustavo Zacarias
  3 siblings, 0 replies; 9+ messages in thread
From: Gustavo Zacarias @ 2014-02-11 11:57 UTC (permalink / raw)
  To: buildroot

host-heimdal is required for samba 4.1.x since it can't (yet) link
with an external heimdal implementation and can't cross-compile the
internal tools.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 .../heimdal/heimdal-0001-add-roken-h-process.patch | 195 +++++++++++++++++++++
 package/heimdal/heimdal-0002-use-Getopt-Std.patch  |  30 ++++
 package/heimdal/heimdal-0003-vendor.patch          |  19 ++
 package/heimdal/heimdal-0004-compile_et.patch      |  28 +++
 package/heimdal/heimdal.mk                         |  30 ++++
 5 files changed, 302 insertions(+)
 create mode 100644 package/heimdal/heimdal-0001-add-roken-h-process.patch
 create mode 100644 package/heimdal/heimdal-0002-use-Getopt-Std.patch
 create mode 100644 package/heimdal/heimdal-0003-vendor.patch
 create mode 100644 package/heimdal/heimdal-0004-compile_et.patch
 create mode 100644 package/heimdal/heimdal.mk

diff --git a/package/heimdal/heimdal-0001-add-roken-h-process.patch b/package/heimdal/heimdal-0001-add-roken-h-process.patch
new file mode 100644
index 0000000..b8fbd2a
--- /dev/null
+++ b/package/heimdal/heimdal-0001-add-roken-h-process.patch
@@ -0,0 +1,195 @@
+Add roken-h-process.pl from:
+https://raw.github.com/heimdal/heimdal/master/cf/roken-h-process.pl
+It's required for cross-compiling and missing from release tarballs:
+http://kerberos.996246.n3.nabble.com/Missing-roken-h-process-pl-when-cross-compiling-v1-5-2-td38806.html
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura heimdal-1.5.3.orig/cf/roken-h-process.pl heimdal-1.5.3/cf/roken-h-process.pl
+--- heimdal-1.5.3.orig/cf/roken-h-process.pl	1969-12-31 21:00:00.000000000 -0300
++++ heimdal-1.5.3/cf/roken-h-process.pl	2013-12-18 11:32:38.157625167 -0300
+@@ -0,0 +1,184 @@
++#!/usr/bin/perl
++
++require 'getopts.pl';
++
++my $debug = 0;
++
++Getopts('dc:p:o:') || die "foo";
++
++if ($opt_d) {
++    $debug = 1;
++}
++
++die "missing arg" if (!defined $opt_c || !defined $opt_p || !defined $opt_o);
++
++my %defines;
++my $IN;
++my $OUT;
++
++print "parse config.h\n" if ($debug);
++
++open IN, $opt_c || die "failed open ${opt_c}";
++
++my @nesting;
++
++push @nesting, 1;
++
++while (<IN>) {
++    if (m/\s*#ifdef\s+(.*)/) {
++	my $var = $1;
++	if (defined $defines{$var}) {
++	    push @nesting, 1;
++	} else {
++	    push @nesting, 0;
++	}
++	next;
++    } elsif (m/\s*#ifndef\s+(.*)/) {
++	my $var = $1;
++	if (defined $defines{$var}) {
++	    push @nesting, 0;
++	} else {
++	    push @nesting, 1;
++	}
++	next;
++    } elsif (m/\s*#else/) {
++	my $var = pop @nesting;
++	$var = !$var;
++	push @nesting, $var;
++	next;
++    } elsif ($nesting[$#nesting] and m/\s*#define\s+(\w+)\s+(\S+)/) {
++	my $res = $2;
++	$res = 1 if (!defined $res);
++	$defines{$1} = $res;
++    }
++}
++
++close IN;
++
++if ($debug) {
++    foreach my $i (keys %defines) {
++	print "k: $i v: $defines{$i}\n";
++    }
++}
++
++open IN, "$opt_p" || die "failed open ${opt_p}";
++open OUT, ">$opt_o" || die "failed open ${opt_o}";
++
++print "parse roken.h.in\n" if ($debug);
++
++print OUT "/* This is an OS dependent, generated file */\n";
++print OUT "\n";
++print OUT "\n";
++print OUT "#ifndef __ROKEN_H__\n";
++print OUT "#define __ROKEN_H__\n";
++print OUT "\n";
++
++ at nesting = (1);
++
++while (<IN>) {
++    if (m/\s*#ifdef\s+(.*)/) {
++	my $var = $1;
++	if (defined $defines{$var}) {
++	    push @nesting, 1;
++	} else {
++	    push @nesting, 0;
++	}
++	next;
++    } elsif (m/\s*#ifndef\s+(.*)/) {
++	my $var = $1;
++	if (defined $defines{$var}) {
++	    push @nesting, 0;
++	} else {
++	    push @nesting, 1;
++	}
++	next;
++    } elsif (m/\s*#if\s+(.*)/) {
++	my $res = parse_if($1);
++	print "line = $res: $1\n" if ($debug);
++	push @nesting, $res;
++	next;
++    } elsif (m/\s*#elif\s+(.*)/) {
++	my $res = pop @nesting;
++	if ($res gt 0) {
++	    $res = -1;
++	} else {
++	    my $res = parse_if($1);
++	}
++	push @nesting, $res;
++	next;
++    } elsif (m/\s*#else/) {
++	my $var = pop @nesting;
++	$var = !$var;
++	push @nesting, $var;
++	next;
++    } elsif (m/\s*#endif/) {
++	pop @nesting;
++	next;
++    }
++    print "line: $_\n"  if ($debug);
++    print "nesting dep $#{nesting}\n"  if ($debug);
++    my $i = 0, $t = 1;
++    while ($i le $#nesting) {
++	$t = 0 if ($nesting[$i] le 0);
++	print "nesting $i val $nesting[$i] -> $t\n" if ($debug);
++	$i++;
++    }
++    if ($t) {
++	print OUT;
++    }
++}
++
++print OUT "\n";
++print OUT "#endif /* __ROKEN_H__ */\n";
++
++
++close IN;
++
++exit 0;
++
++sub parse_if
++{
++    my ($neg, $var);
++
++    $_ = shift;
++
++    if (m/^\s*$/) {
++	print "end $_\n" if ($debug);
++	return 1;
++    } elsif (m/^([^&]+)\&\&(.*)$/) {
++	print "$1 and $2\n" if ($debug);
++	return parse_if($1) and parse_if($2);
++    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
++	print "$1 and $2\n" if ($debug);
++	return parse_if($1) and parse_if($2);
++    } elsif (m/^([^\|]+)\|\|(.*)$/) {
++	print "$1 or $2\n" if ($debug);
++	return parse_if($1) or parse_if($2);
++    } elsif (m/^\s*(\!)?\s*defined\((\w+)\)/) {
++	($neg, $var) = ($1, $2);
++	print "def: ${neg}-defined(${var})\n" if ($debug);
++	my $res = defined $defines{$var};
++	if ($neg eq "!") {
++	    if ($res) {
++		$res = 0;
++	    } else {
++		$res = 1;
++	    }
++	}
++	print "res: $res\n" if ($debug);
++	return $res;
++    } elsif (m/^\s*(\!)?(\w+)/) {
++	($neg, $var) = ($1, $2);
++	print "var: $neg $var\n" if ($debug);
++	my $res;
++	if (defined $defines{$var}) {
++	    $res = $defines{$var};
++	} else {
++	    $res = 0;
++	}
++	$res = ! $res if ($neg =~ m/!/);
++	print "res: $res\n" if ($debug);
++	return $res;
++    }
++    die "failed parse: $_\n";
++}
diff --git a/package/heimdal/heimdal-0002-use-Getopt-Std.patch b/package/heimdal/heimdal-0002-use-Getopt-Std.patch
new file mode 100644
index 0000000..134b888
--- /dev/null
+++ b/package/heimdal/heimdal-0002-use-Getopt-Std.patch
@@ -0,0 +1,30 @@
+From 6080c0b229c6e332d7dd609d9435ac9baeeea443 Mon Sep 17 00:00:00 2001
+From: Gustavo Zacarias <gustavo@zacarias.com.ar>
+Date: Thu, 30 Jan 2014 16:33:02 -0300
+Subject: [PATCH] roken-h-process: use Getopt::Std, getopts.pl is deprecated
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ cf/roken-h-process.pl | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
+index 153a35c..72d3bd3 100644
+--- a/cf/roken-h-process.pl
++++ b/cf/roken-h-process.pl
+@@ -1,10 +1,10 @@
+ #!/usr/bin/perl
+ 
+-require 'getopts.pl';
++use Getopt::Std;
+ 
+ my $debug = 0;
+ 
+-Getopts('dc:p:o:') || die "foo";
++getopts('dc:p:o:') || die "foo";
+ 
+ if ($opt_d) {
+     $debug = 1;
+-- 
+1.8.3.2
+
diff --git a/package/heimdal/heimdal-0003-vendor.patch b/package/heimdal/heimdal-0003-vendor.patch
new file mode 100644
index 0000000..1ccd629
--- /dev/null
+++ b/package/heimdal/heimdal-0003-vendor.patch
@@ -0,0 +1,19 @@
+Add --vendor option to krb5-config, required by samba 4.
+Status: Backport from upstream git.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura heimdal-1.5.3.orig/tools/krb5-config.in heimdal-1.5.3.vendor/tools/krb5-config.in
+--- heimdal-1.5.3.orig/tools/krb5-config.in	2012-12-09 19:06:44.000000000 -0300
++++ heimdal-1.5.3.vendor/tools/krb5-config.in	2013-12-18 15:49:45.283986300 -0300
+@@ -50,6 +50,10 @@
+     do_usage=yes
+     usage_exit=0
+     ;;
++  --vendor)
++    echo "Heimdal";
++    exit 0
++    ;;
+   --version)
+     echo "@PACKAGE@ @VERSION@"
+     exit 0
diff --git a/package/heimdal/heimdal-0004-compile_et.patch b/package/heimdal/heimdal-0004-compile_et.patch
new file mode 100644
index 0000000..6bdec6f
--- /dev/null
+++ b/package/heimdal/heimdal-0004-compile_et.patch
@@ -0,0 +1,28 @@
+Use compile_et from e2fsprogs rather than building the native and useless one
+from heimdal.
+
+Idea from:
+http://comments.gmane.org/gmane.comp.encryption.kerberos.heimdal.general/6572
+
+Status: Backport from upstream git.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura heimdal-1.5.3.orig/cf/check-compile-et.m4 heimdal-1.5.3.et/cf/check-compile-et.m4
+--- heimdal-1.5.3.orig/cf/check-compile-et.m4	2012-12-09 19:06:44.000000000 -0300
++++ heimdal-1.5.3.et/cf/check-compile-et.m4	2013-12-18 14:20:04.025925879 -0300
+@@ -3,12 +3,12 @@
+ dnl CHECK_COMPILE_ET
+ AC_DEFUN([CHECK_COMPILE_ET], [
+ 
+-AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
++AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et], [no])
+ 
+ krb_cv_compile_et="no"
+ krb_cv_com_err_need_r=""
+ krb_cv_compile_et_cross=no
+-if test "${COMPILE_ET}" = "compile_et"; then
++if test "$COMPILE_ET" != "no"; then
+ 
+ dnl We have compile_et.  Now let's see if it supports `prefix' and `index'.
+ AC_MSG_CHECKING(whether compile_et has the features we need)
diff --git a/package/heimdal/heimdal.mk b/package/heimdal/heimdal.mk
new file mode 100644
index 0000000..c73b33e
--- /dev/null
+++ b/package/heimdal/heimdal.mk
@@ -0,0 +1,30 @@
+################################################################################
+#
+# heimdal
+#
+################################################################################
+
+HEIMDAL_VERSION = 1.5.3
+HEIMDAL_SITE = http://www.h5l.org/dist/src
+HEIMDAL_DEPENDENCIES = host-e2fsprogs host-pkgconf
+HEIMDAL_INSTALL_STAGING = YES
+# static because of -fPIC issues with e2fsprogs on x86_64 host
+HOST_HEIMDAL_CONF_OPT = --with-x=no --disable-shared --enable-static
+HOST_HEIMDAL_CONF_ENV = MAKEINFO=true
+HEIMDAL_MAKE = $(MAKE1)
+# For heimdal-0004-compile_et.patch
+HEIMDAL_AUTORECONF = YES
+HEIMDAL_LICENSE = BSD-3c
+HEIMDAL_LICENSE_FILES = LICENSE
+
+# We need asn1_compile in the PATH for samba4
+define HOST_HEIMDAL_MAKE_SYMLINK
+	ln -sf $(HOST_DIR)/usr/libexec/heimdal/asn1_compile \
+		$(HOST_DIR)/usr/bin/asn1_compile
+	ln -sf $(HOST_DIR)/usr/bin/compile_et \
+		$(HOST_DIR)/usr/libexec/heimdal/compile_et
+endef
+
+HOST_HEIMDAL_POST_INSTALL_HOOKS += HOST_HEIMDAL_MAKE_SYMLINK
+
+$(eval $(host-autotools-package))
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 3/4] samba4: new package
  2014-02-11 11:57 [Buildroot] [PATCHv2 0/4] Samba4 package Gustavo Zacarias
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 1/4] python: fixup python-config script Gustavo Zacarias
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 2/4] heimdal: new package Gustavo Zacarias
@ 2014-02-11 11:57 ` Gustavo Zacarias
  2014-02-12 16:55   ` Arnout Vandecappelle
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 4/4] samba: update description and rename patches Gustavo Zacarias
  3 siblings, 1 reply; 9+ messages in thread
From: Gustavo Zacarias @ 2014-02-11 11:57 UTC (permalink / raw)
  To: buildroot

Samba 4.1.x uses the waf build system which isn't very cross-compile
friendly, and also some tests are formulated in a way that isn't
cross-build friendly either by needing to run them.

For this reason the samba4 build system includes a way to define
answers for many of the tests, but this support isn't complete
and some tests still want to be executed.

Samba 4.1.x also requires a proper answers file for each architecture,
and at the moment i've only tested for ARM and PowerPC so only those
architectures are supported to begin with. To add support for another
architecture basically copy one of the cache files to the proper name,
enable it in Config.in and adjust endianess and all of the "size of"
answers. I'm in the process of automating the sizeof and endianess
answers within the samba build system to make them cross friendly
to simplify the answers file to just one generic linux variant.
The 3.6.x branch is still security supported for the forseeable future.

I'm currently working with samba upstream to solve many of these
issues but this will probably happen with the yet unreleased
4.2 branch only.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/Config.in                                  |   1 +
 package/samba4/Config.in                           |  24 +++++
 package/samba4/S91smb                              |  56 +++++++++++
 package/samba4/arm-cache.txt                       |  65 ++++++++++++
 package/samba4/powerpc-cache.txt                   |  65 ++++++++++++
 ...-0001-build-don-t-execute-tests-summary.c.patch |  67 +++++++++++++
 ...ld-don-t-execute-statfs-and-f_fsid-checks.patch |  31 ++++++
 ...003-build-find-FILE_OFFSET_BITS-via-array.patch |  54 ++++++++++
 ...uild-allow-some-python-variable-overrides.patch |  45 +++++++++
 ...amba4-0005-builtin-heimdal-external-tools.patch |  42 ++++++++
 package/samba4/samba4.mk                           | 111 +++++++++++++++++++++
 11 files changed, 561 insertions(+)
 create mode 100644 package/samba4/Config.in
 create mode 100644 package/samba4/S91smb
 create mode 100644 package/samba4/arm-cache.txt
 create mode 100644 package/samba4/powerpc-cache.txt
 create mode 100644 package/samba4/samba4-0001-build-don-t-execute-tests-summary.c.patch
 create mode 100644 package/samba4/samba4-0002-build-don-t-execute-statfs-and-f_fsid-checks.patch
 create mode 100644 package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch
 create mode 100644 package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch
 create mode 100644 package/samba4/samba4-0005-builtin-heimdal-external-tools.patch
 create mode 100644 package/samba4/samba4.mk

diff --git a/package/Config.in b/package/Config.in
index 98d2ad4..2e8c197 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -933,6 +933,7 @@ source "package/rsync/Config.in"
 source "package/rtorrent/Config.in"
 source "package/rtptools/Config.in"
 source "package/samba/Config.in"
+source "package/samba4/Config.in"
 source "package/sconeserver/Config.in"
 source "package/ser2net/Config.in"
 source "package/smcroute/Config.in"
diff --git a/package/samba4/Config.in b/package/samba4/Config.in
new file mode 100644
index 0000000..b8d4154
--- /dev/null
+++ b/package/samba4/Config.in
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_SAMBA4
+	bool "samba4"
+	depends on !BR2_PACKAGE_SAMBA
+	depends on BR2_INET_IPV6
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_USE_WCHAR # e2fsprogs
+	depends on BR2_LARGEFILE
+	depends on BR2_TOOLCHAIN_HAS_THREADS # talloc python threads
+	# Supported architectures only limited by the cached answers
+	depends on BR2_arm || BR2_powerpc
+	select BR2_PACKAGE_E2FSPROGS
+	select BR2_PACKAGE_POPT
+	select BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_ZLIB
+	help
+	  Provides secure, stable and fast file and print services
+	  for all clients using the SMB/CIFS protocol, such as all
+	  versions of DOS, Windows, OS/2, Linux and many others.
+
+	  http://www.samba.org/
+
+comment "samba4 needs a toolchain w/ IPv6, wchar, largfile, threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE || \
+		!BR2_USE_WCHAR || !BR2_INET_IPV6
diff --git a/package/samba4/S91smb b/package/samba4/S91smb
new file mode 100644
index 0000000..0cd0057
--- /dev/null
+++ b/package/samba4/S91smb
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+[ -f /etc/samba/smb.conf ] || exit 0
+
+mkdir -p /var/log/samba
+
+start() {
+	echo -n "Starting SMB services: "
+	smbd -D
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+
+	echo -n "Starting NMB services: "
+	nmbd -D
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+}
+
+stop() {
+	echo -n "Shutting down SMB services: "
+	kill -9 `pidof smbd`
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+
+	echo -n "Shutting down NMB services: "
+	kill -9 `pidof nmbd`
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+}
+
+restart() {
+	stop
+	start
+}
+
+reload() {
+        echo -n "Reloading smb.conf file: "
+	kill -HUP `pidof smbd`
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+}
+
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
+	;;
+  restart)
+  	restart
+	;;
+  reload)
+  	reload
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart|reload}"
+	exit 1
+esac
+
+exit $?
diff --git a/package/samba4/arm-cache.txt b/package/samba4/arm-cache.txt
new file mode 100644
index 0000000..70b19e3
--- /dev/null
+++ b/package/samba4/arm-cache.txt
@@ -0,0 +1,65 @@
+Checking simple C program: OK
+rpath library support: OK
+-Wl,--version-script support: OK
+Checking getconf LFS_CFLAGS: NO
+Checking for large file support without additional flags: OK
+Checking for -D_LARGE_FILES: OK
+Checking correct behavior of strtoll: NO
+Checking for working strptime: OK
+Checking for C99 vsnprintf: OK
+Checking for HAVE_SHARED_MMAP: OK
+Checking for HAVE_MREMAP: OK
+Checking for HAVE_INCOHERENT_MMAP: NO
+Checking for HAVE_SECURE_MKSTEMP: OK
+Checking for HAVE_IFACE_GETIFADDRS: OK
+Checking for HAVE_LITTLE_ENDIAN - runtime: OK
+Checking for HAVE_BIG_ENDIAN - runtime: NO
+Checking for kernel change notify support: OK
+Checking for Linux kernel oplocks: OK
+Checking for kernel share modes: OK
+Checking whether blkcnt_t is 32 bit: NO
+Checking whether blkcnt_t is 64 bit: OK
+Checking if can we convert from CP850 to UCS-2LE: OK
+Checking if can we convert from UTF-8 to UCS-2LE: OK
+Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
+Checking whether we can use Linux thread-specific credentials: OK
+Checking whether setreuid is available: OK
+Checking whether setresuid is available: OK
+Checking whether seteuid is available: OK
+Checking whether fcntl locking is available: OK
+Checking for the maximum value of the 'time_t' type: OK
+Checking whether the realpath function allows a NULL argument: OK
+Checking whether POSIX capabilities are available: OK
+Checking for ftruncate extend: OK
+getcwd takes a NULL argument: OK
+Checking uname sysname type: "Linux"
+Checking uname machine type: "arm"
+Checking uname release type: "3.0.0"
+Checking uname version type: "#1 Tue Nov 1 12:34:56 UTC 2013"
+Checking for WORDS_BIGENDIAN: NO
+Checking size of bool: "1"
+Checking size of char: "1"
+Checking size of int: "4"
+Checking size of long long: "8"
+Checking size of long: "4"
+Checking size of short: "2"
+Checking size of size_t: "4"
+Checking size of ssize_t: "4"
+Checking size of int8_t: "1"
+Checking size of uint8_t: "1"
+Checking size of int16_t: "2"
+Checking size of uint16_t: "2"
+Checking size of int32_t: "4"
+Checking size of uint32_t: "4"
+Checking size of int64_t: "8"
+Checking size of uint64_t: "8"
+Checking size of void*: "4"
+Checking size of off_t: "8"
+Checking size of dev_t: "8"
+Checking size of ino_t: "8"
+Checking size of time_t: "4"
+Checking size of ((struct utmp *)NULL)->ut_line: "32"
+Checking value of NSIG: "65"
+Checking value of _NSIG: "65"
+Checking value of SIGRTMAX: "64"
+Checking value of SIGRTMIN: "34"
diff --git a/package/samba4/powerpc-cache.txt b/package/samba4/powerpc-cache.txt
new file mode 100644
index 0000000..2872d1d
--- /dev/null
+++ b/package/samba4/powerpc-cache.txt
@@ -0,0 +1,65 @@
+Checking simple C program: OK
+rpath library support: OK
+-Wl,--version-script support: OK
+Checking getconf LFS_CFLAGS: NO
+Checking for large file support without additional flags: OK
+Checking for -D_LARGE_FILES: OK
+Checking correct behavior of strtoll: NO
+Checking for working strptime: OK
+Checking for C99 vsnprintf: OK
+Checking for HAVE_SHARED_MMAP: OK
+Checking for HAVE_MREMAP: OK
+Checking for HAVE_INCOHERENT_MMAP: NO
+Checking for HAVE_SECURE_MKSTEMP: OK
+Checking for HAVE_IFACE_GETIFADDRS: OK
+Checking for HAVE_LITTLE_ENDIAN - runtime: NO
+Checking for HAVE_BIG_ENDIAN - runtime: OK
+Checking for kernel change notify support: OK
+Checking for Linux kernel oplocks: OK
+Checking for kernel share modes: OK
+Checking whether blkcnt_t is 32 bit: NO
+Checking whether blkcnt_t is 64 bit: OK
+Checking if can we convert from CP850 to UCS-2LE: OK
+Checking if can we convert from UTF-8 to UCS-2LE: OK
+Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
+Checking whether we can use Linux thread-specific credentials: OK
+Checking whether setreuid is available: OK
+Checking whether setresuid is available: OK
+Checking whether seteuid is available: OK
+Checking whether fcntl locking is available: OK
+Checking for the maximum value of the 'time_t' type: OK
+Checking whether the realpath function allows a NULL argument: OK
+Checking whether POSIX capabilities are available: OK
+Checking for ftruncate extend: OK
+getcwd takes a NULL argument: OK
+Checking uname sysname type: "Linux"
+Checking uname machine type: "powerpc"
+Checking uname release type: "3.0.0"
+Checking uname version type: "#1 Tue Nov 1 12:34:56 UTC 2013"
+Checking for WORDS_BIGENDIAN: OK
+Checking size of bool: "1"
+Checking size of char: "1"
+Checking size of int: "4"
+Checking size of long long: "8"
+Checking size of long: "4"
+Checking size of short: "2"
+Checking size of size_t: "4"
+Checking size of ssize_t: "4"
+Checking size of int8_t: "1"
+Checking size of uint8_t: "1"
+Checking size of int16_t: "2"
+Checking size of uint16_t: "2"
+Checking size of int32_t: "4"
+Checking size of uint32_t: "4"
+Checking size of int64_t: "8"
+Checking size of uint64_t: "8"
+Checking size of void*: "4"
+Checking size of off_t: "8"
+Checking size of dev_t: "8"
+Checking size of ino_t: "8"
+Checking size of time_t: "4"
+Checking size of ((struct utmp *)NULL)->ut_line: "32"
+Checking value of NSIG: "65"
+Checking value of _NSIG: "65"
+Checking value of SIGRTMAX: "64"
+Checking value of SIGRTMIN: "34"
diff --git a/package/samba4/samba4-0001-build-don-t-execute-tests-summary.c.patch b/package/samba4/samba4-0001-build-don-t-execute-tests-summary.c.patch
new file mode 100644
index 0000000..ee9a46f
--- /dev/null
+++ b/package/samba4/samba4-0001-build-don-t-execute-tests-summary.c.patch
@@ -0,0 +1,67 @@
+From 960d710ee5410a5c03815a5ce6837203be00d218 Mon Sep 17 00:00:00 2001
+From: Gustavo Zacarias <gustavo@zacarias.com.ar>
+Date: Thu, 30 Jan 2014 11:14:27 -0300
+Subject: [PATCH 1/3] build: don't execute tests/summary.c
+
+tests/summary.c will never be able to be executed when cross compiling.
+Use #error and #warning directives to fail or warn accordingly when
+compiling it.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ tests/summary.c | 14 +++++---------
+ wscript         |  1 -
+ 2 files changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/tests/summary.c b/tests/summary.c
+index 27f7d4d..0843ee2 100644
+--- a/tests/summary.c
++++ b/tests/summary.c
+@@ -5,27 +5,23 @@ void exit(int);
+ int main()
+ {
+ #if !defined(HAVE_FCNTL_LOCK)
+-	printf("ERROR: No locking available. Running Samba would be unsafe\n");
+-	exit(1);
++#error "ERROR: No locking available. Running Samba would be unsafe"
+ #endif
+ 
+ #if !(defined(HAVE_IFACE_GETIFADDRS) || defined(HAVE_IFACE_IFCONF) || defined(HAVE_IFACE_IFREQ) || defined(HAVE_IFACE_AIX))
+-	printf("WARNING: No automated network interface determination\n");
++#warning "WARNING: No automated network interface determination"
+ #endif
+ 
+ #if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX) || defined(USE_LINUX_THREAD_CREDENTIALS))
+-	printf("ERROR: no seteuid method available\n");
+-	exit(1);
++#error "ERROR: no seteuid method available"
+ #endif
+ 
+ #if !(defined(STAT_STATVFS) || defined(STAT_STATFS3_OSF1) || defined(STAT_STATFS2_BSIZE) || defined(STAT_STATFS4) || defined(STAT_STATFS2_FSIZE) || defined(STAT_STATFS2_FS_DATA))
+-	printf("ERROR: No disk free routine!\n");
+-	exit(1);
++#error "ERROR: No disk free routine!"
+ #endif
+ 
+ #if !((defined(HAVE_RANDOM) || defined(HAVE_RAND)) && (defined(HAVE_SRANDOM) || defined(HAVE_SRAND)))
+-    printf("ERROR: No random or srandom routine!\n");
+-    exit(1);
++#error "ERROR: No random or srandom routine!"
+ #endif
+ 
+ 	exit(0);
+diff --git a/wscript b/wscript
+index 47b7b50..26431a4 100644
+--- a/wscript
++++ b/wscript
+@@ -170,7 +170,6 @@ def configure(conf):
+     if not conf.CHECK_CODE('#include "tests/summary.c"',
+                            define='SUMMARY_PASSES',
+                            addmain=False,
+-                           execute=True,
+                            msg='Checking configure summary'):
+         raise Utils.WafError('configure summary failed')
+     
+-- 
+1.8.3.2
+
diff --git a/package/samba4/samba4-0002-build-don-t-execute-statfs-and-f_fsid-checks.patch b/package/samba4/samba4-0002-build-don-t-execute-statfs-and-f_fsid-checks.patch
new file mode 100644
index 0000000..ea8ead8
--- /dev/null
+++ b/package/samba4/samba4-0002-build-don-t-execute-statfs-and-f_fsid-checks.patch
@@ -0,0 +1,31 @@
+From 3c16a171c008b584ed427988dde73c1d9a9de4ad Mon Sep 17 00:00:00 2001
+From: Gustavo Zacarias <gustavo@zacarias.com.ar>
+Date: Mon, 20 Jan 2014 10:17:19 -0300
+Subject: [PATCH 2/3] build: don't execute statfs and f_fsid checks
+
+There's no need to execute the statfs and statfs.f_fsid checks, the
+return value is of no consequence since it's undefined in some
+platforms and prevents cross-compiling.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ source3/wscript | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/source3/wscript b/source3/wscript
+index 501707b..2d0a62e 100644
+--- a/source3/wscript
++++ b/source3/wscript
+@@ -468,8 +468,7 @@ return acl_get_perm_np(permset_d, perm);
+     conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);',
+                     'HAVE_STATFS_F_FSID',
+                     msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid",
+-                    headers='sys/types.h sys/statfs.h',
+-                    execute=True)
++                    headers='sys/types.h sys/statfs.h')
+ 
+     if conf.CONFIG_SET('HAVE_FALLOCATE'):
+         conf.CHECK_CODE('''
+-- 
+1.8.3.2
+
diff --git a/package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch b/package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch
new file mode 100644
index 0000000..49875eb
--- /dev/null
+++ b/package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch
@@ -0,0 +1,54 @@
+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.
+
+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
+
diff --git a/package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch b/package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch
new file mode 100644
index 0000000..21e6b78
--- /dev/null
+++ b/package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch
@@ -0,0 +1,45 @@
+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.
+
+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
+
diff --git a/package/samba4/samba4-0005-builtin-heimdal-external-tools.patch b/package/samba4/samba4-0005-builtin-heimdal-external-tools.patch
new file mode 100644
index 0000000..bf0a715
--- /dev/null
+++ b/package/samba4/samba4-0005-builtin-heimdal-external-tools.patch
@@ -0,0 +1,42 @@
+Force external asn1_compile and compile_et binaries.
+At the moment the samba bundled heimdal fails to build the tools for the host
+when cross-compiling, and it can't link to an external heimdal either.
+
+Status: working with samba upstream on a proper way to cross-compile
+the bundled heimdal.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura samba-4.1.3.orig/source4/heimdal_build/wscript_build samba-4.1.3.heimdal.cross/source4/heimdal_build/wscript_build
+--- samba-4.1.3.orig/source4/heimdal_build/wscript_build	2013-12-12 16:45:46.951965484 -0300
++++ samba-4.1.3.heimdal.cross/source4/heimdal_build/wscript_build	2013-12-18 22:01:24.323429945 -0300
+@@ -925,6 +925,8 @@
+         install=False
+     )
+     bld.env['ASN1_COMPILE'] = os.path.join(bld.env['BUILD_DIRECTORY'], 'asn1_compile')
++else:
++    bld.env['ASN1_COMPILE'] = 'asn1_compile'
+ 
+ 
+ if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
+@@ -939,6 +941,8 @@
+         install=False
+         )
+     bld.env['COMPILE_ET'] = os.path.join(bld.env['BUILD_DIRECTORY'], 'compile_et')
++else:
++    bld.env['COMPILE_ET'] = 'compile_et'
+ 
+ HEIMDAL_BINARY('samba4kinit',
+     'kuser/kinit.c',
+diff -Nura samba-4.1.3.orig/source4/heimdal_build/wscript_configure samba-4.1.3.heimdal.cross/source4/heimdal_build/wscript_configure
+--- samba-4.1.3.orig/source4/heimdal_build/wscript_configure	2013-12-12 16:45:46.951965484 -0300
++++ samba-4.1.3.heimdal.cross/source4/heimdal_build/wscript_configure	2013-12-18 21:55:08.813653187 -0300
+@@ -162,6 +162,8 @@
+ conf.define('HAVE_KRB5_PRINCIPAL_GET_NUM_COMP', 1)
+ conf.define('HAVE_GSSAPI_GSSAPI_SPNEGO_H', 1)
+ conf.define('HAVE_FLAGS_IN_KRB5_CREDS', 1)
++conf.define('USING_SYSTEM_ASN1_COMPILE', 1)
++conf.define('USING_SYSTEM_COMPILE_ET', 1)
+ 
+ heimdal_includedirs = []
+ heimdal_libdirs = []
diff --git a/package/samba4/samba4.mk b/package/samba4/samba4.mk
new file mode 100644
index 0000000..583e7ec
--- /dev/null
+++ b/package/samba4/samba4.mk
@@ -0,0 +1,111 @@
+################################################################################
+#
+# samba4
+#
+################################################################################
+
+SAMBA4_VERSION = 4.1.4
+SAMBA4_SITE = http://ftp.samba.org/pub/samba/stable
+SAMBA4_SOURCE = samba-$(SAMBA4_VERSION).tar.gz
+SAMBA4_LICENSE = GPLv3+
+SAMBA4_LICENSE_FILES = COPYING
+SAMBA4_DEPENDENCIES = host-e2fsprogs host-heimdal e2fsprogs popt python zlib \
+	$(if $(BR2_PACKAGE_LIBCAP),libcap)
+
+ifeq ($(BR2_PACKAGE_ACL),y)
+	SAMBA4_CONF_OPT += --with-acl-support
+	SAMBA4_DEPENDENCIES += acl
+else
+	SAMBA4_CONF_OPT += --without-acl-support
+endif
+
+ifeq ($(BR2_PACKAGE_LIBAIO),y)
+	SAMBA4_CONF_OPT += --with-aio-support
+	SAMBA4_DEPENDENCIES += libaio
+else
+	SAMBA4_CONF_OPT += --without-aio-support
+endif
+
+ifeq ($(BR2_PACKAGE_DBUS)$(BR2_PACKAGE_AVAHI_DAEMON),yy)
+	SAMBA4_CONF_OPT += --enable-avahi
+	SAMBA4_DEPENDENCIES += avahi
+else
+	SAMBA4_CONF_OPT += --disable-avahi
+endif
+
+ifeq ($(BR2_PACKAGE_GAMIN),y)
+	SAMBA4_CONF_OPT += --with-fam
+	SAMBA4_DEPENDENCIES += gamin
+else
+	SAMBA4_CONF_OPT += --without-fam
+endif
+
+ifeq ($(BR2_PACKAGE_GETTEXT),)
+	SAMBA4_DEPDENDENCIES += --without-gettext
+endif
+
+ifeq ($(BR2_PACKAGE_GNUTLS),y)
+	SAMBA4_CONF_OPT += --enable-gnutls
+	SAMBA4_DEPENDENCIES += gnutls
+else
+	SAMBA4_CONF_OPT += --disable-gnutls
+endif
+
+ifeq ($(BR2_PACKAGE_NCURSES_TARGET_FORM)$(BR2_PACKAGE_NCURSES_TARGET_MENU)$(BR2_PACKAGE_NCURSES_TARGET_PANEL),yyy)
+	SAMBA4_DEPENDENCIES += ncurses
+else
+	SAMBA4_CONF_OPT += --without-regedit
+endif
+
+define SAMBA4_CONFIGURE_CMDS
+	cp package/samba4/$(call qstrip,$(BR2_ARCH))-cache.txt $(@D)/cache.txt;
+	(cd $(@D); \
+		PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \
+		python_LDFLAGS="" \
+		python_LIBDIR="" \
+		$(TARGET_CONFIGURE_OPTS) \
+		./buildtools/bin/waf configure \
+			--prefix=/usr \
+			--sysconfdir=/etc \
+			--localstatedir=/var \
+			--with-libiconv=$(STAGING_DIR)/usr \
+			--enable-fhs \
+			--cross-compile \
+			--cross-answers=$(@D)/cache.txt \
+			--hostcc=gcc \
+			--disable-rpath \
+			--disable-rpath-install \
+			--disable-cups \
+			--disable-iprint \
+			--without-pam \
+			--without-dmapi \
+			--without-gettext \
+			--disable-glusterfs \
+			--without-ldap \
+			--without-cluster-support \
+			--without-ads \
+			$(SAMBA4_CONF_OPT) \
+	)
+endef
+
+define SAMBA4_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
+endef
+
+define SAMBA4_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+define SAMBA4_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/samba4/S91smb \
+		$(TARGET_DIR)/etc/init.d/S91smb
+endef
+
+# uClibc-based builds don't like libtalloc in /usr/lib/samba
+define SAMBA4_MOVE_TALLOC
+	mv -f $(TARGET_DIR)/usr/lib/samba/libtalloc* $(TARGET_DIR)/usr/lib
+endef
+
+SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_MOVE_TALLOC
+
+$(eval $(generic-package))
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 4/4] samba: update description and rename patches
  2014-02-11 11:57 [Buildroot] [PATCHv2 0/4] Samba4 package Gustavo Zacarias
                   ` (2 preceding siblings ...)
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 3/4] samba4: " Gustavo Zacarias
@ 2014-02-11 11:57 ` Gustavo Zacarias
  2014-02-12 16:56   ` Arnout Vandecappelle
  3 siblings, 1 reply; 9+ messages in thread
From: Gustavo Zacarias @ 2014-02-11 11:57 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/samba/Config.in                                             | 6 +++---
 ...x-smbd-libs-avahi.patch => samba-0001-fix-smbd-libs-avahi.patch} | 0
 .../samba/{samba-getaddrinfo.patch => samba-0002-getaddrinfo.patch} | 0
 3 files changed, 3 insertions(+), 3 deletions(-)
 rename package/samba/{samba-fix-smbd-libs-avahi.patch => samba-0001-fix-smbd-libs-avahi.patch} (100%)
 rename package/samba/{samba-getaddrinfo.patch => samba-0002-getaddrinfo.patch} (100%)

diff --git a/package/samba/Config.in b/package/samba/Config.in
index 1469075..c5b7e48 100644
--- a/package/samba/Config.in
+++ b/package/samba/Config.in
@@ -4,9 +4,9 @@ config BR2_PACKAGE_SAMBA
 	depends on BR2_USE_MMU # fork()
 	select BR2_PACKAGE_POPT
 	help
-	  Provides print services to all manner of SMB/CIFS clients,
-	  including the numerous versions of Microsoft Windows
-	  operating systems.
+	  Provides secure, stable and fast file and print services
+	  for all clients using the SMB/CIFS protocol, such as all
+	  versions of DOS, Windows, OS/2, Linux and many others.
 
 	  http://www.samba.org/
 
diff --git a/package/samba/samba-fix-smbd-libs-avahi.patch b/package/samba/samba-0001-fix-smbd-libs-avahi.patch
similarity index 100%
rename from package/samba/samba-fix-smbd-libs-avahi.patch
rename to package/samba/samba-0001-fix-smbd-libs-avahi.patch
diff --git a/package/samba/samba-getaddrinfo.patch b/package/samba/samba-0002-getaddrinfo.patch
similarity index 100%
rename from package/samba/samba-getaddrinfo.patch
rename to package/samba/samba-0002-getaddrinfo.patch
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 1/4] python: fixup python-config script
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 1/4] python: fixup python-config script Gustavo Zacarias
@ 2014-02-12  7:18   ` Arnout Vandecappelle
  0 siblings, 0 replies; 9+ messages in thread
From: Arnout Vandecappelle @ 2014-02-12  7:18 UTC (permalink / raw)
  To: buildroot

On 11/02/14 12:57, Gustavo Zacarias wrote:
> From: Gustavo Zacarias <gustavo.zacarias@free-electrons.com>
> 
> The original version uses sysconfig from the python interpreter
> (normally host-python) which isn't really suited to provide information
> of the target python.
> Use the pure shell preprocessed backport from the upcoming python 3.4
> 
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 3/4] samba4: new package
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 3/4] samba4: " Gustavo Zacarias
@ 2014-02-12 16:55   ` Arnout Vandecappelle
  2014-02-12 21:48     ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Arnout Vandecappelle @ 2014-02-12 16:55 UTC (permalink / raw)
  To: buildroot

On 11/02/14 12:57, Gustavo Zacarias wrote:
> +ifeq ($(BR2_PACKAGE_GETTEXT),)
> +	SAMBA4_DEPDENDENCIES += --without-gettext
> +endif

 No dependency on gettext?

 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 4/4] samba: update description and rename patches
  2014-02-11 11:57 ` [Buildroot] [PATCHv2 4/4] samba: update description and rename patches Gustavo Zacarias
@ 2014-02-12 16:56   ` Arnout Vandecappelle
  0 siblings, 0 replies; 9+ messages in thread
From: Arnout Vandecappelle @ 2014-02-12 16:56 UTC (permalink / raw)
  To: buildroot

On 11/02/14 12:57, Gustavo Zacarias wrote:
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> ---
>  package/samba/Config.in                                             | 6 +++---
>  ...x-smbd-libs-avahi.patch => samba-0001-fix-smbd-libs-avahi.patch} | 0
>  .../samba/{samba-getaddrinfo.patch => samba-0002-getaddrinfo.patch} | 0
>  3 files changed, 3 insertions(+), 3 deletions(-)
>  rename package/samba/{samba-fix-smbd-libs-avahi.patch => samba-0001-fix-smbd-libs-avahi.patch} (100%)
>  rename package/samba/{samba-getaddrinfo.patch => samba-0002-getaddrinfo.patch} (100%)
> 
> diff --git a/package/samba/Config.in b/package/samba/Config.in
> index 1469075..c5b7e48 100644
> --- a/package/samba/Config.in
> +++ b/package/samba/Config.in
> @@ -4,9 +4,9 @@ config BR2_PACKAGE_SAMBA
>  	depends on BR2_USE_MMU # fork()
>  	select BR2_PACKAGE_POPT
>  	help
> -	  Provides print services to all manner of SMB/CIFS clients,
> -	  including the numerous versions of Microsoft Windows
> -	  operating systems.
> +	  Provides secure, stable and fast file and print services
> +	  for all clients using the SMB/CIFS protocol, such as all
> +	  versions of DOS, Windows, OS/2, Linux and many others.
>  
>  	  http://www.samba.org/
>  
> diff --git a/package/samba/samba-fix-smbd-libs-avahi.patch b/package/samba/samba-0001-fix-smbd-libs-avahi.patch
> similarity index 100%
> rename from package/samba/samba-fix-smbd-libs-avahi.patch
> rename to package/samba/samba-0001-fix-smbd-libs-avahi.patch
> diff --git a/package/samba/samba-getaddrinfo.patch b/package/samba/samba-0002-getaddrinfo.patch
> similarity index 100%
> rename from package/samba/samba-getaddrinfo.patch
> rename to package/samba/samba-0002-getaddrinfo.patch
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCHv2 3/4] samba4: new package
  2014-02-12 16:55   ` Arnout Vandecappelle
@ 2014-02-12 21:48     ` Peter Korsgaard
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2014-02-12 21:48 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

 > On 11/02/14 12:57, Gustavo Zacarias wrote:
 >> +ifeq ($(BR2_PACKAGE_GETTEXT),)
 >> +	SAMBA4_DEPDENDENCIES += --without-gettext
 >> +endif

 >  No dependency on gettext?

And there's a typo there (s/DEPDEN/DEPEND/)

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-12 21:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11 11:57 [Buildroot] [PATCHv2 0/4] Samba4 package Gustavo Zacarias
2014-02-11 11:57 ` [Buildroot] [PATCHv2 1/4] python: fixup python-config script Gustavo Zacarias
2014-02-12  7:18   ` Arnout Vandecappelle
2014-02-11 11:57 ` [Buildroot] [PATCHv2 2/4] heimdal: new package Gustavo Zacarias
2014-02-11 11:57 ` [Buildroot] [PATCHv2 3/4] samba4: " Gustavo Zacarias
2014-02-12 16:55   ` Arnout Vandecappelle
2014-02-12 21:48     ` Peter Korsgaard
2014-02-11 11:57 ` [Buildroot] [PATCHv2 4/4] samba: update description and rename patches Gustavo Zacarias
2014-02-12 16:56   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.