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

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

79 lines
2.2 KiB
Nix
Raw Normal View History

2023-10-27 21:42:51 +03: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
, sharedLib ? true
, includeEverything ? true
, raylib-games
2023-10-27 21:42:51 +03:00
, darwin
2020-09-16 05:22:40 +03:00
}:
2023-10-27 21:42:51 +03:00
let
inherit (darwin.apple_sdk.frameworks) Carbon Cocoa OpenGL;
in
2023-07-13 00:58:25 +03:00
stdenv.mkDerivation (finalAttrs: {
2020-09-16 05:22:40 +03:00
pname = "raylib";
version = "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-gEstNs3huQ1uikVXOW4uoYnIDr5l8O9jgZRTX1mkRww=";
2020-09-16 05:22:40 +03:00
};
nativeBuildInputs = [ cmake ];
2022-10-24 04:15:48 +03:00
2023-10-27 21:42:51 +03:00
buildInputs = [ glfw ]
++ lib.optionals stdenv.isLinux [ mesa libXi libXcursor libXrandr libXinerama ]
++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ]
++ lib.optional alsaSupport alsa-lib
2020-09-16 05:22:40 +03:00
++ lib.optional pulseSupport libpulseaudio;
2023-10-27 21:42:51 +03:00
propagatedBuildInputs = lib.optionals stdenv.isLinux [ libGLU libX11 ]
++ lib.optionals stdenv.isDarwin [ OpenGL ];
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"
2023-10-27 21:42:51 +03:00
++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON";
2020-09-16 05:22:40 +03:00
passthru.tests = [ raylib-games ];
patches = [
# Patch version in CMakeLists.txt to 5.0.0
# The library author doesn't use cmake, so when updating this package please
# check that the resulting library extension matches the version
# and remove/update this patch (resulting library name should match
# libraylib.so.${finalAttrs.version}
(fetchpatch {
url = "https://github.com/raysan5/raylib/commit/032cc497ca5aaca862dc926a93c2a45ed8017737.patch";
hash = "sha256-qsX5AwyQaGoRsbdszOO7tUF9dR+AkEFi4ebNkBVHNEY=";
})
];
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 ];
2023-10-27 21:42:51 +03:00
platforms = platforms.all;
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
})