• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kivy / python-for-android / 25935589014

15 May 2026 06:51PM UTC coverage: 62.6% (-0.06%) from 62.661%
25935589014

Pull #3288

github

web-flow
Merge e6692e15f into 9344dc154
Pull Request #3288: `recipes`: add `thorvg`

1818 of 3177 branches covered (57.22%)

Branch coverage included in aggregate %.

35 of 63 new or added lines in 4 files covered. (55.56%)

5376 of 8315 relevant lines covered (64.65%)

3.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.37
/pythonforandroid/recipes/libthorvg/__init__.py
1
from pythonforandroid.recipe import Recipe, MesonRecipe
6✔
2
from os.path import join
6✔
3
from pythonforandroid.util import ensure_dir, current_directory
6✔
4
from pythonforandroid.logger import shprint
6✔
5
from multiprocessing import cpu_count
6✔
6
from glob import glob
6✔
7
import sh
6✔
8

9

10
class LibThorVGRecipe(MesonRecipe):
6✔
11
    name = "libthorvg"
6✔
12
    version = "1.0.5"
6✔
13
    url = "https://github.com/thorvg/thorvg/archive/refs/tags/v{version}.tar.gz"
6✔
14
    config_otps = [
6✔
15
        "-Dsimd=true",
16
        "-Dbindings=capi",
17
        "-Dtools=all",
18
        "-Dengines=cpu,gl",
19
        "-Dloaders=svg,png,jpg,ttf,webp",
20
        "-Dextra=opengl_es,lottie_exp,openmp",
21
    ]
22
    need_stl_shared = True
6✔
23
    skip_python = True
6✔
24
    depends = ["png", "libwebp", "jpeg"]
6✔
25
    patches = ["meson.patch"]
6✔
26
    bins = ["tvg-lottie2gif", "tvg-svg2png"]
6✔
27
    built_libraries = {
6✔
28
        "libthorvg-1.so": "install/lib",
29
        "libomp.so": "install/lib"
30
    }
31
    for bin in bins:
6✔
32
        built_libraries[f"lib{bin}bin.so"] = "install/bin"
6✔
33

34
    def should_build(self, arch):
6✔
NEW
35
        return Recipe.should_build(self, arch)
×
36

37
    def get_include_dir(self, arch):
6✔
NEW
38
        return join(self.get_build_dir(arch.arch), "install", "include")
×
39

40
    def build_arch(self, arch):
6✔
NEW
41
        super().build_arch(arch)
×
NEW
42
        build_dir = self.get_build_dir(arch.arch)
×
NEW
43
        install_dir = join(build_dir, "install")
×
NEW
44
        ensure_dir(install_dir)
×
NEW
45
        env = self.get_recipe_env(arch)
×
46

NEW
47
        lib_dir = self.ctx.get_libs_dir(arch.arch)
×
NEW
48
        png_include = self.get_recipe("png", self.ctx).get_build_dir(arch.arch)
×
NEW
49
        webp_include = join(
×
50
            self.get_recipe("libwebp", self.ctx).get_build_dir(arch.arch), "src"
51
        )
NEW
52
        jpg_dir = self.get_recipe("jpeg", self.ctx).get_build_dir(arch.arch)
×
53

NEW
54
        with current_directory(build_dir):
×
55

NEW
56
            shprint(
×
57
                sh.meson,
58
                "setup",
59
                "builddir",
60
                "--cross-file",
61
                join("/tmp", "android.meson.cross"),
62
                f"--prefix={install_dir}",
63
                # config opts
64
                *self.config_otps,
65
                # deps
66
                f"-Dpng_include_dir={png_include}",
67
                f"-Dpng_lib_dir={lib_dir}",
68
                f"-Dwebp_include_dir={webp_include}",
69
                f"-Dwebp_lib_dir={lib_dir}",
70
                f"-Djpg_include_dir={jpg_dir}",
71
                f"-Djpg_lib_dir={jpg_dir}",
72
                _env=env,
73
            )
74

NEW
75
            shprint(sh.ninja, "-C", "builddir", "-j", str(cpu_count()), _env=env)
×
NEW
76
            shprint(sh.rm, "-rf", install_dir)
×
NEW
77
            shprint(sh.mkdir, install_dir)
×
NEW
78
            shprint(sh.ninja, "-C", "builddir", "install", _env=env)
×
79

80
            # copy libomp.so
NEW
81
            arch_map = {
×
82
                "arm64-v8a": "aarch64",
83
                "armeabi-v7a": "arm",
84
                "x86": "i386",
85
                "x86_64": "x86_64",
86
            }
NEW
87
            lib_arch = arch_map[arch.arch]
×
88
            # clang version directory is variable, so glob it
NEW
89
            pattern = join(self.ctx.ndk.llvm_prebuilt_dir, "lib/clang/*/lib/linux", lib_arch)
×
NEW
90
            clang_lib_dir = glob(pattern)[0]
×
NEW
91
            libomp = join(clang_lib_dir, "libomp.so")
×
NEW
92
            shprint(sh.cp, libomp, join("install", "lib"))
×
93

94
            # setup bins
NEW
95
            bin_dir = join("install", "bin")
×
NEW
96
            for bin in self.bins:
×
NEW
97
                shprint(sh.cp, join(bin_dir, bin), join(bin_dir, f"lib{bin}bin.so"))
×
98

99

100
recipe = LibThorVGRecipe()
6✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc