Merge pull request #141434 from bmwalters/kivy-darwin
python3Packages.kivy: add darwin support
This commit is contained in:
commit
7dba0602cf
2 changed files with 38 additions and 15 deletions
|
@ -1,8 +1,11 @@
|
|||
{ lib
|
||||
, buildPythonPackage, fetchPypi
|
||||
{ lib, stdenv
|
||||
, buildPythonPackage, fetchFromGitHub, fetchpatch
|
||||
, pkg-config, cython, docutils
|
||||
, kivy-garden
|
||||
, mesa, mtdev, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, gst_all_1
|
||||
, mesa, mtdev, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer
|
||||
, ApplicationServices, AVFoundation, libcxx
|
||||
, withGstreamer ? true
|
||||
, gst_all_1
|
||||
, pillow, requests, pygments
|
||||
}:
|
||||
|
||||
|
@ -10,11 +13,21 @@ buildPythonPackage rec {
|
|||
pname = "Kivy";
|
||||
version = "2.0.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "1n0j9046vgjncy50v06r3wcg3q2l37jp8n0cznr64dz48kml8pnj";
|
||||
# use github since pypi line endings are CRLF and patches do not apply
|
||||
src = fetchFromGitHub {
|
||||
owner = "kivy";
|
||||
repo = "kivy";
|
||||
rev = version;
|
||||
sha256 = "sha256-/7GSVQUkYSBEnLVBizMnZAZZxvXVN4r4lskyOgLEcew=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/kivy/kivy/commit/1c0656c4472817677cf3b08be504de9ca6b1713f.patch";
|
||||
sha256 = "sha256-phAjMaC3LQuvufwiD0qXzie5B+kezCf8FpKeQMhy/ms=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
cython
|
||||
|
@ -22,19 +35,24 @@ buildPythonPackage rec {
|
|||
];
|
||||
|
||||
buildInputs = [
|
||||
mesa
|
||||
mtdev
|
||||
SDL2
|
||||
SDL2_image
|
||||
SDL2_ttf
|
||||
SDL2_mixer
|
||||
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
mesa
|
||||
mtdev
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
ApplicationServices
|
||||
AVFoundation
|
||||
libcxx
|
||||
] ++ lib.optionals withGstreamer (with gst_all_1; [
|
||||
# NOTE: The degree to which gstreamer actually works is unclear
|
||||
gst_all_1.gstreamer
|
||||
gst_all_1.gst-plugins-base
|
||||
gst_all_1.gst-plugins-good
|
||||
gst_all_1.gst-plugins-bad
|
||||
];
|
||||
gstreamer
|
||||
gst-plugins-base
|
||||
gst-plugins-good
|
||||
gst-plugins-bad
|
||||
]);
|
||||
|
||||
propagatedBuildInputs = [
|
||||
kivy-garden
|
||||
|
@ -46,8 +64,12 @@ buildPythonPackage rec {
|
|||
KIVY_NO_CONFIG = 1;
|
||||
KIVY_NO_ARGS = 1;
|
||||
KIVY_NO_FILELOG = 1;
|
||||
# prefer pkg-config over hardcoded framework paths
|
||||
USE_OSX_FRAMEWORKS = 0;
|
||||
# work around python distutils compiling C++ with $CC (see issue #26709)
|
||||
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
|
||||
|
||||
postPatch = ''
|
||||
postPatch = lib.optionalString stdenv.isLinux ''
|
||||
substituteInPlace kivy/lib/mtdev.py \
|
||||
--replace "LoadLibrary('libmtdev.so.1')" "LoadLibrary('${mtdev}/lib/libmtdev.so.1')"
|
||||
'';
|
||||
|
|
|
@ -4105,6 +4105,7 @@ in {
|
|||
|
||||
kivy = callPackage ../development/python-modules/kivy {
|
||||
inherit (pkgs) mesa;
|
||||
inherit (pkgs.darwin.apple_sdk.frameworks) ApplicationServices AVFoundation;
|
||||
};
|
||||
|
||||
kivy-garden = callPackage ../development/python-modules/kivy-garden { };
|
||||
|
|
Loading…
Reference in a new issue