summary refs log tree commit diff
path: root/pkgs/development/libraries/libbsd/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/libbsd/default.nix')
-rw-r--r--pkgs/development/libraries/libbsd/default.nix45
1 files changed, 35 insertions, 10 deletions
diff --git a/pkgs/development/libraries/libbsd/default.nix b/pkgs/development/libraries/libbsd/default.nix
index 0c8040010e7..5943d697f6f 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 ];
   };
 }