2023-11-16 04:20:00 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, fetchpatch
|
|
|
|
, mesa
|
|
|
|
, libGLU
|
|
|
|
, glfw
|
|
|
|
, libX11
|
|
|
|
, libXi
|
|
|
|
, libXcursor
|
|
|
|
, libXrandr
|
|
|
|
, libXinerama
|
|
|
|
, alsaSupport ? stdenv.hostPlatform.isLinux
|
|
|
|
, alsa-lib
|
|
|
|
, pulseSupport ? stdenv.hostPlatform.isLinux
|
|
|
|
, libpulseaudio
|
2022-09-09 14:08:57 +00:00
|
|
|
, sharedLib ? true
|
|
|
|
, includeEverything ? true
|
2022-11-02 22:02:43 +00:00
|
|
|
, raylib-games
|
2023-11-16 04:20:00 +00:00
|
|
|
, darwin
|
2024-07-27 06:49:29 +00:00
|
|
|
, autoPatchelfHook
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
2023-11-16 04:20:00 +00:00
|
|
|
let
|
|
|
|
inherit (darwin.apple_sdk.frameworks) Carbon Cocoa OpenGL;
|
|
|
|
in
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-03-09 03:18:52 +00:00
|
|
|
pname = "raylib";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "5.0";
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "raysan5";
|
2023-07-15 17:15:38 +00:00
|
|
|
repo = "raylib";
|
|
|
|
rev = finalAttrs.version;
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-gEstNs3huQ1uikVXOW4uoYnIDr5l8O9jgZRTX1mkRww=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
|
2022-11-02 22:02:43 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [ glfw ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ mesa libXi libXcursor libXrandr libXinerama ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ Carbon Cocoa ]
|
2023-11-16 04:20:00 +00:00
|
|
|
++ lib.optional alsaSupport alsa-lib
|
2021-03-09 03:18:52 +00:00
|
|
|
++ lib.optional pulseSupport libpulseaudio;
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libGLU libX11 ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenGL ];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# https://github.com/raysan5/raylib/wiki/CMake-Build-Options
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_EXTERNAL_GLFW=ON"
|
|
|
|
"-DBUILD_EXAMPLES=OFF"
|
2022-09-09 14:08:57 +00:00
|
|
|
"-DCUSTOMIZE_BUILD=1"
|
2021-06-04 09:07:49 +00:00
|
|
|
] ++ lib.optional includeEverything "-DINCLUDE_EVERYTHING=ON"
|
2023-11-16 04:20:00 +00:00
|
|
|
++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON";
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
passthru.tests = [ raylib-games ];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
patches = [
|
2024-04-21 15:54:59 +00:00
|
|
|
# Patch version in CMakeLists.txt to 5.0.0
|
|
|
|
# The library author doesn't use cmake, so when updating this package please
|
2024-07-27 06:49:29 +00:00
|
|
|
# check that the resulting library extension matches the package version
|
|
|
|
# and remove/update this patch
|
2023-08-04 22:07:22 +00:00
|
|
|
(fetchpatch {
|
2024-04-21 15:54:59 +00:00
|
|
|
url = "https://github.com/raysan5/raylib/commit/032cc497ca5aaca862dc926a93c2a45ed8017737.patch";
|
|
|
|
hash = "sha256-qsX5AwyQaGoRsbdszOO7tUF9dR+AkEFi4ebNkBVHNEY=";
|
2023-08-04 22:07:22 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# fix libasound.so/libpulse.so not being found
|
2024-09-26 11:04:55 +00:00
|
|
|
appendRunpaths = lib.optionals stdenv.hostPlatform.isLinux [
|
2024-07-27 06:49:29 +00:00
|
|
|
(lib.makeLibraryPath (lib.optional alsaSupport alsa-lib ++ lib.optional pulseSupport libpulseaudio))
|
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "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;
|
2024-07-31 10:19:44 +00:00
|
|
|
maintainers = [ ];
|
2023-11-16 04:20:00 +00:00
|
|
|
platforms = platforms.all;
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/raysan5/raylib/blob/${finalAttrs.version}/CHANGELOG";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|