raylib-python-cffi: fix builds on darwin

This commit is contained in:
WeetHet
2024-08-29 11:16:31 +03:00
parent 01033afa0b
commit af241d4607
2 changed files with 46 additions and 9 deletions
@@ -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 = []