Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mir: init at 2.11.0 #207534

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions pkgs/development/libraries/egl-wayland/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,10 @@
, mesa
, wayland
, wayland-protocols
, eglexternalplatform
}:

let
eglexternalplatform = stdenv.mkDerivation {
pname = "eglexternalplatform";
version = "1.1";

src = fetchFromGitHub {
owner = "Nvidia";
repo = "eglexternalplatform";
rev = "7c8f8e2218e46b1a4aa9538520919747f1184d86";
sha256 = "0lr5s2xa1zn220ghmbsiwgmx77l156wk54c7hybia0xpr9yr2nhb";
};

installPhase = ''
mkdir -p "$out/include/"
cp interface/eglexternalplatform.h "$out/include/"
cp interface/eglexternalplatformversion.h "$out/include/"

substituteInPlace eglexternalplatform.pc \
--replace "/usr/include/EGL" "$out/include"
mkdir -p "$out/share/pkgconfig"
cp eglexternalplatform.pc "$out/share/pkgconfig/"
'';

meta = with lib; {
license = licenses.mit;
};
};

in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "egl-wayland";
version = "1.1.11";

Expand Down
39 changes: 39 additions & 0 deletions pkgs/development/libraries/eglexternalplatform/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ lib
, stdenvNoCC
, fetchFromGitHub
}:

stdenvNoCC.mkDerivation rec {
pname = "eglexternalplatform";
version = "1.1";

src = fetchFromGitHub {
owner = "Nvidia";
repo = "eglexternalplatform";
rev = version;
sha256 = "0lr5s2xa1zn220ghmbsiwgmx77l156wk54c7hybia0xpr9yr2nhb";
};

installPhase = ''
runHook preInstall

mkdir -p "$out/include/"
cp interface/eglexternalplatform.h "$out/include/"
cp interface/eglexternalplatformversion.h "$out/include/"

substituteInPlace eglexternalplatform.pc \
--replace "/usr/include/EGL" "$out/include"
mkdir -p "$out/share/pkgconfig"
cp eglexternalplatform.pc "$out/share/pkgconfig/"

runHook postInstall
'';

meta = with lib; {
description = "The EGL External Platform interface";
homepage = "https://github.com/NVIDIA/eglexternalplatform";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ hedning ];
};
}
129 changes: 129 additions & 0 deletions pkgs/servers/mir/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, boost
, egl-wayland
, libglvnd
, glm
, glog
, lttng-ust
, udev
, glib
, wayland
, libxcb
, xorg
, libdrm
, mesa
, libepoxy
, nettle
, libxkbcommon
, libinput
, libxmlxx
, libuuid
, pcre2
, freetype
, libyamlcpp
, python3
, libevdev
, libselinux
, libsepol
, eglexternalplatform
, doxygen
, libxslt
, pkg-config
}:

let
pythonEnv = python3.withPackages(ps: [ ps.pillow ]);
in

