From patchwork Wed Oct 9 11:26:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1173759 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.133; helo=hemlock.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="bCs1JSFW"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46pBlv1dC8z9s7T for ; Wed, 9 Oct 2019 22:27:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BC440882F0; Wed, 9 Oct 2019 11:27:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QxS0EV+nEmOt; Wed, 9 Oct 2019 11:27:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 4A141882F3; Wed, 9 Oct 2019 11:27:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id BA62A1BF853 for ; Wed, 9 Oct 2019 11:27:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B4BBC23039 for ; Wed, 9 Oct 2019 11:27:49 +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 lDx3sl3jrLmA for ; Wed, 9 Oct 2019 11:27:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by silver.osuosl.org (Postfix) with ESMTPS id C589D22EE6 for ; Wed, 9 Oct 2019 11:27:47 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id y19so2459268wrd.3 for ; Wed, 09 Oct 2019 04:27:47 -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=zj1mnlArHzMkA53lru3UmPDIGVOnFT9g3oOMbJxQZ7Q=; b=bCs1JSFW8s1+QwxGiyblBWDvOe2sb63Za0PNklUDmRAepxnGkGfDVuMZvnUFVBCOWr wglO0yw2KcEHdtBOig9cSnLrQkqoLYzO3nebxhrCW6cuqO7kVdqBvkS2UZ4MMp13i7w3 TwPShF3Bac/DwGvZw/JWmkfKW4K3uAzDYRG0KnCoFgQ4nFrJhMlktMUbQc8OWP9FRgg2 MKIxtN45APlhcHnO5/XNlEv+uMiTxeXYtuG2xTSNrqITn/dmSGnoW4YRDDp8AndvRZDM EYzaoYzGj62YhqdFv1CyVv9JCrKS4EJHEv+FKlO1gYFbwpE05W0bcd9whr5uhBcNnZqj vdJw== 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=zj1mnlArHzMkA53lru3UmPDIGVOnFT9g3oOMbJxQZ7Q=; b=k5NCimuDP94L3wYV+3UlMsd06Adn14rpbHXW/bm+zlSRTRcnodSs/Y/JTdsSQUjb7S zQh73jW6JXjp+7a8TVc8bkdyNWGdgkHxJb0cS0DGXWj74u7gz9xxANzN0pRVc5xSiZwc bFEfv7AD30guMDJ/bALQ0ossZ4zOX7IAyT7MI1b22i5MEI+7SoUyCLFJPE0lZqeiRumN 9lPFJ/78h1XxcCbFRAJKfrqEWKwOczUni/reABxprvynCmr82FrBA5ONqhhsOkD9IoJP jiIRC3Ahkl7MHzSsIll1gyEEAg5yRDph52cueQ/cEcAYjjg3wWJr777ufeUs5VM/dnht 8tqQ== X-Gm-Message-State: APjAAAUSSaP+eW3BbTqwIC2V+U6nctIvervFHH7BFk3zIHqw5xmtnPts 6eNCiGNK8sUkrEHlcgtlg0GNzP7f X-Google-Smtp-Source: APXvYqzIkzBfq25v9+iAwHnKGVVCJWDFAOqefhzzdjrKjXA/jlA21PdMeEG9Zv1d2HR3pp2D/dpQgw== X-Received: by 2002:adf:ec84:: with SMTP id z4mr2483234wrn.254.1570620465889; Wed, 09 Oct 2019 04:27:45 -0700 (PDT) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id e3sm1977194wme.39.2019.10.09.04.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 04:27:45 -0700 (PDT) From: heiko.thiery@gmail.com To: buildroot@buildroot.org Date: Wed, 9 Oct 2019 13:26:52 +0200 Message-Id: <20191009112656.21232-6-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191009112656.21232-1-heiko.thiery@gmail.com> References: <20191009112656.21232-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 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 , jan.kundrat@cesnet.cz, michael@walle.cc, thomas.petazzoni@bootlin.com 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 | 65 +++++++++++++++++++ package/libnetconf2/Config.in | 37 +++++++++++ package/libnetconf2/libnetconf2.hash | 2 + package/libnetconf2/libnetconf2.mk | 52 +++++++++++++++ 6 files changed, 158 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 3a7b5f3bbc..56b92cf82a 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1039,6 +1039,7 @@ F: package/python-remi/ F: package/python-sip/ N: Heiko Thiery +F: package/libnetconf2/ F: package/libyang/ N: Henrique Camargo diff --git a/package/Config.in b/package/Config.in index ca3d4d5d33..c091ad2bd8 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1608,6 +1608,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..44023a391d --- /dev/null +++ b/package/libnetconf2/0001-Add-support-for-musl-libc.patch @@ -0,0 +1,65 @@ +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. + +Patch comes from upstream commit: +https://github.com/CESNET/libnetconf2/commit/153fe40bd60499677e825e66501e8601536e0323 + +Signed-of-by: Heiko Thiery +--- + 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..986e49fac5 --- /dev/null +++ b/package/libnetconf2/Config.in @@ -0,0 +1,37 @@ +config BR2_PACKAGE_LIBNETCONF2 + bool "libnetconf2" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + depends on BR2_USE_MMU + 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. + + https://github.com/CESNET/libnetconf2 + +config BR2_PACKAGE_LIBNETCONF2_SSH + bool + help + SSH support for libnetconf2 + +config BR2_PACKAGE_LIBNETCONF2_TLS + bool + help + TLS support for libnetconf2 + +config BR2_PACKAGE_HOST_LIBNETCONF2_SSH + bool + help + SSH support for host-libnetconf2 + +config BR2_PACKAGE_HOST_LIBNETCONF2_TLS + bool + help + TLS support for host-libnetconf2 + +comment "libnetconf2 needs a toolchain w/ threads, dynamic libraray" + depends on BR2_USE_MMU + depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS 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..0b44d8e44d --- /dev/null +++ b/package/libnetconf2/libnetconf2.mk @@ -0,0 +1,52 @@ +################################################################################ +# +# 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 +HOST_LIBNETCONF2_DEPENDENCIES = host-libyang + +LIBNETCONF2_CONF_OPTS = \ + -DENABLE_BUILD_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF + +ifeq ($(BR2_PACKAGE_LIBNETCONF2_SSH), y) +LIBNETCONF2_CONF_OPTS += -DENABLE_SSH=ON +LIBNETCONF2_DEPENDENCIES += libssh +else +LIBNETCONF2_CONF_OPTS += -DENABLE_SSH=OFF +endif + +ifeq ($(BR2_PACKAGE_LIBNETCONF2_TLS), y) +LIBNETCONF2_CONF_OPTS += -DENABLE_TLS=ON +LIBNETCONF2_DEPENDENCIES += openssl +else +LIBNETCONF2_CONF_OPTS += -DENABLE_TLS=OFF +endif + +HOST_LIBNETCONF2_CONF_OPTS = \ + -DENABLE_BUILD_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF + +ifeq ($(BR2_PACKAGE_HOST_LIBNETCONF2_SSH), y) +HOST_LIBNETCONF2_CONF_OPTS += -DENABLE_SSH=ON +HOST_LIBNETCONF2_DEPENDENCIES += host-libssh +else +HOST_LIBNETCONF2_CONF_OPTS += -DENABLE_SSH=OFF +endif + +ifeq ($(BR2_PACKAGE_HOST_LIBNETCONF2_TLS), y) +HOST_LIBNETCONF2_CONF_OPTS += -DENABLE_TLS=ON +HOST_LIBNETCONF2_DEPENDENCIES += host-openssl +else +HOST_LIBNETCONF2_CONF_OPTS += -DENABLE_TLS=OFF +endif + +$(eval $(cmake-package)) +$(eval $(host-cmake-package))