@@ -1,18 +1,33 @@
1−{ stdenv, fetchurl }:
1+{ stdenv, fetchFromGitHub, autoreconfHook }:
22
33stdenv.mkDerivation rec {
44 name = "libbsd-${version}";
55 version = "0.8.3";
66
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";
1025 };
1126
1227 meta = with stdenv.lib; {
1328 description = "Common functions found on BSD systems";
1429 homepage = http://libbsd.freedesktop.org/;
1530 license = licenses.bsd3;
16− platforms = platforms.linux;
31+ platforms = platforms.linux ++ platforms.darwin;
1732 };
1833}