mir: Modernise derivation

- test-related inputs -> checkInputs
- use finalAttrs
- set meta.changelog
- set meta.pkgConfigModules, validate with validatePkgConfig
This commit is contained in:
OPNA2608 2023-05-15 22:19:12 +02:00
parent 10092e1418
commit e2627fbe69

View file

@ -2,6 +2,7 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, gitUpdater , gitUpdater
, testers
, cmake , cmake
, pkg-config , pkg-config
, python3 , python3
@ -34,26 +35,17 @@
, gtest , gtest
, umockdev , umockdev
, wlcs , wlcs
, validatePkgConfig
}: }:
let stdenv.mkDerivation (finalAttrs: {
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
pythonEnv = python3.withPackages(ps: with ps; [
pillow
] ++ lib.optionals doCheck [
pygobject3
python-dbusmock
]);
in
stdenv.mkDerivation rec {
pname = "mir"; pname = "mir";
version = "2.13.0"; version = "2.13.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "MirServer"; owner = "MirServer";
repo = "mir"; repo = "mir";
rev = "v${version}"; rev = "v${finalAttrs.version}";
hash = "sha256-Ip8p4mjcgmZQJTU4MNvWkTTtSJc+cCL3x1mMDFlZrVY="; hash = "sha256-Ip8p4mjcgmZQJTU4MNvWkTTtSJc+cCL3x1mMDFlZrVY=";
}; };
@ -98,7 +90,13 @@ stdenv.mkDerivation rec {
libxslt libxslt
lttng-ust # lttng-gen-tp lttng-ust # lttng-gen-tp
pkg-config pkg-config
pythonEnv (python3.withPackages (ps: with ps; [
pillow
] ++ lib.optionals finalAttrs.doCheck [
pygobject3
python-dbusmock
]))
validatePkgConfig
]; ];
buildInputs = [ buildInputs = [
@ -127,21 +125,23 @@ stdenv.mkDerivation rec {
xorg.libXcursor xorg.libXcursor
xorg.xorgproto xorg.xorgproto
xwayland xwayland
] ++ lib.optionals doCheck [
gtest
umockdev
wlcs
]; ];
nativeCheckInputs = [ nativeCheckInputs = [
dbus dbus
]; ];
checkInputs = [
gtest
umockdev
wlcs
];
buildFlags = [ "all" "doc" ]; buildFlags = [ "all" "doc" ];
cmakeFlags = [ cmakeFlags = [
"-DMIR_PLATFORM='gbm-kms;x11;eglstream-kms;wayland'" "-DMIR_PLATFORM='gbm-kms;x11;eglstream-kms;wayland'"
"-DMIR_ENABLE_TESTS=${if doCheck then "ON" else "OFF"}" "-DMIR_ENABLE_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
# 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/MirServer/mir/pull/1947#issuecomment-811810872 # https://github.com/MirServer/mir/pull/1947#issuecomment-811810872
"-DMIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN=ON" "-DMIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN=ON"
@ -152,7 +152,7 @@ stdenv.mkDerivation rec {
"-DMIR_BUILD_PLATFORM_TEST_HARNESS=OFF" "-DMIR_BUILD_PLATFORM_TEST_HARNESS=OFF"
]; ];
inherit doCheck; doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
preCheck = '' preCheck = ''
# Needs to be exactly /tmp so some failing tests don't get run, don't know why they fail yet # Needs to be exactly /tmp so some failing tests don't get run, don't know why they fail yet
@ -163,6 +163,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" "doc" ]; outputs = [ "out" "dev" "doc" ];
passthru = { passthru = {
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
updateScript = gitUpdater { updateScript = gitUpdater {
rev-prefix = "v"; rev-prefix = "v";
}; };
@ -179,8 +180,22 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "A display server and Wayland compositor developed by Canonical"; description = "A display server and Wayland compositor developed by Canonical";
homepage = "https://mir-server.io"; homepage = "https://mir-server.io";
changelog = "https://github.com/MirServer/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 = [
"miral"
"mircommon"
"mircookie"
"mircore"
"miroil"
"mirplatform"
"mir-renderer-gl-dev"
"mirrenderer"
"mirserver"
"mirtest"
"mirwayland"
];
}; };
} })