···11+{ lib, stdenv, fetchFromGitHub, python3, cmake, libglvnd, libGLU }:
22+33+stdenv.mkDerivation rec {
44+ pname = "gl3w";
55+ version = "unstable-2022-03-24";
66+77+ src = fetchFromGitHub {
88+ owner = "skaslev";
99+ repo = pname;
1010+ rev = "5f8d7fd191ba22ff2b60c1106d7135bb9a335533";
1111+ hash = "sha256-qV/PZmaP5iCHhIzTA2bE4d1RMB6LzRbTsB5gWVvi9bU=";
1212+ };
1313+1414+ nativeBuildInputs = [ python3 cmake ];
1515+ # gl3w installs a CMake config that when included expects to be able to
1616+ # build and link against both of these libraries
1717+ # (the gl3w generated C file gets compiled into the downstream target)
1818+ propagatedBuildInputs = [ libglvnd libGLU ];
1919+2020+ dontUseCmakeBuildDir = true;
2121+2222+ # These files must be copied rather than linked since they are considered
2323+ # outputs for the custom command, and CMake expects to be able to touch them
2424+ preConfigure = ''
2525+ mkdir -p include/{GL,KHR}
2626+ cp ${libglvnd.dev}/include/GL/glcorearb.h include/GL/glcorearb.h
2727+ cp ${libglvnd.dev}/include/KHR/khrplatform.h include/KHR/khrplatform.h
2828+ '';
2929+3030+ meta = with lib; {
3131+ description = "Simple OpenGL core profile loading";
3232+ homepage = "https://github.com/skaslev/gl3w";
3333+ license = licenses.unlicense;
3434+ maintainers = with maintainers; [ lilyinstarlight ];
3535+ platforms = platforms.unix;
3636+ };
3737+}