1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 cython, 6 isPyPy, 7 ninja, 8 setuptools-scm, 9 setuptools, 10 fetchPypi, 11 gn, 12 pytestCheckHook, 13 cctools, 14 xcodebuild, 15}: 16 17buildPythonPackage rec { 18 pname = "skia-pathops"; 19 version = "0.8.0.post2"; 20 pyproject = true; 21 22 src = fetchPypi { 23 pname = "skia_pathops"; 24 inherit version; 25 extension = "zip"; 26 hash = "sha256-niUs3rbE0WLoKYbTHb2JxnXRZ3y4AZwuE+YpXUpVcmk="; 27 }; 28 29 postPatch = '' 30 substituteInPlace setup.py \ 31 --replace "build_cmd = [sys.executable, build_skia_py, build_dir]" \ 32 'build_cmd = [sys.executable, build_skia_py, "--no-fetch-gn", "--no-virtualenv", "--gn-path", "${gn}/bin/gn", build_dir]' 33 '' 34 + lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) '' 35 substituteInPlace src/cpp/skia-builder/skia/gn/skia/BUILD.gn \ 36 --replace "-march=armv7-a" "-march=armv8-a" \ 37 --replace "-mfpu=neon" "" \ 38 --replace "-mthumb" "" 39 substituteInPlace src/cpp/skia-builder/skia/src/core/SkOpts.cpp \ 40 --replace "defined(SK_CPU_ARM64)" "0" 41 '' 42 + 43 lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) # old compiler? 44 '' 45 patch -p1 <<EOF 46 --- a/src/cpp/skia-builder/skia/include/private/base/SkTArray.h 47 +++ b/src/cpp/skia-builder/skia/include/private/base/SkTArray.h 48 @@ -492 +492 @@: 49 - static constexpr int kMaxCapacity = SkToInt(std::min(SIZE_MAX / sizeof(T), (size_t)INT_MAX)); 50 + static constexpr int kMaxCapacity = SkToInt(std::min<size_t>(SIZE_MAX / sizeof(T), (size_t)INT_MAX)); 51 EOF 52 ''; 53 54 build-system = [ 55 cython 56 setuptools 57 setuptools-scm 58 ]; 59 60 nativeBuildInputs = [ 61 ninja 62 ] 63 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 64 cctools.libtool 65 xcodebuild 66 ]; 67 68 nativeCheckInputs = [ pytestCheckHook ]; 69 70 pythonImportsCheck = [ "pathops" ]; 71 72 meta = { 73 description = "Python access to operations on paths using the Skia library"; 74 homepage = "https://github.com/fonttools/skia-pathops"; 75 license = lib.licenses.bsd3; 76 maintainers = [ lib.maintainers.BarinovMaxim ]; 77 # "The Skia team is not endian-savvy enough to support big-endian CPUs." 78 badPlatforms = lib.platforms.bigEndian; 79 # ERROR at //gn/BUILDCONFIG.gn:87:14: Script returned non-zero exit code. 80 broken = isPyPy; 81 }; 82}