summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 31d34d3c40dc43afed61bdcf3bb5c13b8ec01461 (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
# Maintainer:
# Contributor: Ionut Biru <ibiru@archlinux.org>

## useful links:
# https://telepathy.freedesktop.org/components/telepathy-farstream/
# https://github.com/TelepathyIM/telepathy-farstream

## options
: ${_build_git:=false}

[[ "${_build_git::1}" == "t" ]] && _pkgtype+="-git"

## basic info
_pkgname="telepathy-farstream"
pkgname="$_pkgname${_pkgtype:-}"
pkgver=0.6.2
pkgrel=8
pkgdesc="Telepathy GLib-based client library that uses Farstream to handle Call channels"
url="https://telepathy.freedesktop.org/components/telepathy-farstream/"
license=('LGPL-2.1-or-later')
arch=(x86_64)

# main package
_main_package() {
  depends=(
    farstream
    telepathy-glib
  )
  makedepends=(
    dbus-glib
    glib2-docs
    gobject-introspection
    gtk-doc
  )

  if [ "${_build_git::1}" != "t" ] ; then
    _main_stable
  else
    _main_git
  fi
}

# stable package
_main_stable() {
  _dl_url="http://telepathy.freedesktop.org/releases/telepathy-farstream"
  _pkgsrc="$_pkgname-${pkgver%%.r*}"
  _pkgext="tar.gz"
  source+=("$_pkgsrc.$_pkgext"::"$_dl_url/$_pkgsrc.$_pkgext")
  sha256sums+=('6fa099f22d13a2a49240445a13e918928aef097675d76e5cc9f98ab496087e0a')

  pkgver() {
    local _pkgver="${pkgver%%.r*}"
    echo "${_pkgver:?}"
  }
}

# git package
_main_git() {
  url="https://github.com/TelepathyIM/telepathy-farstream"

  makedepends+=('git')

  provides=("$_pkgname=${pkgver%%.r*}")
  conflicts=("$_pkgname")

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

  pkgver() (
    cd "$_pkgsrc"

    git describe --long --tags --exclude='*[a-zA-Z][a-zA-Z]*' \
      | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
  )
}

# common functions
prepare() {
  cd "$_pkgsrc"
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd "$_pkgsrc"

  local _configure_options=(
    --prefix=/usr
    --sysconfdir=/etc
    --libexecdir=/usr/lib/telepathy
    --disable-static
    --enable-gtk-doc
  )

  ./configure "${_configure_options[@]}"
  sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool
  make
}

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

# execute
_main_package