libnfs: add 5.0.2 (#9989)

untested on 32 bit
This commit is contained in:
augiedoggie
2024-01-15 00:31:47 -07:00
committed by GitHub
parent 1c28733f5f
commit 2c48a6a82a
2 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
SUMMARY="Client library for accessing NFS shares over a network"
DESCRIPTION="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
LIBNFS can use NFS v3 and v4 and supports building RPC servers."
HOMEPAGE="https://github.com/sahlberg/libnfs"
COPYRIGHT="2010-2023 Ronnie Sahlberg"
LICENSE="GNU LGPL v2.1
GNU GPL v3
BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/sahlberg/libnfs/archive/refs/tags/libnfs-$portVersion.tar.gz"
CHECKSUM_SHA256="637e56643b19da9fba98f06847788c4dad308b723156a64748041035dcdf9bd3"
PATCHES="libnfs-$portVersion.patchset"
SOURCE_DIR="libnfs-libnfs-$portVersion"
ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="?x86"
libVersion="11.1.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
libnfs$secondaryArchSuffix = $portVersion
lib:libnfs$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
libnfs${secondaryArchSuffix}_devel = $portVersion
devel:libnfs$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
libnfs$secondaryArchSuffix == $portVersion base
"
PROVIDES_tools="
libnfs${secondaryArchSuffix}_tools = $portVersion
cmd:nfs_cat$secondaryArchSuffix = $portVersion
cmd:nfs_cp$secondaryArchSuffix = $portVersion
cmd:nfs_ls$secondaryArchSuffix = $portVersion
cmd:nfs_stat$secondaryArchSuffix = $portVersion
"
REQUIRES_tools="
haiku$secondaryArchSuffix
libnfs$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DINSTALL_CMAKE_DIR=$libDir/cmake/libnfs \
-DINSTALL_INC_DIR=$developDir/headers \
-DINSTALL_LIB_DIR=$libDir \
-DINSTALL_MAN_DIR=$manDir \
-DINSTALL_PKGCONFIG_DIR=$libDir/pkgconfig \
-DENABLE_DOCUMENTATION=On \
-DENABLE_UTILS=On
make -C build $jobArgs
}
INSTALL()
{
make -C build $jobArgs install
mkdir -pv $prefix/bin
cp -afv build/utils/nfs-* $prefix/bin
prepareInstalledDevelLib libnfs
fixPkgconfig
packageEntries devel \
$developDir \
$libDir/cmake
packageEntries tools \
$prefix/bin \
$manDir
}

View File

@@ -0,0 +1,100 @@
From c7c775afac61050330fd5ccf15cddb5be726d1ef Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Sun, 14 Jan 2024 23:41:49 -0700
Subject: Basic Haiku support
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fb0fe7..6e9c5b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL aros)
add_definitions("-D_U_=__attribute__((unused))")
add_definitions(-DAROS)
add_subdirectory(aros)
+elseif(HAIKU)
+ add_definitions("-D_U_=__attribute__((unused))")
+ list(APPEND SYSTEM_LIBRARIES network)
else()
add_definitions("-D_U_=__attribute__((unused))")
endif()
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
index f11a279..da7ef69 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -16,6 +16,7 @@ check_include_file("string.h" HAVE_STRING_H)
check_include_file("sys/filio.h" HAVE_SYS_FILIO_H)
check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
+check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H)
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H)
diff --git a/include/nfsc/libnfs.h b/include/nfsc/libnfs.h
index 71c410d..eada1ae 100755
--- a/include/nfsc/libnfs.h
+++ b/include/nfsc/libnfs.h
@@ -29,7 +29,7 @@
#include <stdint.h>
#if defined(__ANDROID__) || defined(AROS) || defined(__PPU__) \
- || ( defined(__APPLE__) && defined(__MACH__) ) || defined(__FreeBSD__) || defined(__OpenBSD__)
+ || ( defined(__APPLE__) && defined(__MACH__) ) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__)
#include <sys/time.h>
#else
#include <time.h>
diff --git a/lib/nfs_v3.c b/lib/nfs_v3.c
index bf23408..211b7cc 100644
--- a/lib/nfs_v3.c
+++ b/lib/nfs_v3.c
@@ -101,6 +101,14 @@
#include "libnfs-raw-mount.h"
#include "libnfs-private.h"
+#ifndef major
+#define major(a) 0
+#endif
+
+#ifndef minor
+#define minor(a) 0
+#endif
+
static dev_t
specdata3_to_rdev(struct specdata3 *rdev)
{
diff --git a/lib/nfs_v4.c b/lib/nfs_v4.c
index 9e3ff5e..e77703b 100644
--- a/lib/nfs_v4.c
+++ b/lib/nfs_v4.c
@@ -110,6 +110,14 @@
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#endif
+#ifndef major
+#define major(a) 0
+#endif
+
+#ifndef minor
+#define minor(a) 0
+#endif
+
struct nfs4_cb_data;
typedef int (*op_filler)(struct nfs4_cb_data *data, nfs_argop4 *op);
diff --git a/lib/socket.c b/lib/socket.c
index e025be5..c37454f 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -161,6 +161,9 @@ set_bind_device(int fd, char *ifname)
}
#ifdef HAVE_NETINET_TCP_H
+#if !defined(SOL_TCP) && defined(IPPROTO_TCP)
+#define SOL_TCP IPPROTO_TCP
+#endif
static int
set_tcp_sockopt(int sockfd, int optname, int value)
{
--
2.42.1