mir: Format with nixfmt-rfc-style, modernise

substituteInPlace --replace is deprecated
This commit is contained in:
OPNA2608 2024-06-08 20:37:09 +02:00
parent 15175aae76
commit 5a6c959fa8

View File

@ -1,41 +1,42 @@
{ stdenv {
, lib stdenv,
, fetchFromGitHub lib,
, gitUpdater fetchFromGitHub,
, testers gitUpdater,
, cmake testers,
, pkg-config cmake,
, python3 pkg-config,
, boost python3,
, egl-wayland boost,
, freetype egl-wayland,
, glib freetype,
, glm glib,
, glog glm,
, libdrm glog,
, libepoxy libdrm,
, libevdev libepoxy,
, libglvnd libevdev,
, libinput libglvnd,
, libuuid libinput,
, libxcb libuuid,
, libxkbcommon libxcb,
, libxmlxx libxkbcommon,
, yaml-cpp libxmlxx,
, lttng-ust yaml-cpp,
, mesa lttng-ust,
, nettle mesa,
, udev nettle,
, wayland udev,
, wayland-scanner wayland,
, xorg wayland-scanner,
, xwayland xorg,
, dbus xwayland,
, gobject-introspection dbus,
, gtest gobject-introspection,
, umockdev gtest,
, wlcs umockdev,
, validatePkgConfig wlcs,
validatePkgConfig,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -54,25 +55,22 @@ stdenv.mkDerivation (finalAttrs: {
patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in patchShebangs tools/detect_fd_leaks.bash tests/acceptance-tests/wayland-generator/test_wayland_generator.sh.in
# Fix LD_PRELOADing in tests # Fix LD_PRELOADing in tests
for needsPreloadFixing in \ substituteInPlace \
cmake/MirCommon.cmake \ cmake/MirCommon.cmake \
tests/umock-acceptance-tests/CMakeLists.txt \ tests/umock-acceptance-tests/CMakeLists.txt \
tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \ tests/unit-tests/platforms/gbm-kms/kms/CMakeLists.txt \
tests/unit-tests/CMakeLists.txt tests/unit-tests/CMakeLists.txt \
do --replace-warn 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \
substituteInPlace $needsPreloadFixing \ --replace-warn 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0'
--replace 'LD_PRELOAD=liblttng-ust-fork.so' 'LD_PRELOAD=${lib.getLib lttng-ust}/lib/liblttng-ust-fork.so' \
--replace 'LD_PRELOAD=libumockdev-preload.so.0' 'LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0'
done
# Fix Xwayland default # Fix Xwayland default
substituteInPlace src/miral/x11_support.cpp \ substituteInPlace src/miral/x11_support.cpp \
--replace '/usr/bin/Xwayland' '${lib.getExe xwayland}' --replace-fail '/usr/bin/Xwayland' '${lib.getExe xwayland}'
# Fix paths for generating drm-formats # Fix paths for generating drm-formats
substituteInPlace src/platform/graphics/CMakeLists.txt \ substituteInPlace src/platform/graphics/CMakeLists.txt \
--replace "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \ --replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \
--replace "/usr/include/libdrm/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; strictDeps = true;
@ -82,12 +80,15 @@ stdenv.mkDerivation (finalAttrs: {
glib # gdbus-codegen glib # gdbus-codegen
lttng-ust # lttng-gen-tp lttng-ust # lttng-gen-tp
pkg-config pkg-config
(python3.withPackages (ps: with ps; [ (python3.withPackages (
pillow ps:
] ++ lib.optionals finalAttrs.finalPackage.doCheck [ with ps;
pygobject3 [ pillow ]
python-dbusmock ++ lib.optionals finalAttrs.finalPackage.doCheck [
])) pygobject3
python-dbusmock
]
))
validatePkgConfig validatePkgConfig
wayland-scanner wayland-scanner
]; ];
@ -133,28 +134,31 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [ cmakeFlags = [
(lib.cmakeBool "BUILD_DOXYGEN" false) (lib.cmakeBool "BUILD_DOXYGEN" false)
(lib.cmakeFeature "MIR_PLATFORM" (lib.strings.concatStringsSep ";" [ (lib.cmakeFeature "MIR_PLATFORM" (
"gbm-kms" lib.strings.concatStringsSep ";" [
"x11" "gbm-kms"
"eglstream-kms" "x11"
"wayland" "eglstream-kms"
])) "wayland"
]
))
(lib.cmakeBool "MIR_ENABLE_TESTS" finalAttrs.finalPackage.doCheck) (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 # 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 # https://github.com/canonical/mir/pull/1947#issuecomment-811810872
(lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true) (lib.cmakeBool "MIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN" true)
(lib.cmakeFeature "MIR_EXCLUDE_TESTS" (lib.strings.concatStringsSep ";" [ (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 # 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_PERFORMANCE_TESTS" false)
(lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false) (lib.cmakeBool "MIR_BUILD_PLATFORM_TEST_HARNESS" false)
# https://github.com/canonical/mir/issues/2987 # https://github.com/canonical/mir/issues/2987
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799
(lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false) (lib.cmakeBool "MIR_USE_PRECOMPILED_HEADERS" false)
(lib.cmakeFeature "MIR_COMPILER_QUIRKS" (lib.strings.concatStringsSep ";" [ (lib.cmakeFeature "MIR_COMPILER_QUIRKS" (
# https://github.com/canonical/mir/issues/3017 actually affects x86_64 as well lib.strings.concatStringsSep ";" [
"test_touchspot_controller.cpp:array-bounds" # 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; doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
@ -163,13 +167,14 @@ stdenv.mkDerivation (finalAttrs: {
export XDG_RUNTIME_DIR=$TMP export XDG_RUNTIME_DIR=$TMP
''; '';
outputs = [ "out" "dev" ]; outputs = [
"out"
"dev"
];
passthru = { passthru = {
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
updateScript = gitUpdater { updateScript = gitUpdater { rev-prefix = "v"; };
rev-prefix = "v";
};
}; };
meta = with lib; { meta = with lib; {
@ -177,7 +182,10 @@ stdenv.mkDerivation (finalAttrs: {
homepage = "https://mir-server.io"; homepage = "https://mir-server.io";
changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}"; changelog = "https://github.com/canonical/mir/releases/tag/v${finalAttrs.version}";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ onny OPNA2608 ]; maintainers = with maintainers; [
onny
OPNA2608
];
platforms = platforms.linux; platforms = platforms.linux;
pkgConfigModules = [ pkgConfigModules = [
"miral" "miral"