summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c5d661074b6eeda47dafb7e5e00f0763b5913f2b (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
81
82
83
# Maintainer:
# Contributor: Michał Wojdyła < micwoj9292 at gmail dot com >
# Contributor: Fredrick R. Brennan <copypaste@kittens.ph>
# Contributor: nyorain <nyorain at gmail dot com>

pkgname=('skia-git')
pkgver=r73166.0b776ce0b8
pkgrel=1
pkgdesc="Chromiums high-performance rendering library"
arch=('x86_64')
url="https://github.com/google/skia"
license=('BSD')
depends=('zlib' 'libglvnd' 'freetype2' 'expat' 'libpng' 'libjpeg-turbo' 'fontconfig' 'harfbuzz' 'gcc-libs' 'libwebp' 'glibc')
makedepends=('git' 'rsync' 'python' 'procps-ng' 'ninja' 'depot-tools-git')
pkgver() {
    cd "$srcdir/skia"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

#TODO:
# skia-git W: ELF file ('usr/lib/libskia.so') lacks FULL RELRO, check LDFLAGS.
# use system gn
# try not to use rsync
# clean up package()
# recheck deps + makedeps

prepare() {
    # to make sure depot tools are in path
    cd "$srcdir"
    SRC_DIR="$(readlink -f "$srcdir")"
#    [ ! -d "/opt/depot_tools/.git" ] && {
#        tput bold
#        echo $'depot_tools not found, cloning just for this AUR build of Skia!!!\nSee https://aur.archlinux.org/packages/depot-tools-git#comment-941904'
#        tput sgr0
#        [ -d ./depot_tools ] && {
#            pushd depot_tools
#            git switch main
#            git pull
#            popd
#        } || {
#            git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
#        }
#    } || {
        rsync -Pa /opt/depot_tools/ "$SRC_DIR/depot_tools/"
#    }

    export PATH="$SRC_DIR/depot_tools:$PATH"

    #git config --global --add safe.directory /opt/depot_tools

    # download/sync skia
    cd "$srcdir"
    gclient config https://skia.googlesource.com/skia.git < <(yes)
    gclient sync < <(yes)
    gclient runhooks < <(yes)

    # generate the ninja build files using gn
    cd skia
    tools/git-sync-deps
    gn gen out/Debug --args='is_official_build=true is_component_build=true'
}

build() {
    cd skia
    export PATH="$srcdir/depot_tools:$PATH"
    ninja -C ./out/Debug
}

package() {
    local cxxfindheaders='-type f -and -( -name "*.h" -or -name "*.hh" -or -name "*.hpp" -or -name "*.hxx" -or -name "*.inc" -)'
    cd "$srcdir/skia"

    # License
    install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # Library
    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
}