0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-19 08:31:01 +03:00
nixpkgs/pkgs/development/python-modules/raylib-python-cffi/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

83 lines
1.5 KiB
Nix

{
stdenv,
gcc,
buildPythonPackage,
fetchFromGitHub,
setuptools,
cffi,
pkg-config,
glfw,
libffi,
raylib,
physac,
raygui,
darwin,
lib,
}:
let
inherit (darwin.apple_sdk.frameworks)
OpenGL
Cocoa
IOKit
CoreFoundation
CoreVideo
;
in
buildPythonPackage rec {
pname = "raylib-python-cffi";
version = "5.0.0.3";
pyproject = true;
src = fetchFromGitHub {
owner = "electronstudio";
repo = "raylib-python-cffi";
rev = "refs/tags/v${version}";
hash = "sha256-R/w39zYkoOF5JqHDyqVIdON9yXFo2PeosyEQZOd4aYo=";
};
build-system = [ setuptools ];
dependencies = [ cffi ];
patches = [
# 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
gcc
];
# tests require a graphic environment
doCheck = false;
pythonImportsCheck = [ "pyray" ];
buildInputs =
[
glfw
libffi
raylib
physac
raygui
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
OpenGL
Cocoa
IOKit
CoreFoundation
CoreVideo
];
meta = {
description = "Python CFFI bindings for Raylib";
homepage = "https://electronstudio.github.io/raylib-python-cffi";
license = lib.licenses.epl20;
maintainers = with lib.maintainers; [ sigmanificient ];
};
}