From patchwork Tue Oct 1 14:30:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1169987 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="c4L1npjK"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46jMCB0zc7z9sDB for ; Wed, 2 Oct 2019 00:31:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 66D082048F; Tue, 1 Oct 2019 14:31:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CNxV2VfAY7JO; Tue, 1 Oct 2019 14:31:05 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 6D9672154A; Tue, 1 Oct 2019 14:30:55 +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 863881BF592 for ; Tue, 1 Oct 2019 14:30:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8334985D11 for ; Tue, 1 Oct 2019 14:30:54 +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 QQtGC70guVhG for ; Tue, 1 Oct 2019 14:30:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 7220285A22 for ; Tue, 1 Oct 2019 14:30:53 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id p7so3657616wmp.4 for ; Tue, 01 Oct 2019 07:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SILeNAUNL6iNgSswJG61Fpv0UY3zkYtTx2Vd8oCWBoM=; b=c4L1npjKac/ca7lTT8MP1r68HYCuZjqwE5waCzE3zO5jmub9G7HVQWTuqCXklRKtds ibwy2ENMzCQpP95LCG+FAHLmbpF6yTa3NAsIRlzIc3smdp+anBtim1ZxIBEvYi9wBTx8 S3AHvLbx+XlRANuSOIU3k76WY7R8X7BZRmNDprhuC+XyxIwNx1qnhdHNi0K/LhSQgERL jCsNg5X80E0L8fgNbmsmkmQVsgioY/m7IZrpn0E/fDDDpwPk0obsQYsMMCL+v+9RND8i zVaLuIRyP31SUZgfb/yBPRLq4VATZyr+R8W2J3zctzZ5tNZ6kcrxU2IBvh5xI/iEqYu1 NpCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SILeNAUNL6iNgSswJG61Fpv0UY3zkYtTx2Vd8oCWBoM=; b=BV3ay4xTaQiW6tYAXTEv89KB6JCZG/e+1ecTsxQ1sCYNyJtssuUMEnuC/6uFEhtdNb hdl0sNwpa0sjv5mlVfMUbBIY88evDhTATa81dg54d4eJvIe9wXykKCkxgVyLwRYkYqpr 0tj2KwzlFPYr1CCYepASJyH86iSaDwzcVkqERy/wqr+7mhO3Z8yN2p0XhJd8i76s7MJ2 KcR/tanVnhkdLiEwxpo+WL4j95Jck5dINXz6LNXWRLc0ygIvhA4Px9Q3irgfol/H3J77 a4GZT4PHzTMkj9cQ2/zNeH0awRI8cjc/d9LfeUGP68O80Vv5T9vxUGoEsdCty7/LKPGR GW4g== X-Gm-Message-State: APjAAAWEp49QHmWns+gNFbdlZVPFfhr6g49NyeSCxIgg8lJRu7ZI2BDH m5n6me2pwY+XlC2RKMUZHCJjG4de X-Google-Smtp-Source: APXvYqwRY8HItCFhsQSxoEcqHhT7IWN49r0EDmKueODiLUrDGl9OIWO4bhtvcVvgJ3bS7RdxO8DOIg== X-Received: by 2002:a7b:c5c2:: with SMTP id n2mr3948907wmk.20.1569940251503; Tue, 01 Oct 2019 07:30:51 -0700 (PDT) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id y5sm4027506wma.14.2019.10.01.07.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 07:30:51 -0700 (PDT) From: heiko.thiery@gmail.com To: buildroot@buildroot.org Date: Tue, 1 Oct 2019 16:30:18 +0200 Message-Id: <20191001143023.698-5-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191001143023.698-1-heiko.thiery@gmail.com> References: <20191001143023.698-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 5/9] package/libnetconf2: add package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko.thiery@gmail.com, Heiko Thiery Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Heiko Thiery libnetconf2 is a NETCONF library in C intended for building NETCONF clients and servers. Signed-off-by: Heiko Thiery --- DEVELOPERS | 1 + package/Config.in | 1 + .../0001-Add-support-for-musl-libc.patch | 60 +++++++++++++++++++ package/libnetconf2/Config.in | 10 ++++ package/libnetconf2/libnetconf2.hash | 2 + package/libnetconf2/libnetconf2.mk | 28 +++++++++ 6 files changed, 102 insertions(+) create mode 100644 package/libnetconf2/0001-Add-support-for-musl-libc.patch create mode 100644 package/libnetconf2/Config.in create mode 100644 package/libnetconf2/libnetconf2.hash create mode 100644 package/libnetconf2/libnetconf2.mk diff --git a/DEVELOPERS b/DEVELOPERS index a378ff2a61..527b8cccac 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1039,6 +1039,7 @@ F: package/python-sip/ N: Heiko Thiery F: package/libredblack/ F: package/libyang/ +F: package/libnetconf2/ N: Henrique Camargo F: package/json-glib/ diff --git a/package/Config.in b/package/Config.in index 04cd466eba..f9b1b88b91 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1607,6 +1607,7 @@ menu "Networking" source "package/libnatpmp/Config.in" source "package/libndp/Config.in" source "package/libnet/Config.in" + source "package/libnetconf2/Config.in" source "package/libnetfilter_acct/Config.in" source "package/libnetfilter_conntrack/Config.in" source "package/libnetfilter_cthelper/Config.in" diff --git a/package/libnetconf2/0001-Add-support-for-musl-libc.patch b/package/libnetconf2/0001-Add-support-for-musl-libc.patch new file mode 100644 index 0000000000..e6d97ba90f --- /dev/null +++ b/package/libnetconf2/0001-Add-support-for-musl-libc.patch @@ -0,0 +1,60 @@ +From 153fe40bd60499677e825e66501e8601536e0323 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 15 Jul 2019 18:15:28 -0700 +Subject: [PATCH] Add support for musl libc + +musl does not support pthread_rwlockattr_setkind_np. Don't use it if it is +not available. +--- + CMakeLists.txt | 1 + + src/config.h.in | 3 +++ + src/session_server.c | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 624b8c8..c05cd03 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -176,6 +176,7 @@ target_link_libraries(netconf2 ${CMAKE_THREAD_LIBS_INIT}) + set(CMAKE_REQUIRED_LIBRARIES pthread) + check_include_file(stdatomic.h HAVE_STDATOMIC) + check_function_exists(pthread_mutex_timedlock HAVE_PTHREAD_MUTEX_TIMEDLOCK) ++check_function_exists(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) + + # dependencies - openssl + if(ENABLE_TLS OR ENABLE_DNSSEC OR ENABLE_SSH) +diff --git a/src/config.h.in b/src/config.h.in +index 96d33c5..30dd8a3 100644 +--- a/src/config.h.in ++++ b/src/config.h.in +@@ -73,4 +73,7 @@ + */ + #define NC_PS_QUEUE_SIZE @MAX_PSPOLL_THREAD_COUNT@ + ++/* Portability feature-check macros. */ ++#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP ++ + #endif /* NC_CONFIG_H_ */ +diff --git a/src/session_server.c b/src/session_server.c +index 636b1a2..3b747ed 100644 +--- a/src/session_server.c ++++ b/src/session_server.c +@@ -560,6 +560,7 @@ nc_server_init(struct ly_ctx *ctx) + errno=0; + + if (pthread_rwlockattr_init(&attr) == 0) { ++#if defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) + if (pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) == 0) { + if (pthread_rwlock_init(&server_opts.endpt_lock, &attr) != 0) { + ERR("%s: failed to init rwlock(%s).", __FUNCTION__, strerror(errno)); +@@ -570,6 +571,7 @@ nc_server_init(struct ly_ctx *ctx) + } else { + ERR("%s: failed set attribute (%s).", __FUNCTION__, strerror(errno)); + } ++#endif + pthread_rwlockattr_destroy(&attr); + } else { + ERR("%s: failed init attribute (%s).", __FUNCTION__, strerror(errno)); +-- +2.20.1 + diff --git a/package/libnetconf2/Config.in b/package/libnetconf2/Config.in new file mode 100644 index 0000000000..a991c78c05 --- /dev/null +++ b/package/libnetconf2/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_LIBNETCONF2 + bool "libnetconf2 - NETCONF library" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_LIBYANG + select BR2_PACKAGE_LIBSSH + select BR2_PACKAGE_LIBSSH_SERVER + help + libnetconf2 is a NETCONF library in C intended for building + NETCONF clients and servers. diff --git a/package/libnetconf2/libnetconf2.hash b/package/libnetconf2/libnetconf2.hash new file mode 100644 index 0000000000..c6d1f5185d --- /dev/null +++ b/package/libnetconf2/libnetconf2.hash @@ -0,0 +1,2 @@ +sha256 760061fb1c1fe87a2a068d5a9e5affcef280044c5940ef344854e9ea7ec26452 libnetconf2-v0.12-r2.tar.gz +sha256 085122ea91161812dda9cd2f42d8c50ecc3a48cc1a4f15044d86cfc5aa887577 LICENSE diff --git a/package/libnetconf2/libnetconf2.mk b/package/libnetconf2/libnetconf2.mk new file mode 100644 index 0000000000..7bafe78324 --- /dev/null +++ b/package/libnetconf2/libnetconf2.mk @@ -0,0 +1,28 @@ +################################################################################ +# +# libnetconf2 +# +################################################################################ + +LIBNETCONF2_VERSION = v0.12-r2 +LIBNETCONF2_SITE = $(call github,CESNET,libnetconf2,$(LIBNETCONF2_VERSION)) +LIBNETCONF2_INSTALL_STAGING = YES +LIBNETCONF2_LICENSE = BSD-3-Clause +LIBNETCONF2_LICENSE_FILES = LICENSE +LIBNETCONF2_DEPENDENCIES += libyang libssh +HOST_LIBNETCONF2_DEPENDENCIES += host-libyang host-libssh + +LIBNETCONF2_CONF_OPTS += \ + -DENABLE_TLS=ON \ + -DENABLE_SSH=ON \ + -DENABLE_BUILD_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF + +HOST_LIBNETCONF2_CONF_OPTS += \ + -DENABLE_TLS=ON \ + -DENABLE_SSH=ON \ + -DENABLE_BUILD_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF + +$(eval $(cmake-package)) +$(eval $(host-cmake-package))