From patchwork Fri Oct 11 12:40:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1175142 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.137; helo=fraxinus.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="Eu0e6+mc"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46qSJf2q0Xz9sP4 for ; Fri, 11 Oct 2019 23:42:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4040086F22; Fri, 11 Oct 2019 12:42:08 +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 KoPpi35XbAFk; Fri, 11 Oct 2019 12:42:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2A04586F16; Fri, 11 Oct 2019 12:42:07 +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 36D691BF292 for ; Fri, 11 Oct 2019 12:42:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2DE3B86F01 for ; Fri, 11 Oct 2019 12:42:03 +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 QKoCDqHo-N4I for ; Fri, 11 Oct 2019 12:42:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 968FB86EB7 for ; Fri, 11 Oct 2019 12:42:01 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id 5so10292178wmg.0 for ; Fri, 11 Oct 2019 05:42:01 -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=XJmVhgQhY4RpwsuvcYPGqW/N9M86zzoYgIhn+5y+NZo=; b=Eu0e6+mcaYa8E5zCRJYCMoI7boKDeujoakKZXHQ11XC0mAdIwqPm3LVIIIQgpZNdkE wqzMv7Sqkad07R7H4cA8PeSQLx3fsitUuFaVA94UBQQqKL6JR3J7JFxuCwiYzpX0FryV XTEUA9lM6IpsCwrsSD1SCBMqnWBKsfvqCKg3Ew5yt4YbZakHHSU80hrTPVHDI+V83/pm fewhSEf4TGXtLnWEef8flWRJAAGlwVoS6HCPlFMSSEUF4NMoqoSLCeZ1tCvyWvjX0q+Y mUByDkt1ggb95rhqapLHsEzIfsfeolcF2DynXmfRo2w/OHQIdaoMhMP09aIKk5r7Wocp Rfuw== 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=XJmVhgQhY4RpwsuvcYPGqW/N9M86zzoYgIhn+5y+NZo=; b=EbT51M+cQ0NNA22nLFJoYCE1bwTuQbYUnulxo0bcgy99OCUU33BbY4uRVsXcQpAf/1 W8nKNv90HzRqiQ+HCyS7iDPJd41dlO0QhNBAE16boBQ94bMhJXeL+QgGnN0QkwjUZuHl pdei9XnKcftIa69hFXYEcSeqRLfnnTqVJbuzfzeLr85W+hxGs1AeBFdhTQOHOzeVT4Jb Dk5HXNM6Zc0n4PzkWCsFmSlOM4ztu3A3f6QIjBS7Lgj+TBFjKHmJCKBVkt06BAT2eK9x qv2lSu0k//c+qYmczDiSupAguMwj4ulPGYZhcnsS4Bh9m+QuqLYOtlAJuCaVDQm5ldxG ZK1g== X-Gm-Message-State: APjAAAUBNN4AuI/Junv58fGl7uP7ImuncA08lhTqqiUr8Wmt6Bpu4LJq F1eiV/dojrzgmXnribhHYIl89JgNNbk= X-Google-Smtp-Source: APXvYqz2VftZAfpauAs7z2W0BcFNTwAC6/C6tLgkntY4DzLuz0U/+vVYunxeNpcoyVdJw5sNASs37w== X-Received: by 2002:a1c:8157:: with SMTP id c84mr3044362wmd.56.1570797719639; Fri, 11 Oct 2019 05:41:59 -0700 (PDT) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id z5sm14336862wrs.54.2019.10.11.05.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2019 05:41:59 -0700 (PDT) From: heiko.thiery@gmail.com To: buildroot@buildroot.org Date: Fri, 11 Oct 2019 14:40:43 +0200 Message-Id: <20191011124131.28246-6-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191011124131.28246-1-heiko.thiery@gmail.com> References: <20191011124131.28246-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 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: yann.morin@orange.com, michael@walle.cc, Heiko Thiery , thomas.petazzoni@bootlin.com, heiko.thiery@gmail.com, jan.kundrat@cesnet.cz 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 | 15 +++++ package/libnetconf2/libnetconf2.hash | 2 + package/libnetconf2/libnetconf2.mk | 40 ++++++++++++ 6 files changed, 124 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 1d71a7db52..da2c80056c 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1040,6 +1040,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 0d73ead5b7..bdc5b13051 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1610,6 +1610,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..0a735b5ed6 --- /dev/null +++ b/package/libnetconf2/Config.in @@ -0,0 +1,15 @@ +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 + help + libnetconf2 is a NETCONF library in C intended for building + NETCONF clients and servers. + + https://github.com/CESNET/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..c3999b3e29 --- /dev/null +++ b/package/libnetconf2/libnetconf2.mk @@ -0,0 +1,40 @@ +################################################################################ +# +# 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_LIBSSH_SERVER), y) +LIBNETCONF2_CONF_OPTS += -DENABLE_SSH=ON +LIBNETCONF2_DEPENDENCIES += libssh +else +LIBNETCONF2_CONF_OPTS += -DENABLE_SSH=OFF +endif + +ifeq ($(BR2_PACKAGE_OPENSSL), 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 \ + -DENABLE_SSH=OFF \ + -DENABLE_TLS=OFF + +$(eval $(cmake-package)) +$(eval $(host-cmake-package))