about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/waylandpp/default.nix
blob: 7eeeb2467eddeac9d53bff0a9869ec3dacb15844 (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
65
66
{ lib, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, makeFontsConf
, pkg-config
, pugixml
, wayland
, libGL
, libffi
, buildPackages
, docSupport ? true
, doxygen
, graphviz
}:

stdenv.mkDerivation rec {
  pname = "waylandpp";
  version = "1.0.0";

  src = fetchFromGitHub {
    owner = "NilsBrause";
    repo = pname;
    rev = version;
    hash = "sha256-Dw2RnLLyhykikHps1in+euHksO+ERbATbfmbUFOJklg=";
  };

  patches = [
    # Pull fixes for gcc-13 compatibility:
    #   https://github.com/NilsBrause/waylandpp/pull/71
    # Without the change `kodi` fails to find `uint32_t` in `waylandpp`
    # headers.
    (fetchpatch {
      name = "gcc-13.patch";
      url = "https://github.com/NilsBrause/waylandpp/commit/3c441910aa25f57df2a4db55f75f5d99cea86620.patch";
      hash = "sha256-bxHMP09zCwUKD0M63C1FqQySAN9hr+7t/DyFDRwdtCo=";
    })
  ];

  cmakeFlags = [
    "-DCMAKE_INSTALL_DATADIR=${placeholder "dev"}"
  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
    "-DWAYLAND_SCANNERPP=${buildPackages.waylandpp}/bin/wayland-scanner++"
  ];

  # Complains about not being able to find the fontconfig config file otherwise
  FONTCONFIG_FILE = lib.optional docSupport (makeFontsConf { fontDirectories = [ ]; });

  nativeBuildInputs = [ cmake pkg-config ] ++ lib.optionals docSupport [ doxygen graphviz ];
  buildInputs = [ pugixml wayland libGL libffi ];

  outputs = [ "bin" "dev" "lib" "out" ] ++ lib.optionals docSupport [ "doc" "devman" ];

  # Resolves the warning "Fontconfig error: No writable cache directories"
  preBuild = ''
    export XDG_CACHE_HOME="$(mktemp -d)"
  '';

  meta = with lib; {
    description = "Wayland C++ binding";
    mainProgram = "wayland-scanner++";
    homepage = "https://github.com/NilsBrause/waylandpp/";
    license = with lib.licenses; [ bsd2 hpnd ];
    maintainers = with lib.maintainers; [ minijackson ];
  };
}