lol

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!

+20 -5
+20 -5
pkgs/development/libraries/libbsd/default.nix
··· 1 - { stdenv, fetchurl }: 1 + { stdenv, fetchFromGitHub, autoreconfHook }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 name = "libbsd-${version}"; 5 5 version = "0.8.3"; 6 6 7 - src = fetchurl { 8 - url = "http://libbsd.freedesktop.org/releases/${name}.tar.xz"; 9 - sha256 = "1a1l7afchlvvj2zfi7ajcg26bbkh5i98y2v5h9j5p1px9m7n6jwk"; 7 + nativeBuildInputs = [ autoreconfHook ]; 8 + 9 + preAutoreconf = "mkdir m4"; 10 + 11 + patchPhase = '' 12 + substituteInPlace configure.ac \ 13 + --replace "m4_esyscmd([./get-version])" "${version}" 14 + sed -i '38i#undef strlcpy' include/bsd/string.h 15 + sed -i '38i#undef strlcat' include/bsd/string.h 16 + substituteInPlace src/setproctitle.c \ 17 + --replace 'extern typeof(setproctitle_impl) setproctitle_stub __attribute__((weak, alias("setproctitle_impl")));' "" 18 + ''; 19 + 20 + src = fetchFromGitHub { 21 + owner = "JackieXie168"; 22 + repo = "libbsd"; 23 + rev = "macosx-${version}"; 24 + sha256 = "1g5h6d7i297m0hs2l0dxvsx6p0z96959pzgp75drbb7mkrf32p2z"; 10 25 }; 11 26 12 27 meta = with stdenv.lib; { 13 28 description = "Common functions found on BSD systems"; 14 29 homepage = http://libbsd.freedesktop.org/; 15 30 license = licenses.bsd3; 16 - platforms = platforms.linux; 31 + platforms = platforms.linux ++ platforms.darwin; 17 32 }; 18 33 }