summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6df90cf7b6e11440bda91c8e8a982f30232f85c9 (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
# Maintainer: nyorain <nyorain at gmail dot com>
pkgname=skia-git 
pkgver=r24473.1818701
pkgrel=1
pkgdesc="Chromiums high-performance rendering library (static)"
arch=('any')
url="https://github.com/google/skia"
license=('BSD')
depends=('mesa' 'libgl')
makedepends=('git' 'ninja' 'depot-tools-git' 'python2' 'gcc' 'gn')
source=()
md5sums=()

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

prepare() {
	# to make sure depot tools are in path
	if [[ ! ":$PATH:" == *":/opt/depot_tools:"* ]]; then
		export PATH=$PATH:/opt/depot_tools
	fi

	# download/sync skia
	cd "$srcdir"
	gclient config --unmanaged https://skia.googlesource.com/skia.git
	gclient sync

	# make python2 default python
	mkdir -p .pkgbuild-bin 
	ln -sf /usr/bin/python2-config .pkgbuild-bin/python-config 
	ln -sf /usr/bin/python2 .pkgbuild-bin/python
	export PATH="$srcdir/.pkgbuild-bin":$PATH

	# generate the ninja build files using gn
	cd skia
	mkdir -p out
	gn gen out/Debug
}

build() {
	cd skia
	ninja -C ./out/Debug
}

package() {
	cd "$srcdir/skia"
	mkdir -p "$pkgdir/usr/include/skia"

	install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	install -D -m644 out/Debug/libskia.a "$pkgdir/usr/lib/libskia.a"
	cp -dpr --no-preserve=ownership ./include/* "$pkgdir/usr/include/skia"

	# needs some kind of modification or must be copied to skia/folder/folder/folder
	# install -D -m644 out/Debug/gen/skia.h "$pkgdir/usr/include/skia/skia.h"
}