mir_2_15: init at 2.15.0

This commit is contained in:
OPNA2608 2024-06-09 14:47:21 +02:00
parent 5a6c959fa8
commit 245aee34d9
6 changed files with 269 additions and 204 deletions

View File

@ -40,7 +40,7 @@
, lomiri-notifications
, lomiri-thumbnailer
, maliit-keyboard
, mir
, mir_2_15
, nixos-icons
, pam
, pkg-config
@ -191,7 +191,7 @@ stdenv.mkDerivation (finalAttrs: {
lomiri-system-settings-unwrapped
lomiri-ui-toolkit
maliit-keyboard
mir
mir_2_15
pam
properties-cpp
protobuf

View File

@ -16,7 +16,7 @@
, lomiri-app-launch
, lomiri-url-dispatcher
, lttng-ust
, mir
, mir_2_15
, process-cpp
, qtbase
, qtdeclarative
@ -109,7 +109,7 @@ stdenv.mkDerivation (finalAttrs: {
lomiri-app-launch
lomiri-url-dispatcher
lttng-ust
mir
mir_2_15
process-cpp
protobuf
qtbase

227
pkgs/servers/mir/common.nix Normal file
View File

@ -0,0 +1,227 @@
{
stdenv,
lib,
fetchFromGitHub,
testers,
cmake,
pkg-config,
python3,
boost,
egl-wayland,
freetype,
glib,
glm,
glog,
libdrm,
libepoxy,
libevdev,
libglvnd,
libinput,
libuuid,
libxcb,
libxkbcommon,
libxmlxx,
yaml-cpp,
lttng-ust,
mesa,
nettle,
udev,
wayland,
wayland-scanner,
xorg,
xwayland,
dbus,
gobject-introspection,
gtest,
umockdev,
wlcs,
validatePkgConfig,
}:
{
version,
pinned ? false,
hash,
patches ? [ ],
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mir";
inherit version;
src = fetchFromGitHub {
owner = "canonical";
repo = "mir";
rev = "v${finalAttrs.version}";
inherit hash;
};
inherit patches;
postPatch = ''
# Fix scripts that get run in tests
patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in
# Fix LD_PRELOADing in tests
substituteInPlace \
cmake/MirCommon.cmake \
tests/umock-acceptance-tests/CMakeLists.txt \
tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \
tests/unit-tests/CMakeLists.txt \
--replace-warn 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \
--replace-warn 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0'
# Fix Xwayland default
substituteInPlace src/miral/x11_support.cpp \
--replace-fail '/usr/bin/Xwayland' '${lib.getExe xwayland}'
# Fix paths for generating drm-formats
substituteInPlace src/platform/graphics/CMakeLists.txt \
--replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \
--replace-fail "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h"
'';
strictDeps = true;
nativeBuildInputs = [
cmake
glib # gdbus-codegen
lttng-ust # lttng-gen-tp
pkg-config
(python3.withPackages (
ps:
with ps;
[ pillow ]
++ lib.optionals finalAttrs.finalPackage.doCheck [
pygobject3
python-dbusmock
]
))
validatePkgConfig
wayland-scanner
];
buildInputs = [
boost
egl-wayland
freetype
glib
glm
glog
libdrm
libepoxy
libevdev
libglvnd
libinput
libuuid
libxcb
libxkbcommon
libxmlxx
yaml-cpp
lttng-ust
mesa
nettle
udev
wayland
xorg.libX11
xorg.libXcursor
xorg.xorgproto
xwayland
];
nativeCheckInputs = [
dbus
gobject-introspection
];
checkInputs = [
gtest
umockdev
wlcs
];
cmakeFlags = [
(lib.cmakeBool "BUILD_DOXYGEN" false)
(lib.cmakeFeature "MIR_PLATFORM" (
lib.strings.concatStringsSep ";" [
"gbm-kms"
"x11"
"eglstream-kms"
"wayland"
]
))
(lib.cmakeBool "MIR_ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
# BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such
# https://github.com/canonical/mir/pull/1947#issuecomment-811810872
(lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true)
(lib.cmakeFeature "MIR_EXCLUDE_TESTS" (lib.strings.concatStringsSep ";" [ ]))
# These get built but don't get executed by default, yet they get installed when tests are enabled
(lib.cmakeBool "MIR_BUILD_PERFORMANCE_TESTS" false)
(lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false)
# https://github.com/canonical/mir/issues/2987
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799
(lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false)
(lib.cmakeFeature "MIR_COMPILER_QUIRKS" (
lib.strings.concatStringsSep ";" [
# https://github.com/canonical/mir/issues/3017 actually affects x86_64 as well
"test_touchspot_controller.cpp:array-bounds"
]
))
];
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
preCheck = ''
export XDG_RUNTIME_DIR=$TMP
'';
outputs = [
"out"
"dev"
];
passthru = {
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
providedSessions = lib.optionals (lib.strings.versionOlder version "2.16.0") [
# More of an example than a fully functioning shell, some notes for the adventurous:
# - ~/.config/miral-shell.config is one possible user config location,
# accepted options=value are according to `mir-shell --help`
# - default icon theme setting is DMZ-White, needs vanilla-dmz installed & on XCURSOR_PATH
# or setting to be changed to an available theme
# - terminal emulator setting may need to be changed if miral-terminal script
# does not know about preferred terminal
"mir-shell"
];
} // lib.optionalAttrs (!pinned) {
updateScript = ./update.sh;
};
meta = with lib; {
description = "A display server and Wayland compositor developed by Canonical";
homepage = "https://mir-server.io";
changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}";
license = licenses.gpl2Plus;
maintainers = with maintainers; [
onny
OPNA2608
];
platforms = platforms.linux;
pkgConfigModules = [
"miral"
"mircommon"
"mircore"
"miroil"
"mirplatform"
"mir-renderer-gl-dev"
"mirrenderer"
"mirserver"
"mirtest"
"mirwayland"
] ++ lib.optionals (lib.strings.versionOlder version "2.17.0") [
"mircookie"
] ++ lib.optionals (lib.strings.versionAtLeast version "2.17.0") [
"mircommon-internal"
"mirserver-internal"
];
};
})

View File

@ -1,205 +1,33 @@
{ callPackage, fetchpatch }:
let
common = callPackage ./common.nix { };
in
{
stdenv,
lib,
fetchFromGitHub,
gitUpdater,
testers,
cmake,
pkg-config,
python3,
boost,
egl-wayland,
freetype,
glib,
glm,
glog,
libdrm,
libepoxy,
libevdev,
libglvnd,
libinput,
libuuid,
libxcb,
libxkbcommon,
libxmlxx,
yaml-cpp,
lttng-ust,
mesa,
nettle,
udev,
wayland,
wayland-scanner,
xorg,
xwayland,
dbus,
gobject-introspection,
gtest,
umockdev,
wlcs,
validatePkgConfig,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mir";
version = "2.17.0";
src = fetchFromGitHub {
owner = "canonical";
repo = "mir";
rev = "v${finalAttrs.version}";
mir = common {
version = "2.17.0";
hash = "sha256-iDJ7NIFoSSXjMrHK2I6Linf7z0hvShj8fr6BGxgK5gE=";
};
postPatch = ''
# Fix scripts that get run in tests
patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in
# Fix LD_PRELOADing in tests
substituteInPlace \
cmake/MirCommon.cmake \
tests/umock-acceptance-tests/CMakeLists.txt \
tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \
tests/unit-tests/CMakeLists.txt \
--replace-warn 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \
--replace-warn 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0'
# Fix Xwayland default
substituteInPlace src/miral/x11_support.cpp \
--replace-fail '/usr/bin/Xwayland' '${lib.getExe xwayland}'
# Fix paths for generating drm-formats
substituteInPlace src/platform/graphics/CMakeLists.txt \
--replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \
--replace-fail "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h"
'';
strictDeps = true;
nativeBuildInputs = [
cmake
glib # gdbus-codegen
lttng-ust # lttng-gen-tp
pkg-config
(python3.withPackages (
ps:
with ps;
[ pillow ]
++ lib.optionals finalAttrs.finalPackage.doCheck [
pygobject3
python-dbusmock
]
))
validatePkgConfig
wayland-scanner
];
buildInputs = [
boost
egl-wayland
freetype
glib
glm
glog
libdrm
libepoxy
libevdev
libglvnd
libinput
libuuid
libxcb
libxkbcommon
libxmlxx
yaml-cpp
lttng-ust
mesa
nettle
udev
wayland
xorg.libX11
xorg.libXcursor
xorg.xorgproto
xwayland
];
nativeCheckInputs = [
dbus
gobject-introspection
];
checkInputs = [
gtest
umockdev
wlcs
];
cmakeFlags = [
(lib.cmakeBool "BUILD_DOXYGEN" false)
(lib.cmakeFeature "MIR_PLATFORM" (
lib.strings.concatStringsSep ";" [
"gbm-kms"
"x11"
"eglstream-kms"
"wayland"
]
))
(lib.cmakeBool "MIR_ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
# BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such
# https://github.com/canonical/mir/pull/1947#issuecomment-811810872
(lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true)
(lib.cmakeFeature "MIR_EXCLUDE_TESTS" (lib.strings.concatStringsSep ";" [ ]))
# These get built but don't get executed by default, yet they get installed when tests are enabled
(lib.cmakeBool "MIR_BUILD_PERFORMANCE_TESTS" false)
(lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false)
# https://github.com/canonical/mir/issues/2987
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799
(lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false)
(lib.cmakeFeature "MIR_COMPILER_QUIRKS" (
lib.strings.concatStringsSep ";" [
# https://github.com/canonical/mir/issues/3017 actually affects x86_64 as well
"test_touchspot_controller.cpp:array-bounds"
]
))
];
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
preCheck = ''
export XDG_RUNTIME_DIR=$TMP
'';
outputs = [
"out"
"dev"
];
passthru = {
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
updateScript = gitUpdater { rev-prefix = "v"; };
};
meta = with lib; {
description = "A display server and Wayland compositor developed by Canonical";
homepage = "https://mir-server.io";
changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}";
license = licenses.gpl2Plus;
maintainers = with maintainers; [
onny
OPNA2608
];
platforms = platforms.linux;
pkgConfigModules = [
"miral"
"mircommon"
"mircommon-internal"
"mircore"
"miroil"
"mirplatform"
"mir-renderer-gl-dev"
"mirrenderer"
"mirserver"
"mirserver-internal"
"mirtest"
"mirwayland"
mir_2_15 = common {
version = "2.15.0";
pinned = true;
hash = "sha256-c1+gxzLEtNCjR/mx76O5QElQ8+AO4WsfcG7Wy1+nC6E=";
patches = [
# Fix gbm-kms tests
# Remove when version > 2.15.0
(fetchpatch {
name = "0001-mir-Fix-the-signature-of-drmModeCrtcSetGamma.patch";
url = "https://github.com/canonical/mir/commit/98250e9c32c5b9b940da2fb0a32d8139bbc68157.patch";
hash = "sha256-tTtOHGNue5rsppOIQSfkOH5sVfFSn/KPGHmubNlRtLI=";
})
# Fix external_client tests
# Remove when version > 2.15.0
(fetchpatch {
name = "0002-mir-Fix-cannot_start_X_Server_and_outdated_tests.patch";
url = "https://github.com/canonical/mir/commit/0704026bd06372ea8286a46d8c939286dd8a8c68.patch";
hash = "sha256-k+51piPQandbHdm+ioqpBrb+C7Aqi2kugchAehZ1aiU=";
})
];
};
})
}

8
pkgs/servers/mir/update.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused jq common-updater-scripts
set -eou pipefail
version="$(curl --silent "https://api.github.com/repos/canonical/mir/releases" | jq '.[0].tag_name' --raw-output)"
update-source-version mir "${version:1}" --file=./pkgs/servers/mir/default.nix

View File

@ -26175,7 +26175,9 @@ with pkgs;
buildGoModule = buildGo122Module;
};
mir = callPackage ../servers/mir { };
inherit (callPackage ../servers/mir { })
mir
mir_2_15;
miriway = callPackage ../applications/window-managers/miriway { };