aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/graphics/piglit/default.nix
blob: e2c2b6e6e9724cc7744c2b22f1a5f34498e94d75 (plain)
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
72
73
74
75
76
77
{ stdenv
, fetchFromGitLab
, lib
, cmake
, freeglut
, libGL
, libGLU
, libglvnd
, makeWrapper
, ninja
, pkg-config
, python3
, waffle
, wayland
, libX11
, libXrender
, libxcb
, libxkbcommon
}:

stdenv.mkDerivation rec {
  pname = "piglit";
  version = "unstable-2020-10-23";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "mesa";
    repo = "piglit";
    rev = "59e695c16fdcdd4ea4f16365f0e397a93cef7b80";
    sha256 = "kx0+2Sdvdc3SbpAIl2OuGCWCpaLJC/7cXG+ZLvf92g8=";
  };

  buildInputs = [
    freeglut
    libGL
    libGLU
    libglvnd
    libX11
    libXrender
    libxcb
    libxkbcommon
    (python3.withPackages (ps: with ps; [
      Mako
      numpy
    ]))
    waffle
    wayland
  ];

  nativeBuildInputs = [
    cmake
    makeWrapper
    ninja
    pkg-config
  ];

  # Find data dir: piglit searches for the data directory in some places, however as it is wrapped,
  # it search in ../lib/.piglit-wrapped, we just replace the script name with "piglit" again.
  prePatch = ''
    substituteInPlace piglit \
      --replace 'script_basename_noext = os.path.splitext(os.path.basename(__file__))[0]' 'script_basename_noext = "piglit"'
  '';

  postInstall = ''
    wrapProgram $out/bin/piglit \
      --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libGL libglvnd ]} \
      --prefix PATH : "${waffle}/bin"
  '';

  meta = with lib; {
    description = "An OpenGL test suite, and test-suite runner";
    homepage = "https://gitlab.freedesktop.org/mesa/piglit";
    license = licenses.free; # custom license. See COPYING in the source repo.
    platforms = platforms.mesaPlatforms;
    maintainers = with maintainers; [ Flakebi ];
  };
}