Commit af241d46 authored by WeetHet's avatar WeetHet
Browse files

raylib-python-cffi: fix builds on darwin

parent 01033afa
Loading
Loading
Loading
Loading
+35 −9
Original line number Diff line number Diff line
{
  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,21 +43,35 @@ 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 = [
  buildInputs =
    [
      glfw
      libffi
      raylib
      physac
      raygui
    ]
    ++ lib.optionals stdenv.isDarwin [
      OpenGL
      Cocoa
      IOKit
      CoreFoundation
      CoreVideo
    ];

  meta = {
+11 −0
Original line number Diff line number Diff line
--- 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 = []