1{ lib, stdenv, fetchFromGitHub, python3, cmake, libglvnd, libGLU, unstableGitUpdater }:
2
3stdenv.mkDerivation rec {
4 pname = "gl3w";
5 version = "0-unstable-2023-10-10";
6
7 src = fetchFromGitHub {
8 owner = "skaslev";
9 repo = pname;
10 rev = "3a33275633ce4be433332dc776e6a5b3bdea6506";
11 hash = "sha256-kEm5QItpasSFJQ32YBHPpc+itz/nQ8bQMCavbOTGT/w=";
12 };
13
14 nativeBuildInputs = [ python3 cmake ];
15 # gl3w installs a CMake config that when included expects to be able to
16 # build and link against both of these libraries
17 # (the gl3w generated C file gets compiled into the downstream target)
18 propagatedBuildInputs = [ libglvnd libGLU ];
19
20 dontUseCmakeBuildDir = true;
21
22 # These files must be copied rather than linked since they are considered
23 # outputs for the custom command, and CMake expects to be able to touch them
24 preConfigure = ''
25 mkdir -p include/{GL,KHR}
26 cp ${libglvnd.dev}/include/GL/glcorearb.h include/GL/glcorearb.h
27 cp ${libglvnd.dev}/include/KHR/khrplatform.h include/KHR/khrplatform.h
28 '';
29
30 passthru.updateScript = unstableGitUpdater { };
31
32 meta = with lib; {
33 description = "Simple OpenGL core profile loading";
34 homepage = "https://github.com/skaslev/gl3w";
35 license = licenses.unlicense;
36 maintainers = with maintainers; [ lilyinstarlight ];
37 platforms = platforms.unix;
38 };
39}