2021-03-09 03:18:52 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake,
|
|
|
|
mesa, libGLU, glfw,
|
|
|
|
libX11, libXi, libXcursor, libXrandr, libXinerama,
|
2021-06-28 23:13:55 +00:00
|
|
|
alsaSupport ? stdenv.hostPlatform.isLinux, alsa-lib,
|
2021-03-09 03:18:52 +00:00
|
|
|
pulseSupport ? stdenv.hostPlatform.isLinux, libpulseaudio,
|
2021-06-04 09:07:49 +00:00
|
|
|
sharedLib ? true,
|
2021-03-09 03:18:52 +00:00
|
|
|
includeEverything ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "raylib";
|
2021-06-04 09:07:49 +00:00
|
|
|
version = "3.7.0";
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "raysan5";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2021-06-04 09:07:49 +00:00
|
|
|
sha256 = "1w8v747hqy0ils6zmy8sm056f24ybjhn9bamqzlxvbqhvh9vvly1";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2021-06-04 09:07:49 +00:00
|
|
|
# fixes incorrect version being set by cmake
|
2021-03-09 03:18:52 +00:00
|
|
|
(fetchpatch {
|
2021-06-04 09:07:49 +00:00
|
|
|
url = "https://github.com/raysan5/raylib/commit/204aa4c46fdd6986aa0130eeba658562c540759f.patch";
|
|
|
|
sha256 = "10pl7828iy4kadach0wy4fs95vr7k08z3mxw90j8dm9xak1ri8fz";
|
2021-03-09 03:18:52 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [
|
|
|
|
mesa libGLU glfw libX11 libXi libXcursor libXrandr libXinerama
|
2021-06-28 23:13:55 +00:00
|
|
|
] ++ lib.optional alsaSupport alsa-lib
|
2021-03-09 03:18:52 +00:00
|
|
|
++ lib.optional pulseSupport libpulseaudio;
|
|
|
|
|
|
|
|
# https://github.com/raysan5/raylib/wiki/CMake-Build-Options
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_EXTERNAL_GLFW=ON"
|
|
|
|
"-DBUILD_EXAMPLES=OFF"
|
2021-06-04 09:07:49 +00:00
|
|
|
] ++ lib.optional includeEverything "-DINCLUDE_EVERYTHING=ON"
|
|
|
|
++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON";
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# fix libasound.so/libpulse.so not being found
|
|
|
|
preFixup = ''
|
2021-06-28 23:13:55 +00:00
|
|
|
${lib.optionalString alsaSupport "patchelf --add-needed ${alsa-lib}/lib/libasound.so $out/lib/libraylib.so.${version}"}
|
2021-03-09 03:18:52 +00:00
|
|
|
${lib.optionalString pulseSupport "patchelf --add-needed ${libpulseaudio}/lib/libpulse.so $out/lib/libraylib.so.${version}"}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A simple and easy-to-use library to enjoy videogames programming";
|
2021-08-05 21:33:18 +00:00
|
|
|
homepage = "https://www.raylib.com/";
|
2021-03-09 03:18:52 +00:00
|
|
|
license = licenses.zlib;
|
|
|
|
maintainers = with maintainers; [ adamlwgriffiths ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|