waffle: Add support for non-linux platforms

Waffle works perfectly well on macOS and Windows. Because the meson
options do proper dependency checking already, we can just leave them
out. This has the additional benefit of allowing gbm, surfaceless_egl
and x11_egl supoort to be built on Linux, which are useful in
conjunction with the piglit test suite.
This commit is contained in:
Dylan Baker 2020-12-22 15:01:27 -08:00
parent fd4e4bd8be
commit 807c0b0df5
1 changed files with 15 additions and 8 deletions

View File

@ -4,15 +4,20 @@
, meson , meson
, ninja , ninja
, libGL , libGL
, libglvnd , libglvnd ? null
, makeWrapper , makeWrapper
, pkg-config , pkg-config
, wayland
, libxcb
, libX11
, python3 , python3
, x11Support ? true, libxcb ? null, libX11 ? null
, waylandSupport ? true, wayland ? null
, useGbm ? true, mesa ? null, libudev ? null
}: }:
assert x11Support -> (libxcb != null && libX11 != null);
assert waylandSupport -> wayland != null;
assert useGbm -> (mesa != null && libudev != null);
assert with stdenv.hostPlatform; isUnix && !isDarwin -> libglvnd != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "waffle"; pname = "waffle";
version = "1.6.1"; version = "1.6.1";
@ -27,10 +32,16 @@ stdenv.mkDerivation rec {
buildInputs = [ buildInputs = [
libGL libGL
] ++ stdenv.lib.optionals (with stdenv.hostPlatform; isUnix && !isDarwin) [
libglvnd libglvnd
] ++ stdenv.lib.optionals x11Support [
libX11 libX11
libxcb libxcb
] ++ stdenv.lib.optionals waylandSupport [
wayland wayland
] ++ stdenv.lib.optionals useGbm [
mesa
libudev
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
@ -41,10 +52,6 @@ stdenv.mkDerivation rec {
python3 python3
]; ];
mesonFlags = [
"-Dgbm=disabled"
];
postInstall = '' postInstall = ''
wrapProgram $out/bin/wflinfo \ wrapProgram $out/bin/wflinfo \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libGL libglvnd ]} --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libGL libglvnd ]}