2021-11-15 06:11:03 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, cmake,
|
2020-09-16 04:22:40 +02:00
|
|
|
mesa, libGLU, glfw,
|
|
|
|
libX11, libXi, libXcursor, libXrandr, libXinerama,
|
2021-06-10 04:57:09 +02:00
|
|
|
alsaSupport ? stdenv.hostPlatform.isLinux, alsa-lib,
|
2020-09-16 04:22:40 +02:00
|
|
|
pulseSupport ? stdenv.hostPlatform.isLinux, libpulseaudio,
|
2021-06-03 13:22:09 +02:00
|
|
|
sharedLib ? true,
|
2020-09-16 04:22:40 +02:00
|
|
|
includeEverything ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "raylib";
|
2021-11-15 06:11:03 +01:00
|
|
|
version = "4.0.0";
|
2020-09-16 04:22:40 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "raysan5";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2021-11-15 06:11:03 +01:00
|
|
|
sha256 = "1mszf5v7qy38cv1fisq6xd9smb765hylhkv1ms9y7shmdl2ni6b7";
|
2020-09-16 04:22:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [
|
|
|
|
mesa libGLU glfw libX11 libXi libXcursor libXrandr libXinerama
|
2021-06-10 04:57:09 +02:00
|
|
|
] ++ lib.optional alsaSupport alsa-lib
|
2020-09-16 04:22:40 +02:00
|
|
|
++ lib.optional pulseSupport libpulseaudio;
|
|
|
|
|
|
|
|
# https://github.com/raysan5/raylib/wiki/CMake-Build-Options
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_EXTERNAL_GLFW=ON"
|
|
|
|
"-DBUILD_EXAMPLES=OFF"
|
2021-06-03 13:22:09 +02:00
|
|
|
] ++ lib.optional includeEverything "-DINCLUDE_EVERYTHING=ON"
|
|
|
|
++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON";
|
2020-09-16 04:22:40 +02:00
|
|
|
|
|
|
|
# fix libasound.so/libpulse.so not being found
|
|
|
|
preFixup = ''
|
2021-06-10 04:57:09 +02:00
|
|
|
${lib.optionalString alsaSupport "patchelf --add-needed ${alsa-lib}/lib/libasound.so $out/lib/libraylib.so.${version}"}
|
2020-09-16 04:22:40 +02: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-07-31 19:01:50 +02:00
|
|
|
homepage = "https://www.raylib.com/";
|
2020-09-16 04:22:40 +02:00
|
|
|
license = licenses.zlib;
|
|
|
|
maintainers = with maintainers; [ adamlwgriffiths ];
|
|
|
|
platforms = platforms.linux;
|
2021-10-03 19:39:57 +02:00
|
|
|
changelog = "https://github.com/raysan5/raylib/blob/${version}/CHANGELOG";
|
2020-09-16 04:22:40 +02:00
|
|
|
};
|
|
|
|
}
|