1{ stdenv
2, fetchFromGitLab
3, lib
4, cmake
5, meson
6, ninja
7, bash-completion
8, libGL
9, libglvnd
10, makeWrapper
11, pkg-config
12, python3
13, x11Support ? true, libxcb, libX11
14, waylandSupport ? true, wayland, wayland-protocols
15, useGbm ? true, mesa, udev
16}:
17
18stdenv.mkDerivation rec {
19 pname = "waffle";
20 version = "1.8.0";
21
22 src = fetchFromGitLab {
23 domain = "gitlab.freedesktop.org";
24 owner = "mesa";
25 repo = "waffle";
26 rev = "v${version}";
27 sha256 = "sha256-GVULv/TkCS9CgSFWlskIamw5Z402n684G6jeTLMCPNc=";
28 };
29
30 buildInputs = [
31 bash-completion
32 libGL
33 ] ++ lib.optionals (with stdenv.hostPlatform; isUnix && !isDarwin) [
34 libglvnd
35 ] ++ lib.optionals x11Support [
36 libX11
37 libxcb
38 ] ++ lib.optionals waylandSupport [
39 wayland
40 wayland-protocols
41 ] ++ lib.optionals useGbm [
42 udev
43 mesa
44 ];
45
46 dontUseCmakeConfigure = true;
47
48 nativeBuildInputs = [
49 cmake
50 makeWrapper
51 meson
52 ninja
53 pkg-config
54 python3
55 ];
56
57 PKG_CONFIG_BASH_COMPLETION_COMPLETIONSDIR= "${placeholder "out"}/share/bash-completion/completions";
58
59 postInstall = ''
60 wrapProgram $out/bin/wflinfo \
61 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libGL libglvnd ]}
62 '';
63
64 meta = with lib; {
65 description = "A cross-platform C library that allows one to defer selection of an OpenGL API and window system until runtime";
66 homepage = "https://www.waffle-gl.org/";
67 license = licenses.bsd2;
68 platforms = platforms.mesaPlatforms;
69 maintainers = with maintainers; [ Flakebi ];
70 };
71}