Skip to content

[python-skia-pathops] Build from source, don't use wheel #68

@micwoj92

Description

@micwoj92

Let’s just say trying to build skia from source (while following Arch package guidelines) is shit. ;)
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-skia-pathops#n20
I took skia-git PKGBUILD and modified it to output shared library, this also results in not building examples but I don’t need these anyway for this python package:

@@ -51,7 +52,7 @@ prepare() {
     # generate the ninja build files using gn
     cd skia
     tools/git-sync-deps
-    gn gen out/Debug
+    gn gen out/Debug --args='is_official_build=true is_component_build=true'
 }
 
 build() {
@@ -68,31 +69,15 @@ package_skia-git() {
     install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 
     # Static library
-    install -D -m644 out/Debug/libskia.a "$pkgdir/usr/lib/libskia.a"
+    install -D -m644 out/Debug/libskia.so "$pkgdir/usr/lib/libskia.so"
 
     # Headers
     find include $cxxfindheaders \
         -exec install -v -D -m644 {} "$pkgdir/usr/include/skia/"{} \; -print
 
-    # Headers (generated)
-    pushd out/Debug
-    pushd gen
-    find . $cxxfindheaders \
-        -exec install -v -D -m644 {} "$pkgdir/usr/include/skia/"{} \; -print

PKGBUILD I used for package:

pkgname=python-skia-pathops
_pkgname=${pkgname#python-}
pkgver=0.8.0.post1
pkgrel=1
pkgdesc='Python bindings for the Skia library’s Path Ops (wheel)'
arch=(x86_64)
url="https://github.com/fonttools/$_pkgname"
license=(BSD)
depends=(python skia-git)
makedepends=(cython python-setuptools-scm)
checkdepends=(python-pytest)
options=(!strip)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.zip")
sha256sums=('a056249de2f61fa55116b9ee55513c6a36b878aee00c91450e404d1606485cbb')

build() {
    cd "$_pkgname-$pkgver"
    BUILD_SKIA_FROM_SOURCE=0 python setup.py build
    python setup.py build_ext --inplace
}

check() {
    cd "$_pkgname-$pkgver"
    PYTHONPATH="src/python" pytest
}

package() {
    cd "$_pkgname-$pkgver"
    python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}

I did not try building anything against this yet, but all checks pass.
I guess todo is to move to PEP517 system, but the biggest roadblock is to package skia properly. Current skia-git package is static library build and there is not "stable" package nor I could find easy way to get skia releases other than tracking chromium releases and use skia from that.

I'm posting it here instead of AUR comments because i think it would spam these too much.

I hope this rambling helps at least a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions