summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7b9ce2747275b1ab8cf8ae2080963947c314fd7b (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Maintainer: éclairevoyant
# Contributor:  Vincent Grande (shoober420) <shoober420 at gmail dot com>
# Contributor: Jan Alexander Steffens (heftig) <heftig at archlinux dot org>
# Contributor: Jan de Groot <jgc at archlinux dot org>

_pkgbase=harfbuzz
pkgbase="$_pkgbase-git"
pkgname=(
  harfbuzz-git
  harfbuzz-cairo-git
  harfbuzz-icu-git
  harfbuzz-utils-git
  harfbuzz-docs-git
)
pkgver=8.0.1.r1.5a65ede5d
pkgrel=1
pkgdesc="OpenType text shaping engine"
url="https://www.freedesktop.org/wiki/Software/HarfBuzz"
arch=(x86_64)
license=(MIT)
makedepends=(
  cairo
  chafa
  freetype2
  git
  glib2
  gobject-introspection
  graphite
  gtk-doc
  icu
  meson
  python
  ragel
)
checkdepends=(
  python-fonttools
  python-setuptools
)
source=("git+https://github.com/harfbuzz/harfbuzz")
b2sums=('SKIP')

pkgver() {
  git -C $_pkgbase describe --long --tags | sed 's/^v//;s/\([^-]*-\)g/r\1/;s/-/./g'
}

build() {
  local meson_options=(
    -D graphite2=enabled
  )

  # Harfbuzz wants no exceptions
  CFLAGS="${CFLAGS/-fexceptions/}"
  CXXFLAGS="${CXXFLAGS/-fexceptions/}"

  arch-meson $_pkgbase build "${meson_options[@]}"
  meson compile -C build
}

check() {
  mkdir -p tmp
  TMPDIR="$PWD/tmp" meson test -C build --print-errorlogs
  rm -r tmp
}

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

package_harfbuzz-git() {
  depends=(
    libfreetype.so
    libgraphite2.so
    libg{lib,object}-2.0.so
  )
  optdepends=('harfbuzz-utils: utilities')
  provides=("harfbuzz=${pkgver%%-.r*}" libharfbuzz{,-subset,-gobject}.so)
  conflicts=(harfbuzz)

  meson install -C build --destdir "$pkgdir"

  ( cd "$pkgdir"

    _pick hb-cairo usr/lib/libharfbuzz-cairo*
    _pick hb-cairo usr/lib/pkgconfig/harfbuzz-cairo.pc
    _pick hb-cairo usr/include/harfbuzz/hb-cairo.h

    _pick hb-icu usr/lib/libharfbuzz-icu*
    _pick hb-icu usr/lib/pkgconfig/harfbuzz-icu.pc
    _pick hb-icu usr/include/harfbuzz/hb-icu.h

    _pick hb-utils usr/bin

    _pick hb-docs usr/share/gtk-doc
  )

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-cairo-git() {
  pkgdesc+=" - Cairo integration"
  depends=(
    libcairo.so
    libharfbuzz.so
  )
  provides=("harfbuzz-cairo=${pkgver%%-.r*}" libharfbuzz-cairo.so)
  conflicts=(harfbuzz-cairo)

  mv hb-cairo/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-icu-git() {
  pkgdesc+=" - ICU integration"
  depends=(
    libharfbuzz.so
    libicuuc.so
  )
  provides=("harfbuzz-icu=${pkgver%%-.r*}" libharfbuzz-icu.so)
  conflicts=(harfbuzz-icu)

  mv hb-icu/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-utils-git() {
  pkgdesc+=" - Utilities"
  depends=(
    harfbuzz
    harfbuzz-cairo
    libcairo.so
    libchafa.so
    libfreetype.so
    libglib-2.0.so
    libgobject-2.0.so
    libharfbuzz-cairo.so
    libharfbuzz-gobject.so
    libharfbuzz-subset.so
    libharfbuzz.so
  )
  provides=("harfbuzz-utils=${pkgver%%-.r*}")
  conflicts=(harfbuzz-utils)

  mv hb-utils/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-docs-git() {
  pkgdesc+=" - Documentation"
  depends=()
  provides=("harfbuzz-docs=${pkgver%%-.r*}")
  conflicts=(harfbuzz-docs)

  mv hb-docs/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}