summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1b4e286625ff79855b61cecd0c2b30e43994e5f3 (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
166
167
168
169
# Maintainer:

_pkgbase="vte"
pkgbase="$_pkgbase-git"
pkgname=(
  "vte-common-git"
  "vte3-git"
  "vte4-git"
  "vte-docs-git"
)
pkgver=0.79.0.r39.gd99a527c
pkgrel=1
pkgdesc="Virtual Terminal Emulator widget"
url="https://gitlab.gnome.org/GNOME/vte"
arch=(x86_64)
license=(
  # Library
  LGPL-3.0-or-later

  # Demo app, some supporting files
  GPL-3.0-or-later

  # COPYING.XTERM (X11 license) only applies to the disabled SIXEL code
)

makedepends=(
  cairo
  fast_float
  gi-docgen
  git
  glib2-devel
  gobject-introspection
  gperf
  gtk3
  gtk4
  meson
  vala
)

options=(!lto)

_pkgsrc="$_pkgbase"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"

  _version=$(
    grep -E "^\s+version:\s+'([0-9]+\.[0-9]+\.[0-9]+)',\$" meson.build \
      | sed -E "s@^\s+version:\s+'([0-9]+\.[0-9]+\.[0-9]+)',\$@\1@"
  )
  _commit=$(
    git log -S "${_version}" -1 --pretty=oneline | sed 's@\ .*$@@'
  )
  _revision=$(
    git rev-list --count "${_commit}..HEAD"
  )
  _hash=$(
    git rev-parse --short HEAD
  )

  echo "${_version}.r${_revision}.g${_hash}"
}

build() {
  local meson_options=(
    -D docs=true
  )

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

check() {
  meson test -C build --print-errorlogs
}

_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_vte-common-git() {
  pkgdesc+=" (common files)"
  depends=(glibc)

  provides+=("${pkgname%-git}=${pkgver%%.r*}")
  conflicts+=("${pkgname%-git}")

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

  cd "$pkgdir"

  _pick gtk3 usr/bin/vte-2.91
  _pick gtk3 usr/include/vte-2.91
  _pick gtk3 usr/lib/libvte-2.91.so*
  _pick gtk3 usr/lib/pkgconfig/vte-2.91.pc
  _pick gtk3 usr/lib/girepository-1.0/Vte-2.91.typelib
  _pick gtk3 usr/share/gir-1.0/Vte-2.91.gir
  _pick gtk3 usr/share/glade
  _pick gtk3 usr/share/vala/vapi/vte-2.91.{deps,vapi}

  _pick gtk4 usr/bin/vte-2.91-gtk4
  _pick gtk4 usr/include/vte-2.91-gtk4
  _pick gtk4 usr/lib/libvte-2.91-gtk4.so*
  _pick gtk4 usr/lib/pkgconfig/vte-2.91-gtk4.pc
  _pick gtk4 usr/lib/girepository-1.0/Vte-3.91.typelib
  _pick gtk4 usr/share/gir-1.0/Vte-3.91.gir
  _pick gtk4 usr/share/vala/vapi/vte-2.91-gtk4.{deps,vapi}

  _pick docs usr/share/doc
}

package_vte3-git() {
  pkgdesc+=" (GTK3)"
  depends=(
    cairo
    fribidi
    gnutls
    gtk3
    pcre2
    vte-common
  )

  provides+=(
    "${pkgname%-git}=${pkgver%%.r*}"
    libvte-2.91.so
  )
  conflicts+=("${pkgname%-git}")

  mv gtk3/* "$pkgdir"
}

package_vte4-git() {
  pkgdesc+=" (GTK4)"
  depends=(
    cairo
    fribidi
    gnutls
    gtk4
    pcre2
    vte-common
  )

  provides+=(
    "${pkgname%-git}=${pkgver%%.r*}"
    libvte-2.91-gtk4.so
  )
  conflicts+=("${pkgname%-git}")

  mv gtk4/* "$pkgdir"
}

package_vte-docs-git() {
  pkgdesc+=" (documentation)"
  arch=(any)

  provides+=("${pkgname%-git}=${pkgver%%.r*}")
  conflicts+=("${pkgname%-git}")

  mv docs/* "$pkgdir"
}