about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/libraries/libbsd/darwin-fix-libbsd.sym.patch15
-rw-r--r--pkgs/development/libraries/libbsd/darwin.patch309
-rw-r--r--pkgs/development/libraries/libbsd/default.nix45
-rw-r--r--pkgs/development/libraries/libmd/default.nix27
-rw-r--r--pkgs/tools/X11/inputplug/default.nix4
5 files changed, 65 insertions, 335 deletions
diff --git a/pkgs/development/libraries/libbsd/darwin-fix-libbsd.sym.patch b/pkgs/development/libraries/libbsd/darwin-fix-libbsd.sym.patch
new file mode 100644
index 0000000000000..de40da981623b
--- /dev/null
+++ b/pkgs/development/libraries/libbsd/darwin-fix-libbsd.sym.patch
@@ -0,0 +1,15 @@
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 9d22b00..c6848fc 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -198,7 +198,9 @@ libbsd_ctor_a_SOURCES = \
+ # Generate a simple libtool symbol export list to be used as a fallback if
+ # there is no version script support.
+ libbsd.sym: libbsd.map
+-	$(AM_V_GEN) $(SED) -ne 's/^[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\);/\1/p' libbsd.map > $@
++	$(AM_V_GEN) $(SED) -ne 's/^[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\);/\1/p' libbsd.map \
++	  | grep -Ev '(group_from_gid|user_from_uid|nlist|__fdnlist|bsd_getopt)' \
++	  > $@
+ 
+ if NEED_TRANSPARENT_LIBMD
+ TRANSPARENT_LIBMD_DEPENDS = format.ld
diff --git a/pkgs/development/libraries/libbsd/darwin.patch b/pkgs/development/libraries/libbsd/darwin.patch
deleted file mode 100644
index c52c64f35aee4..0000000000000
--- a/pkgs/development/libraries/libbsd/darwin.patch
+++ /dev/null
@@ -1,309 +0,0 @@
-diff --git a/configure.ac b/configure.ac
-index 5b6d22b..98c449b 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -145,7 +145,7 @@ AS_CASE([$host_os],
- AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"])
- 
- # Checks for header files.
--AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h pwd.h grp.h])
-+AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h pwd.h grp.h nlist.h])
- 
- # Checks for typedefs, structures, and compiler characteristics.
- AC_C_INLINE
-@@ -245,7 +245,9 @@ AC_LINK_IFELSE(
- 
- AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
-                 getauxval getentropy getexecname getline \
--                pstat_getproc sysconf])
-+                pstat_getproc sysconf \
-+		strlcpy strlcat strnstr strmode fpurge \
-+		user_from_uid group_from_gid])
- AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xtrue"])
- 
- AC_SUBST([MD5_LIBS])
-diff --git a/include/bsd/grp.h b/include/bsd/grp.h
-index b2705e5..c9423a2 100644
---- a/include/bsd/grp.h
-+++ b/include/bsd/grp.h
-@@ -44,8 +44,10 @@
- __BEGIN_DECLS
- int
- gid_from_group(const char *, gid_t *);
-+#if !HAVE_GROUP_FROM_GID
- const char *
- group_from_gid(gid_t, int);
-+#endif
- __END_DECLS
- 
- #endif
-diff --git a/include/bsd/pwd.h b/include/bsd/pwd.h
-index 798af4b..6ae5244 100644
---- a/include/bsd/pwd.h
-+++ b/include/bsd/pwd.h
-@@ -44,8 +44,10 @@
- __BEGIN_DECLS
- int
- uid_from_user(const char *, uid_t *);
-+#if !HAVE_USER_FROM_UID
- const char *
- user_from_uid(uid_t, int);
-+#endif
- __END_DECLS
- 
- #endif
-diff --git a/include/bsd/string.h b/include/bsd/string.h
-index f987fee..a1e17ed 100644
---- a/include/bsd/string.h
-+++ b/include/bsd/string.h
-@@ -41,10 +41,21 @@
- #include <sys/types.h>
- 
- __BEGIN_DECLS
-+#if !HAVE_STRLCPY
- size_t strlcpy(char *dst, const char *src, size_t siz);
-+#endif
-+
-+#if !HAVE_STRLCAT
- size_t strlcat(char *dst, const char *src, size_t siz);
-+#endif
-+
-+#if !HAVE_STRNSTR
- char *strnstr(const char *str, const char *find, size_t str_len);
-+#endif
-+
-+#if !HAVE_STRMODE
- void strmode(mode_t mode, char *str);
-+#endif
- 
- #if !defined(__GLIBC__) || \
-     (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
-diff --git a/src/fpurge.c b/src/fpurge.c
-index 350f364..ff7f01e 100644
---- a/src/fpurge.c
-+++ b/src/fpurge.c
-@@ -26,9 +26,10 @@
- 
- #include <errno.h>
- #include <stdio.h>
--#include <stdio_ext.h>
- 
- #ifdef HAVE___FPURGE
-+#include <stdio_ext.h>
-+
- int
- fpurge(FILE *fp)
- {
-@@ -41,6 +42,36 @@ fpurge(FILE *fp)
- 
- 	return 0;
- }
-+/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin 1.7 */
-+#elif HAVE_FPURGE
-+int
-+fpurge(FILE *fp)
-+{
-+	if (fp == NULL || fileno(fp) < 0) {
-+		errno = EBADF;
-+		return EOF;
-+	}
-+
-+  /* Call the system's fpurge function.  */
-+#undef fpurge
-+#if !HAVE_DECL_FPURGE
-+  extern int fpurge (FILE *);
-+#endif
-+  int result = fpurge (fp);
-+/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
-+#if defined(__sferror) || defined(__DragonFly__)
-+  if (result == 0)
-+    /* Correct the invariants that fpurge broke.
-+       <stdio.h> on BSD systems says:
-+         "The following always hold: if _flags & __SRD, _w is 0."
-+       If this invariant is not fulfilled and the stream is read-write but
-+       currently reading, subsequent putc or fputc calls will write directly
-+       into the buffer, although they shouldn't be allowed to.  */
-+    if ((fp->_flags & __SRD) != 0)
-+      fp->_w = 0;
-+#endif
-+  return result;
-+}
- #else
- #error "Function fpurge() needs to be ported."
- #endif
-diff --git a/src/funopen.c b/src/funopen.c
-index 1e6f43a..3a3af6a 100644
---- a/src/funopen.c
-+++ b/src/funopen.c
-@@ -143,6 +143,7 @@ funopen(const void *cookie,
-  * they will not add the needed support to implement it. Just ignore this
-  * interface there, as it has never been provided anyway.
-  */
-+#elif defined(__MACH__)
- #else
- #error "Function funopen() needs to be ported or disabled."
- #endif
-diff --git a/src/local-link.h b/src/local-link.h
-index 6782d9a..fb76098 100644
---- a/src/local-link.h
-+++ b/src/local-link.h
-@@ -29,6 +29,12 @@
- 
- #include <sys/cdefs.h>
- 
-+#ifdef __MACH__
-+#define libbsd_link_warning(symbol, msg)
-+#define libbsd_symver_default(alias, symbol, version)
-+#define libbsd_symver_variant(alias, symbol, version)
-+#define libbsd_symver_weak(alias, symbol, version)
-+#else
- #define libbsd_link_warning(symbol, msg) \
- 	static const char libbsd_emit_link_warning_##symbol[] \
- 		__attribute__((__used__,__section__(".gnu.warning." #symbol))) = msg
-@@ -68,3 +74,4 @@
- #endif
- 
- #endif
-+#endif
-diff --git a/src/nlist.c b/src/nlist.c
-index 1cb9d18..b476f1e 100644
---- a/src/nlist.c
-+++ b/src/nlist.c
-@@ -41,6 +41,7 @@
- #include <unistd.h>
- #include <nlist.h>
- 
-+#if !HAVE_NLIST_H
- #include "local-elf.h"
- 
- /* Note: This function is used by libkvm0, so we need to export it.
-@@ -277,3 +278,4 @@ nlist(const char *name, struct nlist *list)
- 	(void)close(fd);
- 	return (n);
- }
-+#endif
-diff --git a/src/pwcache.c b/src/pwcache.c
-index d54daa0..74fde9f 100644
---- a/src/pwcache.c
-+++ b/src/pwcache.c
-@@ -191,6 +191,7 @@ grptb_start(void)
- 	return 0;
- }
- 
-+#if !HAVE_USER_FROM_UID
- /*
-  * user_from_uid()
-  *	caches the name (if any) for the uid. If noname clear, we always
-@@ -251,7 +252,9 @@ user_from_uid(uid_t uid, int noname)
- 	}
- 	return ptr->name;
- }
-+#endif
- 
-+#if !HAVE_USER_FROM_UID
- /*
-  * group_from_gid()
-  *	caches the name (if any) for the gid. If noname clear, we always
-@@ -312,6 +315,7 @@ group_from_gid(gid_t gid, int noname)
- 	}
- 	return ptr->name;
- }
-+#endif
- 
- /*
-  * uid_from_user()
-diff --git a/src/readpassphrase.c b/src/readpassphrase.c
-index f9f6195..2bc5fb4 100644
---- a/src/readpassphrase.c
-+++ b/src/readpassphrase.c
-@@ -36,6 +36,14 @@
- #define TCSASOFT 0
- #endif
- 
-+#ifndef _SIGMAX
-+#define	_SIGMAX	64
-+#endif
-+
-+#ifndef _NSIG
-+#define _NSIG (_SIGMAX + 1)
-+#endif
-+
- static volatile sig_atomic_t signo[_NSIG];
- 
- static void handler(int);
-diff --git a/src/setproctitle.c b/src/setproctitle.c
-index d3e1087..0e5f64c 100644
---- a/src/setproctitle.c
-+++ b/src/setproctitle.c
-@@ -33,6 +33,10 @@
- #include <string.h>
- #include "local-link.h"
- 
-+#ifdef __MACH__
-+extern char **environ;
-+#endif
-+
- static struct {
- 	/* Original value. */
- 	const char *arg0;
-@@ -291,7 +295,8 @@ libbsd_symver_default(setproctitle, setproctitle_impl, LIBBSD_0.5);
-  * in 0.5, make the implementation available in the old version as an alias
-  * for code linking against that version, and change the default to use the
-  * new version, so that new code depends on the implemented version. */
--#ifdef HAVE_TYPEOF
-+#ifdef __MACH__
-+#elif defined(HAVE_TYPEOF)
- extern __typeof__(setproctitle_impl)
- setproctitle_stub
- 	__attribute__((__alias__("setproctitle_impl")));
-diff --git a/src/strlcat.c b/src/strlcat.c
-index 14c53a1..5961c17 100644
---- a/src/strlcat.c
-+++ b/src/strlcat.c
-@@ -26,6 +26,7 @@
-  * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
-  * If retval >= dsize, truncation occurred.
-  */
-+#if !HAVE_STRLCAT
- size_t
- strlcat(char *dst, const char *src, size_t dsize)
- {
-@@ -53,3 +54,4 @@ strlcat(char *dst, const char *src, size_t dsize)
- 
- 	return(dlen + (src - osrc));	/* count does not include NUL */
- }
-+#endif
-diff --git a/src/strlcpy.c b/src/strlcpy.c
-index e9a7fe4..5137acb 100644
---- a/src/strlcpy.c
-+++ b/src/strlcpy.c
-@@ -24,6 +24,7 @@
-  * chars will be copied.  Always NUL terminates (unless dsize == 0).
-  * Returns strlen(src); if retval >= dsize, truncation occurred.
-  */
-+#if !HAVE_STRLCPY
- size_t
- strlcpy(char *dst, const char *src, size_t dsize)
- {
-@@ -48,3 +49,4 @@ strlcpy(char *dst, const char *src, size_t dsize)
- 
- 	return(src - osrc - 1);	/* count does not include NUL */
- }
-+#endif
-diff --git a/src/strmode.c b/src/strmode.c
-index e6afde5..da680c9 100644
---- a/src/strmode.c
-+++ b/src/strmode.c
-@@ -32,6 +32,7 @@
- #include <sys/stat.h>
- #include <string.h>
- 
-+#if !HAVE_STRMODE
- void
- strmode(mode_t mode, char *p)
- {
-@@ -141,3 +142,4 @@ strmode(mode_t mode, char *p)
- 	*p++ = ' ';		/* will be a '+' if ACL's implemented */
- 	*p = '\0';
- }
-+#endif
diff --git a/pkgs/development/libraries/libbsd/default.nix b/pkgs/development/libraries/libbsd/default.nix
index 0c8040010e722..5943d697f6f1b 100644
--- a/pkgs/development/libraries/libbsd/default.nix
+++ b/pkgs/development/libraries/libbsd/default.nix
@@ -1,28 +1,53 @@
 { lib
 , stdenv
-, fetchurl
+, fetchFromGitLab
+, fetchpatch
 , autoreconfHook
 , libmd
 , gitUpdater
 }:
 
-stdenv.mkDerivation rec {
+# Run `./get-version` for the new value when bumping the Git revision.
+let gitVersion = "0.11.7-55-g73b2"; in
+
+stdenv.mkDerivation {
   pname = "libbsd";
-  version = "0.11.7";
+  version = "unstable-2023-04-29";
 
-  src = fetchurl {
-    url = "https://libbsd.freedesktop.org/releases/${pname}-${version}.tar.xz";
-    hash = "sha256-m6oYYFnrvyXAYwjp+ZH9ox9xg8DySTGCbYOqar2KAmE=";
+  src = fetchFromGitLab {
+    domain = "gitlab.freedesktop.org";
+    owner = "libbsd";
+    repo = "libbsd";
+    rev = "73b25a8f871b3a20f6ff76679358540f95d7dbfd";
+    hash = "sha256-LS28taIMjRCl6xqg75eYOIrTDl8PzSa+OvrdiEOP1+U=";
   };
 
   outputs = [ "out" "dev" "man" ];
 
-  # darwin changes configure.ac which means we need to regenerate
-  # the configure scripts
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
   nativeBuildInputs = [ autoreconfHook ];
   propagatedBuildInputs = [ libmd ];
 
-  patches = [ ./darwin.patch ];
+  patches = [
+    # Fix `{get,set}progname(3bsd)` conditionalization
+    # https://gitlab.freedesktop.org/libbsd/libbsd/-/issues/24
+    (fetchpatch {
+      url = "https://github.com/emilazy/libbsd/commit/0381f8d92873c5a19ced3ff861ee8ffe7825953e.patch";
+      hash = "sha256-+RMg5eHLgC4gyX9zXM0ttNf7rd9E3UzJX/7UVCYGXx4=";
+    })
+  ] ++ lib.optionals stdenv.isDarwin [
+    # Temporary build system hack from upstream maintainer
+    # https://gitlab.freedesktop.org/libbsd/libbsd/-/issues/19#note_2017684
+    ./darwin-fix-libbsd.sym.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace configure.ac \
+      --replace 'm4_esyscmd([./get-version])' '[${gitVersion}]'
+  '';
 
   passthru.updateScript = gitUpdater {
     # No nicer place to find latest release.
@@ -33,7 +58,7 @@ stdenv.mkDerivation rec {
     description = "Common functions found on BSD systems";
     homepage = "https://libbsd.freedesktop.org/";
     license = with licenses; [ beerware bsd2 bsd3 bsdOriginal isc mit ];
-    platforms = platforms.linux ++ platforms.darwin;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ matthewbauer ];
   };
 }
diff --git a/pkgs/development/libraries/libmd/default.nix b/pkgs/development/libraries/libmd/default.nix
index ad3d8f0cce406..bf156fb1c55dd 100644
--- a/pkgs/development/libraries/libmd/default.nix
+++ b/pkgs/development/libraries/libmd/default.nix
@@ -1,35 +1,30 @@
 { lib, stdenv, fetchurl, fetchpatch, autoreconfHook }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "libmd";
-  version = "1.0.4";
+  version = "1.1.0";
 
   src = fetchurl {
     urls = [
-      "https://archive.hadrons.org/software/libmd/libmd-${version}.tar.xz"
-      "https://libbsd.freedesktop.org/releases/libmd-${version}.tar.xz"
+      "https://archive.hadrons.org/software/libmd/libmd-${finalAttrs.version}.tar.xz"
+      "https://libbsd.freedesktop.org/releases/libmd-${finalAttrs.version}.tar.xz"
     ];
-    sha256 = "sha256-9RySEELjS+3e3tS3VVdlZVnPWx8kSAM7TB7sEcB+Uw8=";
+    sha256 = "sha256-G9aqQidTE68xQcfPLluWTosf1IgCXK8vlx9DsAd2szI=";
   };
 
-  patches = [
-    # Drop aliases for SHA384 functions, because such aliases are not supported on Darwin.
-    (fetchpatch {
-      url = "https://github.com/macports/macports-ports/raw/8332f5dbcaf05a02bc31fbd4ccf735e7d5c9a5b0/devel/libmd/files/patch-symbol-alias.diff";
-      sha256 = "sha256-py5hMpKYKwtBzhWn01lFc2a6+OZN72YCYXyhg1qe6rg=";
-      extraPrefix = "";
-    })
-  ];
+  enableParallelBuilding = true;
+
+  doCheck = true;
 
   nativeBuildInputs = [ autoreconfHook ];
 
   meta = with lib; {
-    homepage = "https://www.hadrons.org/software/${pname}/";
-    changelog = "https://archive.hadrons.org/software/libmd/libmd-${version}.announce";
+    homepage = "https://www.hadrons.org/software/libmd/";
+    changelog = "https://archive.hadrons.org/software/libmd/libmd-${finalAttrs.version}.announce";
     # Git: https://git.hadrons.org/cgit/libmd.git
     description = "Message Digest functions from BSD systems";
     license = with licenses; [ bsd3 bsd2 isc beerware publicDomain ];
     maintainers = with maintainers; [ primeos ];
     platforms = platforms.unix;
   };
-}
+})
diff --git a/pkgs/tools/X11/inputplug/default.nix b/pkgs/tools/X11/inputplug/default.nix
index 031b73994b62d..e6bf334cf4c0a 100644
--- a/pkgs/tools/X11/inputplug/default.nix
+++ b/pkgs/tools/X11/inputplug/default.nix
@@ -4,6 +4,7 @@
 , libbsd
 , pkg-config
 , rustPlatform
+, stdenv
 }:
 
 rustPlatform.buildRustPackage rec {
@@ -29,6 +30,9 @@ rustPlatform.buildRustPackage rec {
     description = "Monitor XInput events and run arbitrary scripts on hierarchy change events";
     homepage = "https://github.com/andrewshadura/inputplug";
     license = licenses.mit;
+    platforms = platforms.unix;
+    # `daemon(3)` is deprecated on macOS and `pidfile-rs` needs updating
+    broken = stdenv.isDarwin;
     maintainers = with maintainers; [ jecaro ];
   };
 }