pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

libnfs: Import libnfs-6.0.2



Module Name:	pkgsrc-wip
Committed By:	PHO <pho%cielonegro.org@localhost>
Pushed By:	pho
Date:		Fri Nov 14 23:25:33 2025 +0900
Changeset:	166ec84bedb276eeef43a47dc9c3d35d1f66d4f1

Modified Files:
	Makefile
Added Files:
	libnfs/COMMIT_MSG
	libnfs/DESCR
	libnfs/Makefile
	libnfs/PLIST
	libnfs/TODO
	libnfs/buildlink3.mk
	libnfs/distinfo
	libnfs/options.mk
	libnfs/patches/patch-configure.ac
	libnfs/patches/patch-include_libnfs-multithreading.h
	libnfs/patches/patch-lib_libnfs-sync.c
	libnfs/patches/patch-lib_libnfs.c
	libnfs/patches/patch-lib_multithreading.c
	libnfs/patches/patch-lib_nfs__v4.c
	libnfs/patches/patch-lib_socket.c

Log Message:
libnfs: Import libnfs-6.0.2

LIBNFS is a client library for accessing NFS shares over a network.

LIBNFS offers three different APIs, for different use:
1, RAW: A fully async low level RPC library for NFS protocols
2, NFS ASYNC: A fully asynchronous library for high level vfs functions
3, NFS SYNC: A synchronous library for high level vfs functions

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=166ec84bedb276eeef43a47dc9c3d35d1f66d4f1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |  1 +
 libnfs/COMMIT_MSG                                  |  8 +++++
 libnfs/DESCR                                       |  6 ++++
 libnfs/Makefile                                    | 37 +++++++++++++++++++
 libnfs/PLIST                                       | 20 +++++++++++
 libnfs/TODO                                        |  2 ++
 libnfs/buildlink3.mk                               | 12 +++++++
 libnfs/distinfo                                    | 12 +++++++
 libnfs/options.mk                                  | 18 ++++++++++
 libnfs/patches/patch-configure.ac                  | 15 ++++++++
 .../patches/patch-include_libnfs-multithreading.h  | 29 +++++++++++++++
 libnfs/patches/patch-lib_libnfs-sync.c             | 16 +++++++++
 libnfs/patches/patch-lib_libnfs.c                  | 16 +++++++++
 libnfs/patches/patch-lib_multithreading.c          | 41 ++++++++++++++++++++++
 libnfs/patches/patch-lib_nfs__v4.c                 | 16 +++++++++
 libnfs/patches/patch-lib_socket.c                  | 16 +++++++++
 16 files changed, 265 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 17dc9301c2..abcf7d32eb 100644
--- a/Makefile
+++ b/Makefile
@@ -2139,6 +2139,7 @@ SUBDIR+=	libnestedsums
 SUBDIR+=	libneural
 SUBDIR+=	libnfc
 SUBDIR+=	libnfo
+SUBDIR+=	libnfs
 SUBDIR+=	libnl
 SUBDIR+=	libnl1
 SUBDIR+=	libnoise
