python3Packages.openusd: 24.08 -> 24.11 (#376119)
[NixPkgs.git] / pkgs / development / libraries / wlroots / default.nix
bloba219181feaed4b010908e1c3fb6516d59b3a6a41
2   lib,
3   stdenv,
4   fetchFromGitLab,
5   meson,
6   ninja,
7   pkg-config,
8   wayland-scanner,
9   libGL,
10   wayland,
11   wayland-protocols,
12   libinput,
13   libxkbcommon,
14   pixman,
15   libcap,
16   libgbm,
17   xorg,
18   libpng,
19   ffmpeg,
20   hwdata,
21   seatd,
22   vulkan-loader,
23   glslang,
24   libliftoff,
25   libdisplay-info,
26   lcms2,
27   nixosTests,
28   testers,
30   enableXWayland ? true,
31   xwayland ? null,
34 let
35   generic =
36     {
37       version,
38       hash,
39       extraBuildInputs ? [ ],
40       extraNativeBuildInputs ? [ ],
41       patches ? [ ],
42       postPatch ? "",
43     }:
44     stdenv.mkDerivation (finalAttrs: {
45       pname = "wlroots";
46       inherit version;
48       inherit enableXWayland;
50       src = fetchFromGitLab {
51         domain = "gitlab.freedesktop.org";
52         owner = "wlroots";
53         repo = "wlroots";
54         rev = finalAttrs.version;
55         inherit hash;
56       };
58       inherit patches postPatch;
60       # $out for the library and $examples for the example programs (in examples):
61       outputs = [
62         "out"
63         "examples"
64       ];
66       strictDeps = true;
67       depsBuildBuild = [ pkg-config ];
69       nativeBuildInputs = [
70         meson
71         ninja
72         pkg-config
73         wayland-scanner
74         glslang
75       ] ++ extraNativeBuildInputs;
77       buildInputs =
78         [
79           libGL
80           libcap
81           libinput
82           libpng
83           libxkbcommon
84           libgbm
85           pixman
86           seatd
87           vulkan-loader
88           wayland
89           wayland-protocols
90           xorg.libX11
91           xorg.xcbutilerrors
92           xorg.xcbutilimage
93           xorg.xcbutilrenderutil
94           xorg.xcbutilwm
95         ]
96         ++ lib.optional finalAttrs.enableXWayland xwayland
97         ++ extraBuildInputs;
99       mesonFlags = lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled";
101       postFixup = ''
102         # Install ALL example programs to $examples:
103         # screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
104         # screenshot output-layout multi-pointer rotation tablet touch pointer
105         # simple
106         mkdir -p $examples/bin
107         cd ./examples
108         for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
109           cp "$binary" "$examples/bin/wlroots-$binary"
110         done
111       '';
113       # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots):
114       passthru.tests = {
115         tinywl = nixosTests.tinywl;
116         pkg-config = testers.hasPkgConfigModules {
117           package = finalAttrs.finalPackage;
118         };
119       };
121       meta = {
122         description = "Modular Wayland compositor library";
123         longDescription = ''
124           Pluggable, composable, unopinionated modules for building a Wayland
125           compositor; or about 50,000 lines of code you were going to write anyway.
126         '';
127         inherit (finalAttrs.src.meta) homepage;
128         changelog = "https://gitlab.freedesktop.org/wlroots/wlroots/-/tags/${version}";
129         license = lib.licenses.mit;
130         platforms = lib.platforms.linux;
131         maintainers = with lib.maintainers; [
132           primeos
133           synthetica
134           rewine
135         ];
136         pkgConfigModules = [
137           (
138             if lib.versionOlder finalAttrs.version "0.18" then
139               "wlroots"
140             else
141               "wlroots-${lib.versions.majorMinor finalAttrs.version}"
142           )
143         ];
144       };
145     });
148 rec {
149   wlroots_0_17 = generic {
150     version = "0.17.4";
151     hash = "sha256-AzmXf+HMX/6VAr0LpfHwfmDB9dRrrLQHt7l35K98MVo=";
152     extraNativeBuildInputs = [
153       hwdata
154     ];
155     extraBuildInputs = [
156       ffmpeg
157       libliftoff
158       libdisplay-info
159     ];
160   };
162   wlroots_0_18 = generic {
163     version = "0.18.2";
164     hash = "sha256-vKvMWRPPJ4PRKWVjmKKCdNSiqsQm+uQBoBnBUFElLNA=";
165     extraNativeBuildInputs = [
166       hwdata
167     ];
168     extraBuildInputs = [
169       ffmpeg
170       libliftoff
171       libdisplay-info
172       lcms2
173     ];
174   };
176   wlroots = wlroots_0_18;