summaryrefslogtreecommitdiffstats
path: root/pkgs/development/libraries/waylandpp/default.nix
blob: d1ddfa6cbc073c7eafedc3c17dd672c1536ece6b (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  makeFontsConf,
  pkg-config,
  pugixml,
  wayland,
  libGL,
  libffi,
  buildPackages,
  docSupport ? true,
  doxygen,
  graphviz,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "waylandpp";
  version = "1.0.1";

  src = fetchFromGitHub {
    owner = "NilsBrause";
    repo = "waylandpp";
    tag = finalAttrs.version;
    hash = "sha256-vKYKUXq5lmjQcZ0rD+b2O7N1iCVnpkpKd8Z/RTI083g=";
  };

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

  # Complains about not being able to find the fontconfig config file otherwise
  env = lib.optionalAttrs docSupport {
    FONTCONFIG_FILE = 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 = {
    description = "Wayland C++ binding";
    mainProgram = "wayland-scanner++";
    homepage = "https://github.com/NilsBrause/waylandpp/";
    license = with lib.licenses; [
      bsd2
      hpnd
    ];
    maintainers = with lib.maintainers; [ minijackson ];
    platforms = lib.platforms.linux;
  };
})