1{ lib
2, stdenv
3, buildPythonPackage
4, cython
5, ninja
6, setuptools-scm
7, setuptools
8, fetchPypi
9, gn
10, pytestCheckHook
11, xcodebuild
12, ApplicationServices
13, OpenGL
14}:
15
16buildPythonPackage rec {
17 pname = "skia-pathops";
18 version = "0.7.2";
19
20 src = fetchPypi {
21 pname = "skia-pathops";
22 inherit version;
23 extension = "zip";
24 sha256 = "sha256-Gdhcmv77oVr5KxPIiJlk935jgvWPQsYEC0AZ6yjLppA=";
25 };
26
27 postPatch = ''
28 substituteInPlace setup.py \
29 --replace "build_cmd = [sys.executable, build_skia_py, build_dir]" \
30 'build_cmd = [sys.executable, build_skia_py, "--no-fetch-gn", "--no-virtualenv", "--gn-path", "${gn}/bin/gn", build_dir]'
31 '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
32 substituteInPlace src/cpp/skia-builder/skia/gn/skia/BUILD.gn \
33 --replace "-march=armv7-a" "-march=armv8-a" \
34 --replace "-mfpu=neon" "" \
35 --replace "-mthumb" ""
36 substituteInPlace src/cpp/skia-builder/skia/src/core/SkOpts.cpp \
37 --replace "defined(SK_CPU_ARM64)" "0"
38 '';
39
40 nativeBuildInputs = [ cython ninja setuptools-scm ]
41 ++ lib.optionals stdenv.isDarwin [ xcodebuild ];
42
43 buildInputs = lib.optionals stdenv.isDarwin [ ApplicationServices OpenGL ];
44
45 propagatedBuildInputs = [ setuptools ];
46
47 checkInputs = [ pytestCheckHook ];
48
49 pythonImportsCheck = [ "pathops" ];
50
51 meta = {
52 description = "Python access to operations on paths using the Skia library";
53 homepage = "https://skia.org/dev/present/pathops";
54 license = lib.licenses.bsd3;
55 maintainers = [ lib.maintainers.BarinovMaxim ];
56 };
57}