nixpkgs/pkgs/development/libraries/raylib/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
2.1 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchFromGitHub, cmake, fetchpatch
, mesa, libGLU, glfw
, libX11, libXi, libXcursor, libXrandr, libXinerama
, alsaSupport ? stdenv.hostPlatform.isLinux, alsa-lib
, pulseSupport ? stdenv.hostPlatform.isLinux, libpulseaudio
, sharedLib ? true
, includeEverything ? true
, raylib-games
2020-09-16 05:22:40 +03:00
}:
2023-07-13 00:58:25 +03:00
stdenv.mkDerivation (finalAttrs: {
2020-09-16 05:22:40 +03:00
pname = "raylib";
2023-07-13 00:58:25 +03:00
version = "4.5.0";
2020-09-16 05:22:40 +03:00
src = fetchFromGitHub {
owner = "raysan5";
2023-07-13 00:58:25 +03:00
repo = "raylib";
rev = finalAttrs.version;
hash = "sha256-Uqqzq5shDp0AgSBT5waHBNUkEu0LRj70SNOlR5R2yAM=";
2020-09-16 05:22:40 +03:00
};
nativeBuildInputs = [ cmake ];
2022-10-24 04:15:48 +03:00
2020-09-16 05:22:40 +03:00
buildInputs = [
2022-10-24 04:15:48 +03:00
mesa glfw libXi libXcursor libXrandr libXinerama
] ++ lib.optional alsaSupport alsa-lib
2020-09-16 05:22:40 +03:00
++ lib.optional pulseSupport libpulseaudio;
2022-10-24 04:15:48 +03:00
propagatedBuildInputs = [ libGLU libX11 ];
2020-09-16 05:22:40 +03:00
# https://github.com/raysan5/raylib/wiki/CMake-Build-Options
cmakeFlags = [
"-DUSE_EXTERNAL_GLFW=ON"
"-DBUILD_EXAMPLES=OFF"
"-DCUSTOMIZE_BUILD=1"
] ++ lib.optional includeEverything "-DINCLUDE_EVERYTHING=ON"
++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON";
2020-09-16 05:22:40 +03:00
passthru.tests = [ raylib-games ];
patches = [
# Patch version in CMakeList to 4.5.0
# Remove this when updating to a new revision
(fetchpatch {
url = "https://github.com/raysan5/raylib/commit/0d4db7ad7f6fd442ed165ebf8ab8b3f4033b04e7.patch";
hash = "sha256-RGokbQAwJAZm2FU2VNwraE3xko8E+RLLFjUfDRXeKhA=";
})
];
# fix libasound.so/libpulse.so not being found
preFixup = ''
${lib.optionalString alsaSupport "patchelf --add-needed ${alsa-lib}/lib/libasound.so $out/lib/libraylib.so.${finalAttrs.version}"}
${lib.optionalString pulseSupport "patchelf --add-needed ${libpulseaudio}/lib/libpulse.so $out/lib/libraylib.so.${finalAttrs.version}"}
'';
2020-09-16 05:22:40 +03:00
meta = with lib; {
description = "A simple and easy-to-use library to enjoy videogames programming";
homepage = "https://www.raylib.com/";
2020-09-16 05:22:40 +03:00
license = licenses.zlib;
maintainers = with maintainers; [ adamlwgriffiths ];
platforms = platforms.linux;
2023-07-13 00:58:25 +03:00
changelog = "https://github.com/raysan5/raylib/blob/${finalAttrs.version}/CHANGELOG";
2020-09-16 05:22:40 +03:00
};
2023-07-13 00:58:25 +03:00
})