summary refs log tree commit diff
path: root/pkgs/development/libraries/waffle/default.nix
blob: b24c8262794f3f970b5d7076a13dc7539ca432bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ stdenv
, fetchFromGitLab
, lib
, cmake
, meson
, ninja
, bash-completion
, libGL
, libglvnd
, makeWrapper
, pkg-config
, python3
, x11Support ? true, libxcb, libX11
, waylandSupport ? true, wayland, wayland-protocols
, useGbm ? true, mesa, udev
}:

stdenv.mkDerivation rec {
  pname = "waffle";
  version = "1.8.0";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "mesa";
    repo = "waffle";
    rev = "v${version}";
    sha256 = "sha256-GVULv/TkCS9CgSFWlskIamw5Z402n684G6jeTLMCPNc=";
  };

  buildInputs = [
    bash-completion
    libGL
  ] ++ lib.optionals (with stdenv.hostPlatform; isUnix && !isDarwin) [
    libglvnd
  ] ++ lib.optionals x11Support [
    libX11
    libxcb
  ] ++ lib.optionals waylandSupport [
    wayland
    wayland-protocols
  ] ++ lib.optionals useGbm [
    udev
    mesa
  ];

  dontUseCmakeConfigure = true;

  nativeBuildInputs = [
    cmake
    makeWrapper
    meson
    ninja
    pkg-config
    python3
  ];

  PKG_CONFIG_BASH_COMPLETION_COMPLETIONSDIR= "${placeholder "out"}/share/bash-completion/completions";

  postInstall = ''
    wrapProgram $out/bin/wflinfo \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libGL libglvnd ]}
  '';

  meta = with lib; {
    description = "A cross-platform C library that allows one to defer selection of an OpenGL API and window system until runtime";
    homepage = "https://www.waffle-gl.org/";
    license = licenses.bsd2;
    platforms = platforms.mesaPlatforms;
    maintainers = with maintainers; [ Flakebi ];
  };
}