Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 makeFontsConf,
8 pkg-config,
9 pugixml,
10 wayland,
11 libGL,
12 libffi,
13 buildPackages,
14 docSupport ? true,
15 doxygen,
16 graphviz,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "waylandpp";
21 version = "1.0.0";
22
23 src = fetchFromGitHub {
24 owner = "NilsBrause";
25 repo = pname;
26 rev = version;
27 hash = "sha256-Dw2RnLLyhykikHps1in+euHksO+ERbATbfmbUFOJklg=";
28 };
29
30 patches = [
31 # Pull fixes for gcc-13 compatibility:
32 # https://github.com/NilsBrause/waylandpp/pull/71
33 # Without the change `kodi` fails to find `uint32_t` in `waylandpp`
34 # headers.
35 (fetchpatch {
36 name = "gcc-13.patch";
37 url = "https://github.com/NilsBrause/waylandpp/commit/3c441910aa25f57df2a4db55f75f5d99cea86620.patch";
38 hash = "sha256-bxHMP09zCwUKD0M63C1FqQySAN9hr+7t/DyFDRwdtCo=";
39 })
40 ];
41
42 cmakeFlags = [
43 "-DCMAKE_INSTALL_DATADIR=${placeholder "dev"}"
44 ]
45 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
46 "-DWAYLAND_SCANNERPP=${buildPackages.waylandpp}/bin/wayland-scanner++"
47 ];
48
49 # Complains about not being able to find the fontconfig config file otherwise
50 FONTCONFIG_FILE = lib.optional docSupport (makeFontsConf {
51 fontDirectories = [ ];
52 });
53
54 nativeBuildInputs = [
55 cmake
56 pkg-config
57 ]
58 ++ lib.optionals docSupport [
59 doxygen
60 graphviz
61 ];
62 buildInputs = [
63 pugixml
64 wayland
65 libGL
66 libffi
67 ];
68
69 outputs = [
70 "bin"
71 "dev"
72 "lib"
73 "out"
74 ]
75 ++ lib.optionals docSupport [
76 "doc"
77 "devman"
78 ];
79
80 # Resolves the warning "Fontconfig error: No writable cache directories"
81 preBuild = ''
82 export XDG_CACHE_HOME="$(mktemp -d)"
83 '';
84
85 meta = with lib; {
86 description = "Wayland C++ binding";
87 mainProgram = "wayland-scanner++";
88 homepage = "https://github.com/NilsBrause/waylandpp/";
89 license = with lib.licenses; [
90 bsd2
91 hpnd
92 ];
93 maintainers = with lib.maintainers; [ minijackson ];
94 };
95}