1{
2 lib,
3 stdenv,
4 fetchurl,
5 meson,
6 pkg-config,
7 ninja,
8 wayland-scanner,
9 withTests ? stdenv.hostPlatform.isLinux,
10 libffi,
11 epoll-shim,
12 withDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform,
13 graphviz-nox,
14 doxygen,
15 libxslt,
16 xmlto,
17 python3,
18 docbook_xsl,
19 docbook_xml_dtd_45,
20 docbook_xml_dtd_42,
21 testers,
22}:
23
24stdenv.mkDerivation (finalAttrs: {
25 pname = "wayland";
26 version = "1.24.0";
27
28 src = fetchurl {
29 url =
30 with finalAttrs;
31 "https://gitlab.freedesktop.org/wayland/wayland/-/releases/${version}/downloads/${pname}-${version}.tar.xz";
32 hash = "sha256-gokkh6Aa1nszTsqDtUMXp8hqA6ic+trP71IR8RpdBTY=";
33 };
34
35 patches = [
36 ./darwin.patch
37 ];
38
39 postPatch =
40 lib.optionalString withDocumentation ''
41 patchShebangs doc/doxygen/gen-doxygen.py
42 ''
43 + lib.optionalString stdenv.hostPlatform.isStatic ''
44 # delete line containing os-wrappers-test, disables
45 # the building of os-wrappers-test
46 sed -i '/os-wrappers-test/d' tests/meson.build
47 '';
48
49 outputs = [
50 "out"
51 "dev"
52 ]
53 ++ lib.optionals withDocumentation [
54 "doc"
55 "man"
56 ];
57 separateDebugInfo = true;
58
59 mesonFlags = [
60 (lib.mesonBool "documentation" withDocumentation)
61 (lib.mesonBool "tests" withTests)
62 (lib.mesonBool "scanner" false) # wayland-scanner is a separate derivation
63 ];
64
65 depsBuildBuild = [
66 pkg-config
67 ];
68
69 nativeBuildInputs = [
70 meson
71 pkg-config
72 ninja
73 wayland-scanner
74 ]
75 ++ lib.optionals withDocumentation [
76 (graphviz-nox.override { pango = null; }) # To avoid an infinite recursion
77 doxygen
78 libxslt
79 xmlto
80 python3
81 docbook_xml_dtd_45
82 docbook_xsl
83 ];
84
85 buildInputs = [
86 libffi
87 ]
88 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [
89 epoll-shim
90 ]
91 ++ lib.optionals withDocumentation [
92 docbook_xsl
93 docbook_xml_dtd_45
94 docbook_xml_dtd_42
95 ];
96
97 passthru = {
98 tests.pkg-config = testers.hasPkgConfigModules {
99 package = finalAttrs.finalPackage;
100 };
101 };
102
103 meta = with lib; {
104 description = "Core Wayland window system code and protocol";
105 longDescription = ''
106 Wayland is a project to define a protocol for a compositor to talk to its
107 clients as well as a library implementation of the protocol.
108 The wayland protocol is essentially only about input handling and buffer
109 management, but also handles drag and drop, selections, window management
110 and other interactions that must go through the compositor (but not
111 rendering).
112 '';
113 homepage = "https://wayland.freedesktop.org/";
114 license = licenses.mit; # Expat version
115 platforms = platforms.unix;
116 maintainers = with maintainers; [
117 codyopel
118 qyliss
119 ];
120 pkgConfigModules = [
121 "wayland-client"
122 "wayland-cursor"
123 "wayland-egl"
124 "wayland-egl-backend"
125 "wayland-server"
126 ];
127 };
128})