git: 706c1803391d - main - net/libyang2: New major version of libyang

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Thu, 07 Jul 2022 12:12:59 UTC
The branch main has been updated by olivier:

URL: https://cgit.FreeBSD.org/ports/commit/?id=706c1803391d13243fd84dfbaadb2b3d952259bc

commit 706c1803391d13243fd84dfbaadb2b3d952259bc
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2022-07-06 22:12:49 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2022-07-07 12:12:50 +0000

    net/libyang2: New major version of libyang
    
    Upcoming net/frr8 requires libyang2, but net/frr7 stills depends of libyang 1.x
---
 net/Makefile                                       |  1 +
 net/libyang2/Makefile                              | 28 ++++++++++++++++++++
 net/libyang2/distinfo                              |  3 +++
 net/libyang2/files/patch-CMakeLists.txt            | 11 ++++++++
 .../files/patch-CMakeModules_UseCompat.cmake       | 11 ++++++++
 net/libyang2/pkg-descr                             |  4 +++
 net/libyang2/pkg-plist                             | 30 ++++++++++++++++++++++
 7 files changed, 88 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index 670b1b27ce88..73fec1368cb6 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -415,6 +415,7 @@
     SUBDIR += libvncserver
     SUBDIR += libwebsockets
     SUBDIR += libyang
+    SUBDIR += libyang2
     SUBDIR += libzapojit
     SUBDIR += libzmq2
     SUBDIR += libzmq3
diff --git a/net/libyang2/Makefile b/net/libyang2/Makefile
new file mode 100644
index 000000000000..dec80bf2bbd6
--- /dev/null
+++ b/net/libyang2/Makefile
@@ -0,0 +1,28 @@
+PORTNAME=	libyang
+PORTVERSION=	2.0.194
+DISTVERSIONPREFIX=	v
+CATEGORIES=	net
+PKGNAMESUFFIX=  2
+
+MAINTAINER=	olivier@FreeBSD.org
+COMMENT=	YANG data modeling language library, version 2
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libpcre2-8.so:devel/pcre2
+TEST_DEPENDS=	cmocka>0:sysutils/cmocka
+
+USES=	cmake compiler:c++11-lang pkgconfig
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	CESNET
+
+TEST_TARGET=	test
+
+OPTIONS_DEFINE=	TEST
+
+TEST_CMAKE_BOOL=	ENABLE_TESTS
+
+.include <bsd.port.mk>
diff --git a/net/libyang2/distinfo b/net/libyang2/distinfo
new file mode 100644
index 000000000000..1fd0569619eb
--- /dev/null
+++ b/net/libyang2/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1656156499
+SHA256 (CESNET-libyang-v2.0.194_GH0.tar.gz) = 94898ee391c238dcd29ff21092e5dcab4e17b9623e88862a55b72fc6168846f8
+SIZE (CESNET-libyang-v2.0.194_GH0.tar.gz) = 1150705
diff --git a/net/libyang2/files/patch-CMakeLists.txt b/net/libyang2/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..727e627c9a7e
--- /dev/null
+++ b/net/libyang2/files/patch-CMakeLists.txt
@@ -0,0 +1,11 @@
+--- CMakeLists.txt.orig	2022-05-06 06:57:14 UTC
++++ CMakeLists.txt
+@@ -31,7 +31,7 @@ if ("${BUILD_TYPE_UPPER}" STREQUAL "RELEASE")
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UPPER)
+ if ("${BUILD_TYPE_UPPER}" STREQUAL "RELEASE")
+     set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
+-    set(CMAKE_C_FLAGS "-DNDEBUG -O2 ${CMAKE_C_FLAGS}")
++    set(CMAKE_C_FLAGS "-DNDEBUG ${CMAKE_C_FLAGS}")
+ elseif("${BUILD_TYPE_UPPER}" STREQUAL "DEBUG")
+     set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
+     set(CMAKE_C_FLAGS "-g3 -O0 ${CMAKE_C_FLAGS}")
diff --git a/net/libyang2/files/patch-CMakeModules_UseCompat.cmake b/net/libyang2/files/patch-CMakeModules_UseCompat.cmake
new file mode 100644
index 000000000000..9cc4f82a5a4c
--- /dev/null
+++ b/net/libyang2/files/patch-CMakeModules_UseCompat.cmake
@@ -0,0 +1,11 @@
+--- CMakeModules/UseCompat.cmake.orig	2022-06-25 11:42:57 UTC
++++ CMakeModules/UseCompat.cmake
+@@ -49,7 +49,7 @@ macro(USE_COMPAT)
+ 
+     include(CheckStructHasMember)
+     check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
+-    check_symbol_exists(timezone time.h HAVE_TIME_H_TIMEZONE)
++#    check_symbol_exists(timezone time.h HAVE_TIME_H_TIMEZONE)
+ 
+     check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
+     check_symbol_exists(localtime_r "time.h" HAVE_LOCALTIME_R)
diff --git a/net/libyang2/pkg-descr b/net/libyang2/pkg-descr
new file mode 100644
index 000000000000..5ecaaa5402c3
--- /dev/null
+++ b/net/libyang2/pkg-descr
@@ -0,0 +1,4 @@
+libyang is a YANG data modelling language parser and toolkit written
+(and providing API) in C.
+
+WWW: https://github.com/CESNET/libyang
diff --git a/net/libyang2/pkg-plist b/net/libyang2/pkg-plist
new file mode 100644
index 000000000000..8672ac535a52
--- /dev/null
+++ b/net/libyang2/pkg-plist
@@ -0,0 +1,30 @@
+bin/yanglint
+bin/yangre
+include/libyang/config.h
+include/libyang/context.h
+include/libyang/dict.h
+include/libyang/in.h
+include/libyang/libyang.h
+include/libyang/log.h
+include/libyang/out.h
+include/libyang/parser_data.h
+include/libyang/parser_schema.h
+include/libyang/plugins.h
+include/libyang/plugins_exts.h
+include/libyang/plugins_exts_compile.h
+include/libyang/plugins_exts_print.h
+include/libyang/plugins_types.h
+include/libyang/printer_data.h
+include/libyang/printer_schema.h
+include/libyang/set.h
+include/libyang/tree.h
+include/libyang/tree_edit.h
+include/libyang/version.h
+include/libyang/tree_data.h
+include/libyang/tree_schema.h
+lib/libyang.so
+lib/libyang.so.2
+lib/libyang.so.2.20.15
+libdata/pkgconfig/libyang.pc
+share/man/man1/yanglint.1.gz
+share/man/man1/yangre.1.gz