diff options
-rw-r--r-- | pkgs/development/libraries/raylib/default.nix | 42 | ||||
-rw-r--r-- | pkgs/games/raylib-games/default.nix | 8 |
2 files changed, 36 insertions, 14 deletions
diff --git a/pkgs/development/libraries/raylib/default.nix b/pkgs/development/libraries/raylib/default.nix index 5af34139f930c..e655645cd866d 100644 --- a/pkgs/development/libraries/raylib/default.nix +++ b/pkgs/development/libraries/raylib/default.nix @@ -1,13 +1,28 @@ -{ stdenv, lib, fetchFromGitHub, cmake, fetchpatch -, mesa, libGLU, glfw -, libX11, libXi, libXcursor, libXrandr, libXinerama -, alsaSupport ? stdenv.hostPlatform.isLinux, alsa-lib -, pulseSupport ? stdenv.hostPlatform.isLinux, libpulseaudio +{ 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 +, darwin }: - +let + inherit (darwin.apple_sdk.frameworks) Carbon Cocoa OpenGL; +in stdenv.mkDerivation (finalAttrs: { pname = "raylib"; version = "4.5.0"; @@ -21,11 +36,14 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake ]; - buildInputs = [ - mesa glfw libXi libXcursor libXrandr libXinerama - ] ++ lib.optional alsaSupport alsa-lib + buildInputs = [ glfw ] + ++ lib.optionals stdenv.isLinux [ mesa libXi libXcursor libXrandr libXinerama ] + ++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ] + ++ lib.optional alsaSupport alsa-lib ++ lib.optional pulseSupport libpulseaudio; - propagatedBuildInputs = [ libGLU libX11 ]; + + propagatedBuildInputs = lib.optionals stdenv.isLinux [ libGLU libX11 ] + ++ lib.optionals stdenv.isDarwin [ OpenGL ]; # https://github.com/raysan5/raylib/wiki/CMake-Build-Options cmakeFlags = [ @@ -33,7 +51,7 @@ stdenv.mkDerivation (finalAttrs: { "-DBUILD_EXAMPLES=OFF" "-DCUSTOMIZE_BUILD=1" ] ++ lib.optional includeEverything "-DINCLUDE_EVERYTHING=ON" - ++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON"; + ++ lib.optional sharedLib "-DBUILD_SHARED_LIBS=ON"; passthru.tests = [ raylib-games ]; @@ -57,7 +75,7 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://www.raylib.com/"; license = licenses.zlib; maintainers = with maintainers; [ adamlwgriffiths ]; - platforms = platforms.linux; + platforms = platforms.all; changelog = "https://github.com/raysan5/raylib/blob/${finalAttrs.version}/CHANGELOG"; }; }) diff --git a/pkgs/games/raylib-games/default.nix b/pkgs/games/raylib-games/default.nix index 6cb2b540f4abc..34ef5c8014356 100644 --- a/pkgs/games/raylib-games/default.nix +++ b/pkgs/games/raylib-games/default.nix @@ -1,5 +1,8 @@ -{ lib, stdenv, fetchFromGitHub, raylib }: +{ lib, stdenv, fetchFromGitHub, raylib, darwin }: +let + inherit (darwin.apple_sdk.frameworks) Cocoa; +in stdenv.mkDerivation rec { pname = "raylib-games"; version = "2022-10-24"; @@ -11,7 +14,8 @@ stdenv.mkDerivation rec { hash = "sha256-N9ip8yFUqXmNMKcvQuOyxDI4yF/w1YaoIh0prvS4Xr4="; }; - buildInputs = [ raylib ]; + buildInputs = [ raylib ] + ++ lib.optionals stdenv.isDarwin [ Cocoa ]; configurePhase = '' runHook preConfigure |