at 23.05-pre 2.3 kB view raw
1{ lib, stdenv 2, buildPythonPackage, fetchFromGitHub, fetchpatch 3, pkg-config, cython, docutils 4, kivy-garden 5, mesa, mtdev, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer 6, ApplicationServices, AVFoundation, libcxx 7, withGstreamer ? true 8, gst_all_1 9, pillow, requests, pygments 10}: 11 12buildPythonPackage rec { 13 pname = "Kivy"; 14 version = "2.0.0"; 15 16 # use github since pypi line endings are CRLF and patches do not apply 17 src = fetchFromGitHub { 18 owner = "kivy"; 19 repo = "kivy"; 20 rev = version; 21 sha256 = "sha256-/7GSVQUkYSBEnLVBizMnZAZZxvXVN4r4lskyOgLEcew="; 22 }; 23 24 patches = [ 25 (fetchpatch { 26 url = "https://github.com/kivy/kivy/commit/1c0656c4472817677cf3b08be504de9ca6b1713f.patch"; 27 sha256 = "sha256-phAjMaC3LQuvufwiD0qXzie5B+kezCf8FpKeQMhy/ms="; 28 }) 29 ]; 30 31 nativeBuildInputs = [ 32 pkg-config 33 cython 34 docutils 35 ]; 36 37 buildInputs = [ 38 SDL2 39 SDL2_image 40 SDL2_ttf 41 SDL2_mixer 42 ] ++ lib.optionals stdenv.isLinux [ 43 mesa 44 mtdev 45 ] ++ lib.optionals stdenv.isDarwin [ 46 ApplicationServices 47 AVFoundation 48 libcxx 49 ] ++ lib.optionals withGstreamer (with gst_all_1; [ 50 # NOTE: The degree to which gstreamer actually works is unclear 51 gstreamer 52 gst-plugins-base 53 gst-plugins-good 54 gst-plugins-bad 55 ]); 56 57 propagatedBuildInputs = [ 58 kivy-garden 59 pillow 60 pygments 61 requests 62 ]; 63 64 KIVY_NO_CONFIG = 1; 65 KIVY_NO_ARGS = 1; 66 KIVY_NO_FILELOG = 1; 67 # prefer pkg-config over hardcoded framework paths 68 USE_OSX_FRAMEWORKS = 0; 69 # work around python distutils compiling C++ with $CC (see issue #26709) 70 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1"; 71 72 postPatch = lib.optionalString stdenv.isLinux '' 73 substituteInPlace kivy/lib/mtdev.py \ 74 --replace "LoadLibrary('libmtdev.so.1')" "LoadLibrary('${mtdev}/lib/libmtdev.so.1')" 75 ''; 76 77 /* 78 We cannot run tests as Kivy tries to import itself before being fully 79 installed. 80 */ 81 doCheck = false; 82 pythonImportsCheck = [ "kivy" ]; 83 84 meta = with lib; { 85 description = "Library for rapid development of hardware-accelerated multitouch applications."; 86 homepage = "https://pypi.python.org/pypi/kivy"; 87 license = licenses.mit; 88 maintainers = with maintainers; [ risson ]; 89 }; 90}