summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 80672a4c5ca47fdc8885558604dd5140eb049dff (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
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
# Contributor: Sebastian J. Bronner <waschtl@sbronner.com>

pkgname=gwenhywfar-git
pkgver=5.11.1+3+g788314e4
pkgrel=1
pkgdesc="OS abstraction functions for various projects"
arch=(x86_64 i686)
url=https://www.aquamaniac.de/rdm/projects/gwenhywfar
license=(LGPL-2.1-only)
depends=(bash gcc-libs glib2 glibc gnutls libgcrypt libgpg-error openssl)
makedepends=(git gtk3 qt5-base)
optdepends=('gtk3: for the GTK3 UI' 'qt5-base: for the Qt5 UI')
provides=(gwenhywfar)
conflicts=(gwenhywfar)
source=(git+https://git.aquamaniac.de/git/gwenhywfar)
sha256sums=(SKIP)
_sourcedir=gwenhywfar

pkgver() {
  # In the gwenhywfar repository, the Git tag that we want is
  # usually not reachable from the current HEAD.
  # To work around that issue, extract the version number from
  # configure.ac instead.
  _version_base="$(
    awk -F= \
      -e '/^GWENHYWFAR_VERSION_(MAJOR|MINOR|PATCHLEVEL)=/ {
        a[substr($1, 20)] = $2
      }' \
      -e 'END {
        if (length(a) < 3) {
          exit 64 + length(a)
        }
        print a["MAJOR"]"."a["MINOR"]"."a["PATCHLEVEL"]
      }' \
      "$_sourcedir/configure.ac"
  )"
  _tag="$(git -C "$_sourcedir" tag --list "${_version_base}*" | head -1)"
  if [[ -z "${_tag}" ]]; then
    printf >&2 'Unable to find tag that starts with %s\n' "${_tag}"
    return 1
  fi

  printf "%s+%s+g%s\n" \
    "${_version_base}" \
    "$(git -C "$_sourcedir" rev-list --count "^${_tag}" @)" \
    "$(git -C "$_sourcedir" describe --always --exclude='*')"
}

prepare() {
  autoreconf -fi $_sourcedir
}

build() {
  cd $_sourcedir
  ./configure --prefix=/usr --sysconfdir=/etc --enable-system-certs --with-guis="gtk3 qt5"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd $_sourcedir
  make DESTDIR=$pkgdir install
}