From patchwork Mon Nov 27 19:15:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Kuhls X-Patchwork-Id: 841850 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yly196LRLz9s7C for ; Tue, 28 Nov 2017 06:44:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 01DFB87870; Mon, 27 Nov 2017 19:44:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r+YYwz5EUgUF; Mon, 27 Nov 2017 19:44:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id ACDA586FE5; Mon, 27 Nov 2017 19:44:23 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 95B3A1C059B for ; Mon, 27 Nov 2017 19:15:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8E6DD87535 for ; Mon, 27 Nov 2017 19:15:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WF9fegQOPknC for ; Mon, 27 Nov 2017 19:15:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout01.t-online.de (mailout01.t-online.de [194.25.134.80]) by fraxinus.osuosl.org (Postfix) with ESMTPS id BF825874B0 for ; Mon, 27 Nov 2017 19:15:47 +0000 (UTC) Received: from fwd17.aul.t-online.de (fwd17.aul.t-online.de [172.20.27.64]) by mailout01.t-online.de (Postfix) with SMTP id 2747F423E6FE for ; Mon, 27 Nov 2017 20:15:45 +0100 (CET) Received: from fli4l.lan.fli4l (G-rmNqZOwhPkJsEqSJQMlizuNS7EfwR5H88Mo5GnVuyUONaa9O6phmBdAEQ6kHcgj4@[79.228.0.224]) by fwd17.t-online.de with (TLSv1:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1eJOsZ-2t7RAm0; Mon, 27 Nov 2017 20:15:43 +0100 Received: from mahler.lan.fli4l ([192.168.1.1]:49990 helo=kuhls.lan.fli4l) by fli4l.lan.fli4l with esmtp (Exim 4.89) (envelope-from ) id 1eJOsY-0006dU-5y for buildroot@buildroot.org; Mon, 27 Nov 2017 20:15:43 +0100 From: Bernd Kuhls To: buildroot@buildroot.org Date: Mon, 27 Nov 2017 20:15:41 +0100 Message-Id: <20171127191541.8149-1-bernd.kuhls@t-online.de> X-Mailer: git-send-email 2.11.0 X-ID: G-rmNqZOwhPkJsEqSJQMlizuNS7EfwR5H88Mo5GnVuyUONaa9O6phmBdAEQ6kHcgj4 X-TOI-MSGID: 67111322-2020-4ac4-87cd-220db8920d74 Subject: [Buildroot] [PATCH/next 1/1] package/samba4: enable musl support X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Bernd Kuhls --- package/samba4/0002-musl-getpwent_r.patch | 79 ++++++++++++++++++++++++++ package/samba4/0003-musl-netdb-defines.patch | 26 +++++++++ package/samba4/0004-musl-pthread_mutex_t.patch | 26 +++++++++ package/samba4/Config.in | 7 +-- 4 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 package/samba4/0002-musl-getpwent_r.patch create mode 100644 package/samba4/0003-musl-netdb-defines.patch create mode 100644 package/samba4/0004-musl-pthread_mutex_t.patch diff --git a/package/samba4/0002-musl-getpwent_r.patch b/package/samba4/0002-musl-getpwent_r.patch new file mode 100644 index 0000000000..e3cc734388 --- /dev/null +++ b/package/samba4/0002-musl-getpwent_r.patch @@ -0,0 +1,79 @@ +Musl fix for getpwent_r + +Downloaded from +https://git.alpinelinux.org/cgit/aports/tree/main/samba/getpwent_r.patch + +Signed-off-by: Bernd Kuhls + +diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c +index 2cd6122..04f13c6 100644 +--- a/source4/torture/local/nss_tests.c ++++ b/source4/torture/local/nss_tests.c +@@ -333,6 +332,7 @@ static bool test_enum_passwd(struct torture_context *tctx, + return true; + } + ++#if HAVE_GETPWENT_R + static bool test_enum_r_passwd(struct torture_context *tctx, + struct passwd **pwd_array_p, + size_t *num_pwd_p) +@@ -381,6 +381,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx, + + return true; + } ++#endif + + static bool torture_assert_passwd_equal(struct torture_context *tctx, + const struct passwd *p1, +@@ -432,7 +433,7 @@ static bool test_passwd_r(struct torture_context *tctx) + struct passwd *pwd, pwd1, pwd2; + size_t num_pwd; + +- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd), ++ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd), + "failed to enumerate passwd"); + + for (i=0; i < num_pwd; i++) { +@@ -460,7 +461,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx) + struct passwd *pwd, pwd1, pwd2, pwd3, pwd4; + size_t num_pwd; + +- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd), ++ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd), + "failed to enumerate passwd"); + + for (i=0; i < num_pwd; i++) { +@@ -531,6 +532,7 @@ static bool test_enum_group(struct torture_context *tctx, + return true; + } + ++#if HAVE_GETGRENT_R + static bool test_enum_r_group(struct torture_context *tctx, + struct group **grp_array_p, + size_t *num_grp_p) +@@ -579,6 +581,7 @@ static bool test_enum_r_group(struct torture_context *tctx, + + return true; + } ++#endif + + static bool torture_assert_group_equal(struct torture_context *tctx, + const struct group *g1, +@@ -635,7 +638,7 @@ static bool test_group_r(struct torture_context *tctx) + struct group *grp, grp1, grp2; + size_t num_grp; + +- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp), ++ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp), + "failed to enumerate group"); + + for (i=0; i < num_grp; i++) { +@@ -663,7 +666,7 @@ static bool test_group_r_cross(struct torture_context *tctx) + struct group *grp, grp1, grp2, grp3, grp4; + size_t num_grp; + +- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp), ++ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp), + "failed to enumerate group"); + + for (i=0; i < num_grp; i++) { diff --git a/package/samba4/0003-musl-netdb-defines.patch b/package/samba4/0003-musl-netdb-defines.patch new file mode 100644 index 0000000000..ec2003504f --- /dev/null +++ b/package/samba4/0003-musl-netdb-defines.patch @@ -0,0 +1,26 @@ +Musl fix for missing netdb defines + +Downloaded from +https://git.alpinelinux.org/cgit/aports/tree/main/samba/netdb-defines.patch + +Signed-off-by: Bernd Kuhls + +diff --git a/nsswitch/wins.c b/nsswitch/wins.c +index dccb6dd..bb24acb 100644 +--- a/nsswitch/wins.c ++++ b/nsswitch/wins.c +@@ -39,6 +39,14 @@ static pthread_mutex_t wins_nss_mutex = PTHREAD_MUTEX_INITIALIZER; + #define INADDRSZ 4 + #endif + ++#ifndef NETDB_INTERNAL ++#define NETDB_INTERNAL -1 ++#endif ++ ++#ifndef NETDB_SUCCESS ++#define NETDB_SUCCESS 0 ++#endif ++ + NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, + struct hostent *he, + char *buffer, diff --git a/package/samba4/0004-musl-pthread_mutex_t.patch b/package/samba4/0004-musl-pthread_mutex_t.patch new file mode 100644 index 0000000000..eba05aac2a --- /dev/null +++ b/package/samba4/0004-musl-pthread_mutex_t.patch @@ -0,0 +1,26 @@ +Fixes musl build error + +../ctdb/tests/src/test_mutex_raw.c: In function 'main': +../ctdb/tests/src/test_mutex_raw.c:170:28: error: 'pthread_mutex_t {aka struct }' has no member named '__data' + printf("pid=%u\n", mutex->__data.__owner); + +Downloaded from +https://github.com/openembedded/meta-openembedded/blob/master/meta-networking/recipes-connectivity/samba/samba/glibc_only.patch + +Signed-off-by: Bernd Kuhls + +Index: samba-4.6.2/ctdb/tests/src/test_mutex_raw.c +=================================================================== +--- samba-4.6.2.orig/ctdb/tests/src/test_mutex_raw.c ++++ samba-4.6.2/ctdb/tests/src/test_mutex_raw.c +@@ -166,8 +166,10 @@ int main(int argc, const char **argv) + if (ret == 0) { + pthread_mutex_unlock(mutex); + } ++#ifdef __GLIBC__ + } else if (ret == EBUSY) { + printf("pid=%u\n", mutex->__data.__owner); ++#endif + } else if (ret == 0) { + pthread_mutex_unlock(mutex); + } diff --git a/package/samba4/Config.in b/package/samba4/Config.in index 298fdc6608..2b5a928f03 100644 --- a/package/samba4/Config.in +++ b/package/samba4/Config.in @@ -1,7 +1,7 @@ -comment "samba4 needs a uClibc or glibc toolchain w/ wchar, dynamic library, NPTL" +comment "samba4 needs a toolchain w/ wchar, dynamic library, NPTL" depends on BR2_TOOLCHAIN_HAS_SYNC_4 - depends on !BR2_USE_WCHAR || BR2_TOOLCHAIN_USES_MUSL \ - || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS_NPTL + depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS || \ + !BR2_TOOLCHAIN_HAS_THREADS_NPTL depends on BR2_USE_MMU config BR2_PACKAGE_SAMBA4 @@ -12,7 +12,6 @@ config BR2_PACKAGE_SAMBA4 depends on !BR2_STATIC_LIBS # python, gnutls depends on !BR2_nios2 # binary too large, relocations don't fit depends on BR2_TOOLCHAIN_HAS_SYNC_4 - depends on !BR2_TOOLCHAIN_USES_MUSL select BR2_PACKAGE_E2FSPROGS select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC select BR2_PACKAGE_POPT