diff --git a/libnfs/COMMIT_MSG b/libnfs/COMMIT_MSG
new file mode 100644
index 0000000000..7bd79a32ee
--- /dev/null
+++ b/libnfs/COMMIT_MSG
@@ -0,0 +1,8 @@
+net/libnfs: Import libnfs-6.0.2
+
+LIBNFS is a client library for accessing NFS shares over a network.
+
+LIBNFS offers three different APIs, for different use:
+1, RAW: A fully async low level RPC library for NFS protocols
+2, NFS ASYNC: A fully asynchronous library for high level vfs functions
+3, NFS SYNC: A synchronous library for high level vfs functions
diff --git a/libnfs/DESCR b/libnfs/DESCR
new file mode 100644
index 0000000000..fda335c011
--- /dev/null
+++ b/libnfs/DESCR
@@ -0,0 +1,6 @@
+LIBNFS is a client library for accessing NFS shares over a network.
+
+LIBNFS offers three different APIs, for different use:
+1, RAW: A fully async low level RPC library for NFS protocols
+2, NFS ASYNC: A fully asynchronous library for high level vfs functions
+3, NFS SYNC: A synchronous library for high level vfs functions
diff --git a/libnfs/Makefile b/libnfs/Makefile
new file mode 100644
index 0000000000..0c47239423
--- /dev/null
+++ b/libnfs/Makefile
@@ -0,0 +1,37 @@
+# $NetBSD$
+
+DISTNAME=	libnfs-6.0.2
+CATEGORIES=	net filesystems
+MASTER_SITES=	${MASTER_SITE_GITHUB:=sahlberg/}
+GITHUB_TAG=	refs/tags/${DISTNAME}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/sahlberg/libnfs
+COMMENT=	NFS client library
+# LGPL applies to the library itself, and GPL applies to utilities.
+LICENSE=	gnu-lgpl-v2.1 AND gnu-gpl-v3
+
+WRKSRC=		${WRKDIR}/${GITHUB_PROJECT}-${DISTNAME}
+
+USE_TOOLS+=	autoconf automake autoreconf pkg-config
+USE_LIBTOOL=	yes
+
+GNU_CONFIGURE=		yes
+CONFIGURE_ARGS+=	--enable-utils
+CONFIGURE_ARGS+=	--enable-pthread
+CONFIGURE_ARGS+=	--disable-werror # -Werror is only good for development.
+
+.include "../../mk/bsd.fast.prefs.mk"
+.if ${OPSYS} == "Linux"
+# GnuTLS is of course platform-independent but the way libnfs uses it is
+# Linux-dependent.
+.  include "../../security/gnutls/buildlink3.mk"
+.endif
+
+.include "options.mk"
+
+pre-configure:
+	cd ${WRKSRC} && ${SH} ./bootstrap
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/libnfs/PLIST b/libnfs/PLIST
new file mode 100644
index 0000000000..546f721022
--- /dev/null
+++ b/libnfs/PLIST
@@ -0,0 +1,20 @@
+@comment $NetBSD$
+bin/nfs-cat
+bin/nfs-cp
+bin/nfs-ls
+bin/nfs-stat
+include/nfsc/libnfs-raw-mount.h
+include/nfsc/libnfs-raw-nfs.h
+include/nfsc/libnfs-raw-nfs4.h
+include/nfsc/libnfs-raw-nlm.h
+include/nfsc/libnfs-raw-nsm.h
+include/nfsc/libnfs-raw-portmap.h
+include/nfsc/libnfs-raw-rquota.h
+include/nfsc/libnfs-raw.h
+include/nfsc/libnfs-zdr.h
+include/nfsc/libnfs.h
+lib/libnfs.la
+lib/pkgconfig/libnfs.pc
+man/man1/nfs-cat.1
+man/man1/nfs-cp.1
+man/man1/nfs-ls.1
diff --git a/libnfs/TODO b/libnfs/TODO
new file mode 100644
index 0000000000..643e46fae3
--- /dev/null
+++ b/libnfs/TODO
@@ -0,0 +1,2 @@
+The package is complete. The only reason it's in wip is that no packages in
+the main pkgsrc tree uses it atm.
diff --git a/libnfs/buildlink3.mk b/libnfs/buildlink3.mk
new file mode 100644
index 0000000000..8b002c2d78
--- /dev/null
+++ b/libnfs/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	libnfs
+
+.if !defined(LIBNFS_BUILDLINK3_MK)
+LIBNFS_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.libnfs+=	libnfs>=6.0.2
+BUILDLINK_PKGSRCDIR.libnfs?=	../../wip/libnfs
+.endif	# LIBNFS_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-libnfs
diff --git a/libnfs/distinfo b/libnfs/distinfo
new file mode 100644
index 0000000000..b324572af7
--- /dev/null
+++ b/libnfs/distinfo
@@ -0,0 +1,12 @@
+$NetBSD$
+
+BLAKE2s (libnfs-6.0.2.tar.gz) = 0932b7a35afda2e6d819113448bf4f0355e516f06111325f2f0fd09389ec7e2c
+SHA512 (libnfs-6.0.2.tar.gz) = 539790ab98aac7b2f25755b745d1f5e016518f1adb3748b8c58df187048bc31e091915d59e6359bb95c49dd986361cbbf2536edcda02598b0fac236762b61a46
+Size (libnfs-6.0.2.tar.gz) = 338988 bytes
+SHA1 (patch-configure.ac) = 57b3a9158a7cfcd94bd197a25e3555a6cf4b1acb
+SHA1 (patch-include_libnfs-multithreading.h) = b83c7e448823f3943174ecc290e7f10a0eac51f8
+SHA1 (patch-lib_libnfs-sync.c) = e038e91cfbe2d2392452b0c81e7284ed77cfdff6
+SHA1 (patch-lib_libnfs.c) = de2e55d0d29762e7e8cb800e2337a2db2b88ffb5
+SHA1 (patch-lib_multithreading.c) = 1cd8e9ff04c269675684d4dbd59dc347133d7442
+SHA1 (patch-lib_nfs__v4.c) = 2739ca9d59b05a8d00762fe2a847d5a4fba2e70a
+SHA1 (patch-lib_socket.c) = 7aa200f0ef40e713616fe097285a51a86294ec48
diff --git a/libnfs/options.mk b/libnfs/options.mk
new file mode 100644
index 0000000000..2ecafb88f0
--- /dev/null
+++ b/libnfs/options.mk
@@ -0,0 +1,18 @@
+# $NetBSD$
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.libnfs
+PKG_SUPPORTED_OPTIONS=	gssapi
+PKG_SUGGESTED_OPTIONS=	# empty
+
+.include "../../mk/bsd.options.mk"
+
+###
+### KRB5 support
+###
+.if !empty(PKG_OPTIONS:Mgssapi)
+CONFIGURE_ARGS+=	--with-libkrb5
+KRB5_ACCEPTED=		mit-krb5
+.  include "../../mk/krb5.buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--without-libkrb5
+.endif
diff --git a/libnfs/patches/patch-configure.ac b/libnfs/patches/patch-configure.ac
new file mode 100644
index 0000000000..0194e2749d
--- /dev/null
+++ b/libnfs/patches/patch-configure.ac
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Improve portability: Directly check for getprotobyname(3) instead of
+guessing with OS-specific CPP macros.
+
+--- configure.ac.orig	2025-11-14 13:42:24.723919501 +0000
++++ configure.ac
+@@ -182,6 +182,7 @@ AC_CHECK_HEADERS([unistd.h])
+ # check for netdb.h
+ dnl Check for netdb.h
+ AC_CHECK_HEADERS([netdb.h])
++AC_CHECK_FUNCS([getprotobyname])
+ 
+ # check for utime.h
+ dnl Check for utime.h
diff --git a/libnfs/patches/patch-include_libnfs-multithreading.h b/libnfs/patches/patch-include_libnfs-multithreading.h
new file mode 100644
index 0000000000..2239583c9a
--- /dev/null
+++ b/libnfs/patches/patch-include_libnfs-multithreading.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Improve portability: Use of pthread_threadid_np(2) or gettid(2) is never a
+good idea, especially when pthread_equal(3) suffices.
+
+--- include/libnfs-multithreading.h.orig	2025-11-14 13:32:34.996331119 +0000
++++ include/libnfs-multithreading.h
+@@ -41,11 +41,7 @@ typedef dispatch_semaphore_t libnfs_sem_
+ #include <semaphore.h>
+ typedef sem_t libnfs_sem_t;
+ #endif
+-#ifdef HAVE_PTHREAD_THREADID_NP
+-typedef uint64_t nfs_tid_t;
+-#else
+-typedef pid_t nfs_tid_t;
+-#endif
++typedef libnfs_thread_t nfs_tid_t;
+ #endif /* HAVE_PTHREAD */
+ 
+ #ifdef WIN32
+@@ -56,6 +52,8 @@ typedef DWORD nfs_tid_t;
+ #endif
+ 
+ nfs_tid_t nfs_mt_get_tid(void);
++int nfs_mt_equal(nfs_tid_t t1, nfs_tid_t t2);
++
+ int nfs_mt_mutex_init(libnfs_mutex_t *mutex);
+ int nfs_mt_mutex_destroy(libnfs_mutex_t *mutex);
+ int nfs_mt_mutex_lock(libnfs_mutex_t *mutex);
diff --git a/libnfs/patches/patch-lib_libnfs-sync.c b/libnfs/patches/patch-lib_libnfs-sync.c
new file mode 100644
index 0000000000..54e751a115
--- /dev/null
+++ b/libnfs/patches/patch-lib_libnfs-sync.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Improve portability: Use of pthread_threadid_np(2) or gettid(2) is never a
+good idea, especially when pthread_equal(3) suffices.
+
+--- lib/libnfs-sync.c.orig	2025-11-14 13:37:44.606850244 +0000
++++ lib/libnfs-sync.c
+@@ -133,7 +133,7 @@ nfs_init_cb_data(struct nfs_context **nf
+                 struct nfs_thread_context *ntc;
+ 
+                 for(ntc = (*nfs)->nfsi->thread_ctx; ntc; ntc = ntc->next) {
+-                        if (nfs_mt_get_tid() == ntc->tid) {
++                        if (nfs_mt_equal(nfs_mt_get_tid(), ntc->tid)) {
+                                 break;
+                         }
+                 }
diff --git a/libnfs/patches/patch-lib_libnfs.c b/libnfs/patches/patch-lib_libnfs.c
new file mode 100644
index 0000000000..288c361a4a
--- /dev/null
+++ b/libnfs/patches/patch-lib_libnfs.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Improve portability: Use of pthread_threadid_np(2) or gettid(2) is never a
+good idea, especially when pthread_equal(3) suffices.
+
+--- lib/libnfs.c.orig	2025-11-14 13:38:41.562942211 +0000
++++ lib/libnfs.c
+@@ -229,7 +229,7 @@ nfs_get_error(struct nfs_context *nfs)
+                 struct nfs_thread_context *ntc;
+ 
+                 for(ntc = nfs->nfsi->thread_ctx; ntc; ntc = ntc->next) {
+-                        if (nfs_mt_get_tid() == ntc->tid) {
++                        if (nfs_mt_equal(nfs_mt_get_tid(), ntc->tid)) {
+                                 nfs = &ntc->nfs;
+                                 break;
+                         }
diff --git a/libnfs/patches/patch-lib_multithreading.c b/libnfs/patches/patch-lib_multithreading.c
new file mode 100644
index 0000000000..1328811623
--- /dev/null
+++ b/libnfs/patches/patch-lib_multithreading.c
@@ -0,0 +1,41 @@
+$NetBSD$
+
+Improve portability: Use of pthread_threadid_np(2) or gettid(2) is never a
+good idea, especially when pthread_equal(3) suffices.
+
+--- lib/multithreading.c.orig	2025-11-14 13:33:44.250912762 +0000
++++ lib/multithreading.c
+@@ -60,16 +60,12 @@
+ 
+ nfs_tid_t nfs_mt_get_tid(void)
+ {
+-#ifdef HAVE_PTHREAD_THREADID_NP
+-        nfs_tid_t tid;
+-        pthread_threadid_np(NULL, &tid);
+-        return tid;
+-#elif defined(SYS_gettid)
+-        pid_t tid = syscall(SYS_gettid);
+-        return tid;
+-#else
+-#error "SYS_gettid unavailable on this system"
+-#endif
++        return pthread_self();
++}
++
++int nfs_mt_equal(nfs_tid_t t1, nfs_tid_t t2)
++{
++        return pthread_equal(t1, t2);
+ }
+ 
+ static void *nfs_mt_service_thread(void *arg)
+@@ -231,6 +227,10 @@ nfs_tid_t nfs_mt_get_tid(void)
+ {
+     return GetCurrentThreadId();
+ }
++int nfs_mt_equal(nfs_tid_t t1, nfs_tid_t t2)
++{
++    return t1 == t2;
++}
+ static void* nfs_mt_service_thread(void* arg)
+ {
+     struct nfs_context* nfs = (struct nfs_context*)arg;
diff --git a/libnfs/patches/patch-lib_nfs__v4.c b/libnfs/patches/patch-lib_nfs__v4.c
new file mode 100644
index 0000000000..80d9cb4186
--- /dev/null
+++ b/libnfs/patches/patch-lib_nfs__v4.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Fix misuse of ctype(3) functions: char values must always be cast to
+unsigned char.
+
+--- lib/nfs_v4.c.orig	2025-11-14 14:16:21.037945741 +0000
++++ lib/nfs_v4.c
+@@ -433,7 +433,7 @@ nfs_get_ugid(struct nfs_context *nfs, co
+         const char *name = buf;
+ 
+         while (slen) {
+-                if (isdigit(*buf)) {
++                if (isdigit((unsigned char)*buf)) {
+                         ugid *= 10;
+                         ugid += *buf - '0';
+                 } else {
diff --git a/libnfs/patches/patch-lib_socket.c b/libnfs/patches/patch-lib_socket.c
new file mode 100644
index 0000000000..9efa156a0c
--- /dev/null
+++ b/libnfs/patches/patch-lib_socket.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Improve portability: Directly check for getprotobyname(3) instead of
+guessing with OS-specific CPP macros.
+
+--- lib/socket.c.orig	2025-11-14 14:14:24.604057983 +0000
++++ lib/socket.c
+@@ -170,7 +170,7 @@ set_tcp_sockopt(int sockfd, int optname,
+ {
+ 	int level;
+ 
+-	#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun) || (defined(__APPLE__) && defined(__MACH__))
++	#if defined(HAVE_GETPROTOBYNAME)
+ 	struct protoent *buf;
+ 
+ 	if ((buf = getprotobyname("tcp")) != NULL)


Home | Main Index | Thread Index | Old Index