about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libbsd/default.nix
blob: 5943d697f6f1ba52e01e8748ef8efc1df69ca7bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ lib
, stdenv
, fetchFromGitLab
, fetchpatch
, autoreconfHook
, libmd
, gitUpdater
}:

# 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 = "unstable-2023-04-29";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "libbsd";
    repo = "libbsd";
    rev = "73b25a8f871b3a20f6ff76679358540f95d7dbfd";
    hash = "sha256-LS28taIMjRCl6xqg75eYOIrTDl8PzSa+OvrdiEOP1+U=";
  };

  outputs = [ "out" "dev" "man" ];

  enableParallelBuilding = true;

  doCheck = true;

  nativeBuildInputs = [ autoreconfHook ];
  propagatedBuildInputs = [ libmd ];

  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.
    url = "https://gitlab.freedesktop.org/libbsd/libbsd.git";
  };

  meta = with lib; {
    description = "Common functions found on BSD systems";
    homepage = "https://libbsd.freedesktop.org/";
    license = with licenses; [ beerware bsd2 bsd3 bsdOriginal isc mit ];
    platforms = platforms.unix;
    maintainers = with maintainers; [ matthewbauer ];
  };
}