2023-02-08 22:28:04 -05:00
|
|
|
{ stdenv, lib, fetchzip, cmake, libGL, libXrandr, libXinerama, libXcursor
|
|
|
|
, libX11, libXi, libXext, extra-cmake-modules, wayland, wayland-protocols
|
|
|
|
, libxkbcommon }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "3.4.0+1.19";
|
|
|
|
pname = "glfw";
|
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url =
|
|
|
|
"https://github.com/glfw/glfw/archive/62e175ef9fae75335575964c845a302447c012c7.tar.gz";
|
|
|
|
sha256 = "sha256-GiY4d7xadR0vN5uCQyWaOpoo2o6uMGl1fCcX4uDGnks=";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./0003-Don-t-crash-on-calls-to-focus-or-icon.patch
|
|
|
|
./0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch
|
|
|
|
./0005-Add-warning-about-being-an-unofficial-patch.patch
|
|
|
|
./0007-Platform-Prefer-Wayland-over-X11.patch
|
|
|
|
];
|
|
|
|
|
2023-02-08 23:44:28 -05:00
|
|
|
propagatedBuildInputs = [ libGL ];
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
extra-cmake-modules
|
|
|
|
libX11
|
|
|
|
libXrandr
|
|
|
|
libXinerama
|
|
|
|
libXcursor
|
|
|
|
libXi
|
|
|
|
libXext
|
|
|
|
];
|
|
|
|
buildInputs = [ libGL wayland wayland-protocols libxkbcommon ];
|
2023-02-08 22:28:04 -05:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
|
|
|
"-DGLFW_USE_WAYLAND=ON"
|
2023-02-08 23:44:28 -05:00
|
|
|
"-DCMAKE_C_FLAGS=-D_GLFW_GLX_LIBRARY='\"${
|
|
|
|
lib.getLib libGL
|
|
|
|
}/lib/libGL.so.1\"'"
|
2023-02-08 22:28:04 -05:00
|
|
|
"-DCMAKE_C_FLAGS=-D_GLFW_EGL_LIBRARY='\"${
|
|
|
|
lib.getLib libGL
|
|
|
|
}/lib/libEGL.so.1\"'"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/wl_init.c \
|
|
|
|
--replace "libxkbcommon.so.0" "${
|
|
|
|
lib.getLib libxkbcommon
|
|
|
|
}/lib/libxkbcommon.so.0"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description =
|
|
|
|
"Multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time";
|
|
|
|
homepage = "https://www.glfw.org/";
|
|
|
|
license = licenses.zlib;
|
|
|
|
maintainers = with maintainers; [ marcweber twey ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|