1{ stdenv
2, fetchFromGitLab
3, lib
4, cmake
5, freeglut
6, libGL
7, libGLU
8, libglvnd
9, makeWrapper
10, ninja
11, pkg-config
12, python3
13, waffle
14, wayland
15, libX11
16, libXrender
17, libxcb
18, libxkbcommon
19}:
20
21stdenv.mkDerivation rec {
22 pname = "piglit";
23 version = "unstable-2020-10-23";
24
25 src = fetchFromGitLab {
26 domain = "gitlab.freedesktop.org";
27 owner = "mesa";
28 repo = "piglit";
29 rev = "59e695c16fdcdd4ea4f16365f0e397a93cef7b80";
30 sha256 = "kx0+2Sdvdc3SbpAIl2OuGCWCpaLJC/7cXG+ZLvf92g8=";
31 };
32
33 buildInputs = [
34 freeglut
35 libGL
36 libGLU
37 libglvnd
38 libX11
39 libXrender
40 libxcb
41 libxkbcommon
42 (python3.withPackages (ps: with ps; [
43 mako
44 numpy
45 ]))
46 waffle
47 wayland
48 ];
49
50 nativeBuildInputs = [
51 cmake
52 makeWrapper
53 ninja
54 pkg-config
55 ];
56
57 # Find data dir: piglit searches for the data directory in some places, however as it is wrapped,
58 # it search in ../lib/.piglit-wrapped, we just replace the script name with "piglit" again.
59 prePatch = ''
60 substituteInPlace piglit \
61 --replace 'script_basename_noext = os.path.splitext(os.path.basename(__file__))[0]' 'script_basename_noext = "piglit"'
62 '';
63
64 postInstall = ''
65 wrapProgram $out/bin/piglit \
66 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libGL libglvnd ]} \
67 --prefix PATH : "${waffle}/bin"
68 '';
69
70 meta = with lib; {
71 description = "An OpenGL test suite, and test-suite runner";
72 homepage = "https://gitlab.freedesktop.org/mesa/piglit";
73 license = licenses.free; # custom license. See COPYING in the source repo.
74 platforms = platforms.mesaPlatforms;
75 maintainers = with maintainers; [ Flakebi ];
76 };
77}