include $(TOPDIR)/rules.mk
PKG_NAME:=libnetconf2
+PKG_VERSION:=0.12-r1
PKG_LICENSE:=BSD-3-Clause
PKG_MAINTAINER:=Mislav Novakovic <mislav.novakovic@sartura.hr>
-PKG_VERSION:=0.11.37
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/CESNET/libnetconf2/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=86269d3f1bc85bb17d8823d214f9a676ee3b14ee18a0b87a230380df8503e8f5
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=46d56e08b161eb60f37410dae4d5e1a8a1bedd58
-PKG_MIRROR_HASH:=e12007b69eee42d1eb9925a93bcac7a71139583a76a59c78039b48cc20fc431f
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
-PKG_SOURCE_URL:=https://github.com/cesnet/libnetconf2/
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
-
-PKG_BUILD_ROOT:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
-PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)
+CMAKE_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
-CMAKE_INSTALL:=1
-
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CATEGORY:=Libraries
TITLE:=NETCONF library
URL:=$(PKG_SOURCE_URL)
- DEPENDS:= +libyang +libssh +libopenssl
+ DEPENDS:= +libyang +libssh +libopenssl +libpthread
endef
define Package/libnetconf2/description
--- /dev/null
+Index: libnetconf2-0.12-r1/CMakeLists.txt
+===================================================================
+--- libnetconf2-0.12-r1.orig/CMakeLists.txt
++++ libnetconf2-0.12-r1/CMakeLists.txt
+@@ -172,8 +172,10 @@ target_link_libraries(netconf2 ${CMAKE_T
+
+ # check availability for some pthread functions
+ set(CMAKE_REQUIRED_LIBRARIES pthread)
++include(CheckFunctionExists)
+ check_function_exists(pthread_spin_lock HAVE_SPINLOCK)
+ 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)
+Index: libnetconf2-0.12-r1/src/config.h.in
+===================================================================
+--- libnetconf2-0.12-r1.orig/src/config.h.in
++++ libnetconf2-0.12-r1/src/config.h.in
+@@ -65,4 +65,7 @@
+ */
+ #define NC_PS_QUEUE_SIZE @MAX_PSPOLL_THREAD_COUNT@
+
++/* Portability feature-check macros. */
++#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP
++
+ #endif /* NC_CONFIG_H_ */
+Index: libnetconf2-0.12-r1/src/session_server.c
+===================================================================
+--- libnetconf2-0.12-r1.orig/src/session_server.c
++++ libnetconf2-0.12-r1/src/session_server.c
+@@ -520,6 +520,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));
+@@ -530,6 +531,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));