raylib: fix darwin builds (#337681)

This commit is contained in:
Mathew Polzin
2024-09-01 08:54:50 -05:00
committed by GitHub
3 changed files with 48 additions and 12 deletions
@@ -36,9 +36,8 @@ stdenv.mkDerivation (finalAttrs: {
};
nativeBuildInputs = [
autoPatchelfHook
cmake
];
] ++ lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ glfw ]
++ lib.optionals stdenv.isLinux [ mesa libXi libXcursor libXrandr libXinerama ]
@@ -71,7 +70,7 @@ stdenv.mkDerivation (finalAttrs: {
];
# fix libasound.so/libpulse.so not being found
appendRunpaths = [
appendRunpaths = lib.optionals stdenv.isLinux [
(lib.makeLibraryPath (lib.optional alsaSupport alsa-lib ++ lib.optional pulseSupport libpulseaudio))
];
@@ -1,4 +1,6 @@
{
stdenv,
gcc,
buildPythonPackage,
fetchFromGitHub,
setuptools,
@@ -9,9 +11,19 @@
raylib,
physac,
raygui,
lib
darwin,
lib,
}:
let
inherit (darwin.apple_sdk.frameworks)
OpenGL
Cocoa
IOKit
CoreFoundation
CoreVideo
;
in
buildPythonPackage rec {
pname = "raylib-python-cffi";
version = "5.0.0.2";
@@ -31,22 +43,36 @@ buildPythonPackage rec {
# This patch fixes to the builder script function to call pkg-config
# using the library name rather than searching only through raylib
./fix_pyray_builder.patch
# use get_lib_flags() instead of linking to libraylib.a directly
./fix_macos_raylib.patch
];
nativeBuildInputs = [ pkg-config ];
nativeBuildInputs = [
pkg-config
gcc
];
# tests require a graphic environment
doCheck = false;
pythonImportsCheck = [ "pyray" ];
buildInputs = [
glfw
libffi
raylib
physac
raygui
];
buildInputs =
[
glfw
libffi
raylib
physac
raygui
]
++ lib.optionals stdenv.isDarwin [
OpenGL
Cocoa
IOKit
CoreFoundation
CoreVideo
];
meta = {
description = "Python CFFI bindings for Raylib";
@@ -0,0 +1,11 @@
--- a/raylib/build.py
+++ b/raylib/build.py
@@ -158,7 +158,7 @@ def build_unix():
if platform.system() == "Darwin":
print("BUILDING FOR MAC")
- extra_link_args = [get_the_lib_path() + '/libraylib.a', '-framework', 'OpenGL', '-framework', 'Cocoa',
+ extra_link_args = get_lib_flags() + ['-framework', 'OpenGL', '-framework', 'Cocoa',
'-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework',
'CoreVideo']
libraries = []