biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / servers / mir / default.nix
blobe4555bf517f69b6860ea5b1024be52942cb75deb
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , fetchpatch
5 , gitUpdater
6 , testers
7 , cmake
8 , pkg-config
9 , python3
10 , boost
11 , egl-wayland
12 , freetype
13 , glib
14 , glm
15 , glog
16 , libdrm
17 , libepoxy
18 , libevdev
19 , libglvnd
20 , libinput
21 , libuuid
22 , libxcb
23 , libxkbcommon
24 , libxmlxx
25 , yaml-cpp
26 , lttng-ust
27 , mesa
28 , nettle
29 , udev
30 , wayland
31 , xorg
32 , xwayland
33 , dbus
34 , gtest
35 , umockdev
36 , wlcs
37 , validatePkgConfig
40 stdenv.mkDerivation (finalAttrs: {
41   pname = "mir";
42   version = "2.15.0";
44   src = fetchFromGitHub {
45     owner = "MirServer";
46     repo = "mir";
47     rev = "v${finalAttrs.version}";
48     hash = "sha256-c1+gxzLEtNCjR/mx76O5QElQ8+AO4WsfcG7Wy1+nC6E=";
49   };
51   patches = [
52     # Fix gbm-kms tests
53     # Remove when version > 2.15.0
54     (fetchpatch {
55       name = "0001-mir-Fix-the-signature-of-drmModeCrtcSetGamma.patch";
56       url = "https://github.com/MirServer/mir/commit/98250e9c32c5b9b940da2fb0a32d8139bbc68157.patch";
57       hash = "sha256-tTtOHGNue5rsppOIQSfkOH5sVfFSn/KPGHmubNlRtLI=";
58     })
59   ];
61   postPatch = ''
62     # Fix scripts that get run in tests
63     patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in
65     # Fix LD_PRELOADing in tests
66     for needsPreloadFixing in \
67       cmake/MirCommon.cmake \
68       tests/umock-acceptance-tests/CMakeLists.txt \
69       tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \
70       tests/unit-tests/CMakeLists.txt
71     do
72       substituteInPlace $needsPreloadFixing \
73         --replace 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \
74         --replace 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0'
75     done
77     # Fix Xwayland default
78     substituteInPlace src/miral/x11_support.cpp \
79       --replace '/usr/bin/Xwayland' '${lib.getExe xwayland}'
81     # Fix paths for generating drm-formats
82     substituteInPlace src/platform/graphics/CMakeLists.txt \
83       --replace "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \
84       --replace "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h"
85   '';
87   strictDeps = true;
89   nativeBuildInputs = [
90     cmake
91     glib # gdbus-codegen
92     lttng-ust # lttng-gen-tp
93     pkg-config
94     (python3.withPackages (ps: with ps; [
95       pillow
96     ] ++ lib.optionals finalAttrs.finalPackage.doCheck [
97       pygobject3
98       python-dbusmock
99     ]))
100     validatePkgConfig
101   ];
103   buildInputs = [
104     boost
105     egl-wayland
106     freetype
107     glib
108     glm
109     glog
110     libdrm
111     libepoxy
112     libevdev
113     libglvnd
114     libinput
115     libuuid
116     libxcb
117     libxkbcommon
118     libxmlxx
119     yaml-cpp
120     lttng-ust
121     mesa
122     nettle
123     udev
124     wayland
125     xorg.libX11
126     xorg.libXcursor
127     xorg.xorgproto
128     xwayland
129   ];
131   nativeCheckInputs = [
132     dbus
133   ];
135   checkInputs = [
136     gtest
137     umockdev
138     wlcs
139   ];
141   cmakeFlags = [
142     "-DBUILD_DOXYGEN=OFF"
143     "-DMIR_PLATFORM='gbm-kms;x11;eglstream-kms;wayland'"
144     "-DMIR_ENABLE_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
145     # BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such
146     # https://github.com/MirServer/mir/pull/1947#issuecomment-811810872
147     "-DMIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN=ON"
148     "-DMIR_EXCLUDE_TESTS=${lib.strings.concatStringsSep ";" [
149     ]}"
150     # These get built but don't get executed by default, yet they get installed when tests are enabled
151     "-DMIR_BUILD_PERFORMANCE_TESTS=OFF"
152     "-DMIR_BUILD_PLATFORM_TEST_HARNESS=OFF"
153     # https://github.com/MirServer/mir/issues/2987
154     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799
155     "-DMIR_USE_PRECOMPILED_HEADERS=OFF"
156   ];
158   doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
160   preCheck = ''
161     # Needs to be exactly /tmp so some failing tests don't get run, don't know why they fail yet
162     # https://github.com/MirServer/mir/issues/2801
163     export XDG_RUNTIME_DIR=/tmp
164   '';
166   outputs = [ "out" "dev" ];
168   passthru = {
169     tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
170     updateScript = gitUpdater {
171       rev-prefix = "v";
172     };
173     # More of an example than a fully functioning shell, some notes for the adventurous:
174     # - ~/.config/miral-shell.config is one possible user config location,
175     #   accepted options=value are according to `mir-shell --help`
176     # - default icon theme setting is DMZ-White, needs vanilla-dmz installed & on XCURSOR_PATH
177     #   or setting to be changed to an available theme
178     # - terminal emulator setting may need to be changed if miral-terminal script
179     #   does not know about preferred terminal
180     providedSessions = [ "mir-shell" ];
181   };
183   meta = with lib; {
184     description = "A display server and Wayland compositor developed by Canonical";
185     homepage = "https://mir-server.io";
186     changelog = "https://github.com/MirServer/mir/releases/tag/v${finalAttrs.version}";
187     license = licenses.gpl2Plus;
188     maintainers = with maintainers; [ onny OPNA2608 ];
189     platforms = platforms.linux;
190     pkgConfigModules = [
191       "miral"
192       "mircommon"
193       "mircookie"
194       "mircore"
195       "miroil"
196       "mirplatform"
197       "mir-renderer-gl-dev"
198       "mirrenderer"
199       "mirserver"
200       "mirtest"
201       "mirwayland"
202     ];
203   };