forked from mirrors/nixpkgs
raylib: support macOS
This commit is contained in:
parent
664ecf4f04
commit
3dd6060ab5
|
@ -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";
|
||||
};
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue