1{
2 stdenv,
3 gcc,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7 cffi,
8 pkg-config,
9 glfw,
10 libffi,
11 raylib,
12 physac,
13 raygui,
14 darwin,
15 lib,
16}:
17
18let
19 inherit (darwin.apple_sdk.frameworks)
20 OpenGL
21 Cocoa
22 IOKit
23 CoreFoundation
24 CoreVideo
25 ;
26in
27buildPythonPackage rec {
28 pname = "raylib-python-cffi";
29 version = "5.0.0.3";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "electronstudio";
34 repo = "raylib-python-cffi";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-R/w39zYkoOF5JqHDyqVIdON9yXFo2PeosyEQZOd4aYo=";
37 };
38
39 build-system = [ setuptools ];
40 dependencies = [ cffi ];
41
42 patches = [
43 # This patch fixes to the builder script function to call pkg-config
44 # using the library name rather than searching only through raylib
45 ./fix_pyray_builder.patch
46
47 # use get_lib_flags() instead of linking to libraylib.a directly
48 ./fix_macos_raylib.patch
49 ];
50
51 nativeBuildInputs = [
52 pkg-config
53 gcc
54 ];
55
56 # tests require a graphic environment
57 doCheck = false;
58
59 pythonImportsCheck = [ "pyray" ];
60
61 buildInputs =
62 [
63 glfw
64 libffi
65 raylib
66 physac
67 raygui
68 ]
69 ++ lib.optionals stdenv.hostPlatform.isDarwin [
70 OpenGL
71 Cocoa
72 IOKit
73 CoreFoundation
74 CoreVideo
75 ];
76
77 meta = {
78 description = "Python CFFI bindings for Raylib";
79 homepage = "https://electronstudio.github.io/raylib-python-cffi";
80 license = lib.licenses.epl20;
81 maintainers = with lib.maintainers; [ sigmanificient ];
82 };
83}