stdenv.mkDerivation rec {
pname = "mir";
version = "2.11.0";

src = fetchFromGitHub {
owner = "MirServer";
repo = "mir";
rev = "v${version}";
sha256 = "sha256-103PJZEoSgtSbDGCanD2/XdpX6DXXx678GmghdZI7H4=";
};

postPatch = ''
# Fix error broken path found in pc file ("//")
for f in $(find . -name '*.pc.in') ; do
substituteInPlace $f \
--replace "/@CMAKE_INSTALL_LIBDIR@" "@CMAKE_INSTALL_LIBDIR@" \
--replace "/@CMAKE_INSTALL_INCLUDEDIR@" "@CMAKE_INSTALL_INCLUDEDIR@"
done
Comment on lines +53 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While trying to build something that depends on Mir we noticed that the paths are still broken, just not broken enough for the pkg-config check to notice:

prefix=/nix/store/yr3jc3213w1y3f1kc7ppa1a5yx0xng4y-mir-2.10.0
libdir=${prefix}/nix/store/yr3jc3213w1y3f1kc7ppa1a5yx0xng4y-mir-2.10.0/lib
includedir=/nix/store/vzy7w5yqi6y5z5qjpiyq1yfpjpxkzk6i-mir-2.10.0-dev/nix/store/vzy7w5yqi6y5z5qjpiyq1yfpjpxkzk6i-mir-2.10.0-dev/include/miral

I think for our purposes, replacing all ${prefix}/@CMAKE_INSTALL_<dir>@ with @CMAKE_INSTALL_FULL_<dir>@ etc might be fine:

prefix=/nix/store/q4921w10hjmpk28dkk1c4y1c5fy33fcy-mir-2.10.0
libdir=/nix/store/q4921w10hjmpk28dkk1c4y1c5fy33fcy-mir-2.10.0/lib
includedir=/nix/store/ird024yncpxv3rlz42grx8i4g3s891s4-mir-2.10.0-dev/include/miral

The more proper fix being something like jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files being done upstream.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

being done upstream.

Should we @-mark them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I PR'd the same fix to their wlcs project recently (first with FULL, now with jtojnar's snippet), guess I could do the same for Mir & link it here for fetchpatching.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canonical/mir#2786, should be cherry-pickable onto 2.11.0.


# Fix paths for generating drm-formats
substituteInPlace src/platform/graphics/CMakeLists.txt \
--replace "/usr/include/drm/drm_fourcc.h" "${libdrm.dev}/include/libdrm/drm_fourcc.h" \
--replace "/usr/include/libdrm/drm_fourcc.h" "${libdrm.dev}/include/libdrm/drm_fourcc.h"

# Fix server-platform install path
substituteInPlace src/platforms/CMakeLists.txt \
--replace "\''${CMAKE_INSTALL_PREFIX}/\''${CMAKE_INSTALL_LIBDIR}/mir/server-platform" "\''${CMAKE_INSTALL_LIBDIR}/mir/server-platform"
'';

nativeBuildInputs = [
cmake
doxygen
onny marked this conversation as resolved.
Show resolved Hide resolved
libxslt
pkg-config
pythonEnv
];

buildInputs = [
boost
eglexternalplatform
egl-wayland
freetype
glib
glm
glog
libdrm
libepoxy
libevdev
libglvnd
libinput
libselinux
libsepol
libuuid
libxcb
libxkbcommon
libxmlxx
libyamlcpp
lttng-ust
mesa
nettle
pcre2
udev
wayland
xorg.libX11
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved
xorg.libXau
xorg.libXcursor
xorg.libXdmcp
xorg.libXrender
xorg.xorgproto
];

buildFlags = [ "all" "doc" ];
onny marked this conversation as resolved.
Show resolved Hide resolved

cmakeFlags = [
"-DMIR_PLATFORM='gbm-kms;eglstream-kms;x11;wayland'"
# Tests depend on package wlcs which is not yet packaged
"-DMIR_ENABLE_TESTS=OFF"
];

outputs = [ "out" "dev" "doc" ];

meta = with lib; {
description = "Compositor and display server used by Canonical";
homepage = "https://mir-server.io";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ onny ];
platforms = platforms.linux;
};
onny marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18973,6 +18973,8 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Accelerate CoreGraphics CoreVideo;
};

eglexternalplatform = callPackage ../development/libraries/eglexternalplatform {};

egl-wayland = callPackage ../development/libraries/egl-wayland {};

elastix = callPackage ../development/libraries/science/biology/elastix {
Expand Down Expand Up @@ -24428,6 +24430,8 @@ with pkgs;

miniflux = callPackage ../servers/miniflux { };

mir = callPackage ../servers/mir { };

icinga2 = callPackage ../servers/monitoring/icinga2 { };

icinga2-agent = callPackage ../servers/monitoring/icinga2 {
Expand Down