2018-10-22 22:51:10 +02:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, meson, ninja, pkgconfig
|
2018-02-24 13:06:44 +01:00
|
|
|
, wayland, libGL, wayland-protocols, libinput, libxkbcommon, pixman
|
2018-03-28 15:24:33 +02:00
|
|
|
, xcbutilwm, libX11, libcap, xcbutilimage, xcbutilerrors, mesa_noglu
|
2018-10-22 22:51:10 +02:00
|
|
|
, libpng, ffmpeg_4
|
2017-10-31 22:31:05 +01:00
|
|
|
}:
|
|
|
|
|
2018-10-22 22:51:10 +02:00
|
|
|
let
|
|
|
|
pname = "wlroots";
|
2019-02-03 11:46:46 +01:00
|
|
|
version = "0.3";
|
2017-10-31 22:31:05 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "swaywm";
|
|
|
|
repo = "wlroots";
|
2018-10-22 22:51:10 +02:00
|
|
|
rev = version;
|
2019-02-03 11:46:46 +01:00
|
|
|
sha256 = "1iz5lxpiba1lcmkz3hz56r8j6ra3535zgckazqshi4c364nx94zs";
|
2017-10-31 22:31:05 +01:00
|
|
|
};
|
|
|
|
|
2018-10-22 22:51:10 +02: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 22:31:05 +01:00
|
|
|
|
2018-12-22 17:25:56 +01:00
|
|
|
nativeBuildInputs = [ meson ninja pkgconfig ];
|
2017-10-31 22:31:05 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2018-02-24 13:06:44 +01:00
|
|
|
wayland libGL wayland-protocols libinput libxkbcommon pixman
|
2018-03-28 15:24:33 +02:00
|
|
|
xcbutilwm libX11 libcap xcbutilimage xcbutilerrors mesa_noglu
|
2018-10-22 22:51:10 +02:00
|
|
|
libpng ffmpeg_4
|
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dlibcap=enabled" "-Dlogind=enabled" "-Dxwayland=enabled" "-Dx11-backend=enabled"
|
2018-11-30 14:23:33 +01:00
|
|
|
"-Dxcb-icccm=enabled" "-Dxcb-errors=enabled"
|
2017-10-31 22:31:05 +01:00
|
|
|
];
|
|
|
|
|
2019-02-03 11:46:46 +01: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 14:02:59 +01:00
|
|
|
postInstall = ''
|
2019-02-03 17:52:53 +01: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 22:51:10 +02:00
|
|
|
for output in "$bin" "$examples"; do
|
|
|
|
mkdir -p $output/bin
|
|
|
|
cp rootston/rootston $output/bin/
|
|
|
|
patchelf \
|
2019-02-03 17:52:53 +01:00
|
|
|
--set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$output,g)" \
|
2018-10-22 22:51:10 +02: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 23:40:20 +02: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 17:52:53 +01:00
|
|
|
patchelf \
|
|
|
|
--set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$examples,g)" \
|
|
|
|
"$examples/bin/wlroots-$binary"
|
2018-10-22 22:51:10 +02:00
|
|
|
done
|
2017-12-23 14:02:59 +01:00
|
|
|
'';
|
|
|
|
|
2017-10-31 22:31:05 +01: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 ];
|
|
|
|
};
|
|
|
|
}
|