System/packages/glfw-minecraft-wayland/default.nix

50 lines
1.5 KiB
Nix

{ 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
];
propagatedBuildInputs =
[ libGL libX11 libXrandr libXinerama libXcursor libXi libXext ];
nativeBuildInputs = [ cmake extra-cmake-modules ];
buildInputs = [ wayland wayland-protocols libxkbcommon ];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DGLFW_USE_WAYLAND=ON"
"-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;
};
}