summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 35b5da74ff150cdd1b599aaeaac313243f663c2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Maintainer: Popolon <Popolon aL popolon.org>

pkgname=thorvg-git
pkgbase=thorvg-git
_pkgname=thorvg
pkgver=r3497.ebe4935d
pkgrel=3
pkgdesc="An open-source, lightweight, and portable library designed for rendering vector-based scenes and animations, including SVG and Lottie formats"
arch=('x86_64' 'aarch64' 'riscv32' 'riscv64' 'i386' 'i686' 'armv7h' 'armv6h' 'loong64' 'powerpc' 'powerpc64le' 'powerpc64')
url="https://www.thorvg.org/"
license=('MIT')
depends=('libpng' 'libjpeg' 'libwebp' 'mesa' 'libx11')
makedepends=('meson' 'ninja')
source=("${_pkgname}::git+https://github.com/${_pkgname}/${_pkgname}.git")
sha256sums=(SKIP)

pkgver() {
    cd "${_pkgname}/"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd ${_pkgname}
    meson setup builddir --prefix=/usr \
      -Dengines=sw,gl \
      -Dsimd=true \
      -Dloaders=all \
      -Dsavers=all \
      -Dbindings="capi" \
      -Dtools=all \
      --reconfigure
}

build() {
    cd ${_pkgname}
    ninja -C builddir
}

_package() {
conflicts=('thorvg')
provides=('thorvg')
    pkgdesc="An open-source, lightweight, and portable library designed for rendering vector-based scenes and animations, including SVG and Lottie formats"
    cd ${_pkgname}
    install -Dm644 LICENSE -t ${pkgdir}/usr/share/licenses/${pkgbase}/
    DESTDIR="$pkgdir/" ninja -C builddir install
}

_package-examples() {
depends=('sdl2' 'thorvg-git')
conflicts=('thorvg-examples')
provides=('thorvg-examples')

    pkgdesc="Examples for ${pkgbase} ${pkgdesc}"
    cd ${_pkgname}
    sed -i 's|DEXAMPLE_DIR="@0@|DEXAMPLE_DIR="/usr/share/doc/thorvg-git|' meson.build
    meson setup builddir --prefix=/usr \
      -Dexamples=true \
      -Dsimd=true \
      -Dengines=sw,gl \
      -Dloaders=all \
      -Dsavers=all \
      -Dbindings="capi" \
      -Dtools=all \
    ninja -C builddir

    mkdir -p ${pkgdir}/usr/share/doc/${pkgbase}
    cp -a builddir/examples ${pkgdir}/usr/share/doc/${pkgbase}/
    cp -a examples ${pkgdir}/usr/share/doc/${pkgbase}/
}

pkgname=(
 "${pkgbase}"
 "${pkgbase}-examples"
)
for _p in "${pkgname[@]}"; do
   eval "package_$_p() {
     $(declare -f "_package${_p#$pkgbase}")
     _package${_p#$pkgbase}
   }"
done