2018-10-22 21:51:10 +01:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, meson, ninja, pkgconfig
|
2018-02-24 12:06:44 +00:00
|
|
|
, wayland, libGL, wayland-protocols, libinput, libxkbcommon, pixman
|
2018-03-28 14:24:33 +01:00
|
|
|
, xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa_noglu
|
2018-10-22 21:51:10 +01:00
|
|
|
, libpng, ffmpeg_4
|
2017-10-31 21:31:05 +00:00
|
|
|
}:
|
|
|
|
|
2018-10-22 21:51:10 +01:00
|
|
|
let
|
|
|
|
pname = "wlroots";
|
2019-03-11 15:41:40 +00:00
|
|
|
version = "0.5.0";
|
2017-10-31 21:31:05 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "swaywm";
|
|
|
|
repo = "wlroots";
|
2018-10-22 21:51:10 +01:00
|
|
|
rev = version;
|
2019-03-11 15:41:40 +00:00
|
|
|
sha256 = "1phiidyddzgaxy4gbqwmykxn0y8za6y5mp66l9dpd9i6fml153yq";
|
2017-10-31 21:31:05 +00:00
|
|
|
};
|
|
|
|
|
2018-10-22 21:51:10 +01:00
|
|
|
# $out for the library, $bin for rootston, and $examples for the example
|
|
|
|
# programs (in examples) AND rootston
|
|
|
|
outputs = [ "out" "bin" "examples" ];
|
2017-10-31 21:31:05 +00:00
|
|
|
|
2018-12-22 16:25:56 +00:00
|
|
|
nativeBuildInputs = [ meson ninja pkgconfig ];
|
2017-10-31 21:31:05 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2018-02-24 12:06:44 +00:00
|
|
|
wayland libGL wayland-protocols libinput libxkbcommon pixman
|
2018-03-28 14:24:33 +01:00
|
|
|
xcbutilwm libX11 libcap xcbutilimage xcbutilerrors mesa_noglu
|
2018-10-22 21:51:10 +01:00
|
|
|
libpng ffmpeg_4
|
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dlibcap=enabled" "-Dlogind=enabled" "-Dxwayland=enabled" "-Dx11-backend=enabled"
|
2018-11-30 13:23:33 +00:00
|
|
|
"-Dxcb-icccm=enabled" "-Dxcb-errors=enabled"
|
2017-10-31 21:31:05 +00:00
|
|
|
];
|
|
|
|
|
2019-02-03 10:46:46 +00:00
|
|
|
postPatch = ''
|
|
|
|
# It happens from time to time that the version wasn't updated:
|
|
|
|
sed -iE "s/version: '[0-9]\.[0-9]\.[0-9]'/version: '${version}.0'/" meson.build
|
|
|
|
'';
|
|
|
|
|
2017-12-23 13:02:59 +00:00
|
|
|
postInstall = ''
|
2019-02-03 16:52:53 +00:00
|
|
|
# Copy the library to $bin and $examples
|
|
|
|
for output in "$bin" "$examples"; do
|
|
|
|
mkdir -p $output/lib
|
|
|
|
cp -P libwlroots* $output/lib/
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Install rootston (the reference compositor) to $bin and $examples (this
|
|
|
|
# has to be done after the fixup phase to prevent broken binaries):
|
2018-10-22 21:51:10 +01:00
|
|
|
for output in "$bin" "$examples"; do
|
|
|
|
mkdir -p $output/bin
|
|
|
|
cp rootston/rootston $output/bin/
|
|
|
|
patchelf \
|
2019-02-03 16:52:53 +00:00
|
|
|
--set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$output,g)" \
|
2018-10-22 21:51:10 +01:00
|
|
|
$output/bin/rootston
|
|
|
|
mkdir $output/etc
|
|
|
|
cp ../rootston/rootston.ini.example $output/etc/rootston.ini
|
|
|
|
done
|
|
|
|
# Install ALL example programs to $examples:
|
|
|
|
# screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
|
|
|
|
# screenshot output-layout multi-pointer rotation tablet touch pointer
|
|
|
|
# simple
|
|
|
|
mkdir -p $examples/bin
|
2018-10-24 22:40:20 +01:00
|
|
|
cd ./examples
|
|
|
|
for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
|
|
|
|
cp "$binary" "$examples/bin/wlroots-$binary"
|
2019-02-03 16:52:53 +00:00
|
|
|
patchelf \
|
|
|
|
--set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$examples,g)" \
|
|
|
|
"$examples/bin/wlroots-$binary"
|
2018-10-22 21:51:10 +01:00
|
|
|
done
|
2017-12-23 13:02:59 +00:00
|
|
|
'';
|
|
|
|
|
2017-10-31 21:31:05 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A modular Wayland compositor library";
|
|
|
|
inherit (src.meta) homepage;
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ primeos ];
|
|
|
|
};
|
|
|
|
}
|