From b3e3604f461824e90b222babc0fd8c343c316833 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Mon, 2 Oct 2023 15:02:33 +0200 Subject: libtirpc: Add latest version and allow for builds on macOS (#40189) --- .../builtin/packages/libtirpc/macos-1.3.3.patch | 105 +++++++++++++++++++++ .../repos/builtin/packages/libtirpc/package.py | 23 ++++- 2 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 var/spack/repos/builtin/packages/libtirpc/macos-1.3.3.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/libtirpc/macos-1.3.3.patch b/var/spack/repos/builtin/packages/libtirpc/macos-1.3.3.patch new file mode 100644 index 0000000000..8e6f1efe42 --- /dev/null +++ b/var/spack/repos/builtin/packages/libtirpc/macos-1.3.3.patch @@ -0,0 +1,105 @@ +diff --git a/src/Makefile.in b/src/Makefile.in +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -90,7 +90,7 @@ + build_triplet = @build@ + host_triplet = @host@ + @AUTHDES_TRUE@am__append_1 = auth_des.c authdes_prot.c des_crypt.c des_impl.c des_soft.c svc_auth_des.c +-@SYMVERS_TRUE@am__append_2 = -Wl,--version-script=$(srcdir)/libtirpc.map ++@SYMVERS_TRUE@am__append_2 = -Wl + @GSS_TRUE@am__append_3 = auth_gss.c authgss_prot.c svc_auth_gss.c \ + @GSS_TRUE@ rpc_gss_utils.c + +diff --git a/src/getpeereid.c b/src/getpeereid.c +--- a/src/getpeereid.c ++++ b/src/getpeereid.c +@@ -24,7 +24,7 @@ + * SUCH DAMAGE. + */ + +- ++#ifndef __APPLE__ + #include + #include + #include +@@ -49,3 +49,4 @@ + *egid = uc.gid; + return (0); + } ++#endif +diff --git a/src/rpc_com.h b/src/rpc_com.h +--- a/src/rpc_com.h ++++ b/src/rpc_com.h +@@ -42,6 +42,11 @@ + + #include + ++#ifdef __APPLE__ ++ #define SOL_IPV6 IPPROTO_IPV6 ++ #define SOL_IP IPPROTO_IP ++#endif ++ + #ifdef __cplusplus + extern "C" { + #endif +diff --git a/src/svc_dg.c b/src/svc_dg.c +--- a/src/svc_dg.c ++++ b/src/svc_dg.c +@@ -37,6 +37,7 @@ + * + * Does some caching in the hopes of achieving execute-at-most-once semantics. + */ ++#define __APPLE_USE_RFC_3542 + #include + #include + #include +diff --git a/src/svc_raw.c b/src/svc_raw.c +--- a/src/svc_raw.c ++++ b/src/svc_raw.c +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + + #ifndef UDPMSGSIZE + #define UDPMSGSIZE 8800 +diff --git a/src/xdr_float.c b/src/xdr_float.c +--- a/src/xdr_float.c ++++ b/src/xdr_float.c +@@ -83,7 +83,11 @@ + }; + #else + ++#ifndef __APPLE__ + #include ++#else ++#include ++#endif + #define IEEEFP + + #endif /* vax */ +diff --git a/tirpc/reentrant.h b/tirpc/reentrant.h +--- a/tirpc/reentrant.h ++++ b/tirpc/reentrant.h +@@ -36,7 +36,7 @@ + * These definitions are only guaranteed to be valid on Linux. + */ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__APPLE__) + + #include + +diff --git a/tirpc/rpc/rpcent.h b/tirpc/rpc/rpcent.h +--- a/tirpc/rpc/rpcent.h ++++ b/tirpc/rpc/rpcent.h +@@ -50,7 +50,7 @@ + + /* These are defined in /usr/include/rpc/netdb.h, unless we are using + the C library without RPC support. */ +-#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_RPC__) || !defined(__GLIBC__) ++#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_RPC__) || !defined(__GLIBC__) && !defined(__APPLE__) + struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ diff --git a/var/spack/repos/builtin/packages/libtirpc/package.py b/var/spack/repos/builtin/packages/libtirpc/package.py index a4135f48d6..0494707310 100644 --- a/var/spack/repos/builtin/packages/libtirpc/package.py +++ b/var/spack/repos/builtin/packages/libtirpc/package.py @@ -12,6 +12,7 @@ class Libtirpc(AutotoolsPackage): homepage = "https://sourceforge.net/projects/libtirpc/" url = "https://sourceforge.net/projects/libtirpc/files/libtirpc/1.1.4/libtirpc-1.1.4.tar.bz2/download" + version("1.3.3", sha256="6474e98851d9f6f33871957ddee9714fdcd9d8a5ee9abb5a98d63ea2e60e12f3") version("1.2.6", sha256="4278e9a5181d5af9cd7885322fdecebc444f9a3da87c526e7d47f7a12a37d1cc") version("1.1.4", sha256="2ca529f02292e10c158562295a1ffd95d2ce8af97820e3534fe1b0e3aec7561d") @@ -21,10 +22,17 @@ class Libtirpc(AutotoolsPackage): # Remove -pipe flag to compiler in Makefiles when using nvhpc patch("libtirpc-remove-pipe-flag-for-nvhpc.patch", when="%nvhpc") - - # FIXME: build error on macOS - # auth_none.c:81:9: error: unknown type name 'mutex_t' - conflicts("platform=darwin", msg="Does not build on macOS") + # Allow to build on macOS + # - Remove versioning linker flags and include + # - Include missing / apple specific headers + # - Add apple pre-processor guards to guard / ignore some sections + # Taken from: + # https://github.com/unfs3/unfs3/pull/25#issuecomment-1631198490 + patch("macos-1.3.3.patch", when="@1.3.3 platform=darwin") + + # Only the latest version is known to build on macOS. Previous versions fail + # with auth_none.c:81:9: error: unknown type name 'mutex_t' + conflicts("platform=darwin", when="@:1.3.2", msg="Does not build on macOS") @property def headers(self): @@ -35,3 +43,10 @@ class Libtirpc(AutotoolsPackage): if hdrs: hdrs.directories = [self.prefix.include.tirpc, self.prefix.include] return hdrs or None + + def configure_args(self): + # See discussion in + # https://github.com/unfs3/unfs3/pull/25#issuecomment-1631198490 + if self.spec.satisfies("@1.3.3 platform=darwin"): + return ["--disable-gssapi"] + return [] -- cgit v1.2.3-60-g2f50