Change:
Not sure how difficult it'd be to fix this, but thought I'd note it somewhere. We recently bumped to 0.8.5 but I don't see any reason that would make the patch apply again (although I can't confirm this myself :)). If it can't be resolved reasonably perhaps the patch should be dropped and "darwin" removed from ? EDIT: Looks like libbsd has a separate "port" for OSX: which I've filed an issue on (like was done previously, apparently): Try to build libbsd on Darwin; look at Hydra/Travis build failures. System: (NixOS: , Ubuntu/Fedora: , ...) Nix version: (run ) Nixpkgs version: (run ) Sandboxing enabled: (run )
Yeah, I have just been manually updating the patch since v0.8.3. The "correct" thing to do would be to get the patch applied upstream in libbsd. Perhaps freedesktop doesn't want it though. /cc

Discussion:
diff --git a/configure.ac b/configure.ac <del> index c909878..60c540e 100644 </del> <ins> index 88ccd91..0857782 100644 </ins> --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,7 @@ AS_CASE([$host_os],

+		os_is_macosx=false +		nonLinuxOS=false +		;; <del> +esac </del> <ins> +esac </ins> +AM_CONDITIONAL([IS_DARWIN], [test x$os_is_macosx = xtrue]) +AM_COND_IF([IS_DARWIN], +	[AC_DEFINE([IS_DARWIN], [1], [Get HostOS Type is Darwin])])

#include <sys/types.h> #include <stdint.h> diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h <del> index 4b69983..8e2ac75 100644 </del> <ins> index 4b69983..c75151b 100644 </ins> --- a/include/bsd/stdio.h +++ b/include/bsd/stdio.h @@ -48,12 +48,16 @@

/* XXX: The function requires cooperation from the system libc to store the * line buffer in the FILE struct itself. */ char *fgetln(FILE *fp, size_t *lenp) <del> LIBBSD_DEPRECATED("This functions cannot be safely ported, " "use getline(3) instead, as it is supported " "by GNU and POSIX.1-2008."); </del> <ins> -	LIBBSD_DEPRECATED("This functions cannot be safely ported, " -	                  "use getline(3) instead, as it is supported " -	                  "by GNU and POSIX.1-2008."); +	__attribute__((deprecated("This functions cannot be safely ported, " +	                          "use getline(3) instead, as it is supported " +	                          "by GNU and POSIX.1-2008."))); </ins> +#else +char *fgetln(FILE *fp, size_t *lenp); +#endif /* * Note: We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations, <ins> diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h index ebc9638..6cd7943 100644 --- a/include/bsd/stdlib.h +++ b/include/bsd/stdlib.h @@ -67,9 +67,11 @@ int sradixsort(const unsigned char **base, int nmemb, const unsigned char *table, unsigned endbyte); void *reallocf(void *ptr, size_t size); -#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26) +#if defined(_GNU_SOURCE) && defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if !__GLIBC_PREREQ(2, 26) void *reallocarray(void *ptr, size_t nmemb, size_t size); #endif +#endif long long strtonum(const char *nptr, long long minval, long long maxval, const char **errstr); </ins> diff --git a/include/bsd/string.h b/include/bsd/string.h <del> index ee2f953..a3ab077 100644 </del> <ins> index 6798bf6..6baaa14 100644 </ins> --- a/include/bsd/string.h +++ b/include/bsd/string.h <del> @@ -37,11 +37,14 @@ </del> <ins> @@ -37,6 +37,12 @@ </ins> #include <sys/types.h> __BEGIN_DECLS <del> -size_t strlcpy(char *dst, const char *src, size_t siz); -size_t strlcat(char *dst, const char *src, size_t siz); char *strnstr(const char *str, const char *find, size_t str_len); </del> +#if defined(darwin) || defined(__APPLE__) || defined(MACOSX) +size_t bsd_strlcpy(char *dst, const char *src, size_t siz); +size_t bsd_strlcat(char *dst, const char *src, size_t siz); <ins> +char *bsd_strnstr(const char *str, const char *find, size_t str_len); </ins> +void bsd_strmode(mode_t mode, char *str); +#else <del> void strmode(mode_t mode, char *str); - +#endif </del> <ins> size_t strlcpy(char *dst, const char *src, size_t siz); size_t strlcat(char *dst, const char *src, size_t siz); char *strnstr(const char *str, const char *find, size_t str_len); @@ -45,6 +51,7 @@ void strmode(mode_t mode, char *str); #if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25) </ins> void explicit_bzero(void *buf, size_t len); <ins> #endif +#endif </ins> __END_DECLS <ins> #endif </ins> diff --git a/src/Makefile.am b/src/Makefile.am index ad83dbf..0f2a7ee 100644 --- a/src/Makefile.am

+} #endif diff --git a/src/funopen.c b/src/funopen.c <del> index 1e05c7e..ed8ce85 100644 </del> <ins> index 1e05c7e..75e61ea 100644 </ins> --- a/src/funopen.c +++ b/src/funopen.c <del> @@ -137,7 +137,7 @@ funopen(const void *cookie, return fopencookie(cookiewrap, mode, funcswrap); } -#elif defined(__MUSL__) +#elif defined(__MUSL__) || defined(darwin) || defined(__APPLE__) || defined(MACOSX) /* * This is unimplementable on musl based systems, and upstream has stated </del> <ins> @@ -143,6 +143,7 @@ funopen(const void *cookie, </ins> * they will not add the needed support to implement it. Just ignore this <ins> * interface there, as it has never been provided anyway. */ +#elif defined(darwin) || defined(__APPLE__) || defined(MACOSX) #else #error "Function funopen() needs to be ported or disabled." #endif </ins> diff --git a/src/getentropy.c b/src/getentropy.c index 3f11a1e..8a23a07 100644 --- a/src/getentropy.c

#define SHA512_DIGEST_LENGTH		64 diff --git a/src/hash/sha512c.c b/src/hash/sha512c.c <del> index b3c8d5e..4fade0f 100644 </del> <ins> index b3c8d5e..f69013d 100644 </ins> --- a/src/hash/sha512c.c +++ b/src/hash/sha512c.c <del> @@ -25,7 +25,11 @@ </del> <ins> @@ -25,7 +25,13 @@ </ins> */ #include <sys/cdefs.h> <ins> +__FBSDID("$FreeBSD$"); + </ins> +#if defined(darwin) || defined(__APPLE__) || defined(MACOSX) +#include <machine/endian.h> +#else

#include <string.h> diff --git a/src/nlist.c b/src/nlist.c <del> index 0932f59..a3ba2be 100644 </del> <ins> index 0932f59..598a329 100644 </ins> --- a/src/nlist.c +++ b/src/nlist.c <del> @@ -27,6 +27,8 @@ </del> <ins> @@ -27,6 +27,10 @@ </ins> * SUCH DAMAGE. */ +#if !defined(darwin) && !defined(__APPLE__) && !defined(MACOSX) <del> + </del> <ins> +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)nlist.c	8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ </ins> #include <sys/cdefs.h> #include <sys/param.h> <del> @@ -265,3 +267,5 @@ nlist(const char *name, struct nlist *list) </del> <ins> @@ -265,3 +269,4 @@ nlist(const char *name, struct nlist *list) </ins> (void)close(fd); return (n); } <del> + +#endif </del> <ins> +#endif /* _NLIST_DO_ELF */ </ins> diff --git a/src/setproctitle.c b/src/setproctitle.c index 038ac7d..d0ef01b 100644 --- a/src/setproctitle.c