summary refs log tree commit diff
path: root/pkgs/development/libraries/libbsd/default.nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2017-04-20 17:55:47 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2017-04-20 17:55:47 -0500
commit8316eb5a5f889bcc859ef4e684df62c368e7b4e2 (patch)
treee27db79b252aa70744f907fd47b6242cb065b20c /pkgs/development/libraries/libbsd/default.nix
parent1d84a914f56c297288be7d4edee428b74006aa64 (diff)
downloadnixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.tar
nixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.tar.gz
nixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.tar.bz2
nixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.tar.lz
nixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.tar.xz
nixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.tar.zst
nixpkgs-8316eb5a5f889bcc859ef4e684df62c368e7b4e2.zip
libbsd: fixup on darwin
This is my attempt to get libbsd workin on Darwin. It's kind of a mess
right now with patches. Most of it are ugly hacks but at least it builds!
Diffstat (limited to 'pkgs/development/libraries/libbsd/default.nix')
-rw-r--r--pkgs/development/libraries/libbsd/default.nix25
1 files changed, 20 insertions, 5 deletions
diff --git a/pkgs/development/libraries/libbsd/default.nix b/pkgs/development/libraries/libbsd/default.nix
index 44a1fd5b3e2..9cef18471ab 100644
--- a/pkgs/development/libraries/libbsd/default.nix
+++ b/pkgs/development/libraries/libbsd/default.nix
@@ -1,18 +1,33 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "libbsd-${version}";
   version = "0.8.3";
 
-  src = fetchurl {
-    url = "http://libbsd.freedesktop.org/releases/${name}.tar.xz";
-    sha256 = "1a1l7afchlvvj2zfi7ajcg26bbkh5i98y2v5h9j5p1px9m7n6jwk";
+  nativeBuildInputs = [ autoreconfHook ];
+
+  preAutoreconf = "mkdir m4";
+
+  patchPhase = ''
+    substituteInPlace configure.ac \
+      --replace "m4_esyscmd([./get-version])" "${version}"
+    sed -i '38i#undef strlcpy' include/bsd/string.h
+    sed -i '38i#undef strlcat' include/bsd/string.h
+    substituteInPlace src/setproctitle.c \
+     --replace 'extern typeof(setproctitle_impl) setproctitle_stub __attribute__((weak, alias("setproctitle_impl")));' ""
+  '';
+
+  src = fetchFromGitHub {
+    owner = "JackieXie168";
+    repo = "libbsd";
+    rev = "macosx-${version}";
+    sha256 = "1g5h6d7i297m0hs2l0dxvsx6p0z96959pzgp75drbb7mkrf32p2z";
   };
 
   meta = with stdenv.lib; {
     description = "Common functions found on BSD systems";
     homepage = http://libbsd.freedesktop.org/;
     license = licenses.bsd3;
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }