summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 82ad6ae6835b56197ae3401ce48bbba605e862ed (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
# Maintainer: Morteza NourelahiAlamdari <m at 0t1.me>
# Contributor: Andy Weidenbaum <archbaum at gmail.com>
# Contributor: Brian Knox <taotetek at gmail.com>

pkgname=czmq-git
_pkgname=${pkgname%-git}
pkgver=4.2.1.r118.g1b5062c3
pkgrel=1
epoch=1
pkgdesc="High-level C binding for ZeroMQ"
arch=('i686' 'x86_64' 'aarch64')
depends=('zeromq' 'curl' 'lz4' 'systemd-libs' 'util-linux-libs')
makedepends=('git' 'pkg-config')
url="https://github.com/zeromq/${_pkgname}"
license=('MPL-2.0')
source=("git+${url}")
sha256sums=('SKIP')
provides=("${_pkgname}=${pkgver%.r*}" libczmq.so)
conflicts=(${_pkgname})

pkgver() {
  cd "${_pkgname}/"

  # Generate git tag based version. Count only proper (v)#.#* [#=number] tags.
  local _gitversion=$(git describe --long --match '[v0-9][0-9.][0-9.]*' | sed -e 's|^v||' | tr '[:upper:]' '[:lower:]')

  # Format git tag based version for pkgver
  # Expected format: e.g. 1.5.0rc2.r521.g99982a1c
  echo "${_gitversion}" | sed \
      -e 's|^\([0-9][0-9.]*\)-\([a-zA-Z]\+\)|\1\2|' \
      -e 's|\([0-9]\+-g\)|r\1|' \
      -e 's|-|.|g'
}

build() {
  cd "${_pkgname}/"

  msg2 'Building...'
  ./autogen.sh
  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --libexecdir=/usr/lib/czmq \
    --sysconfdir=/etc \
    --sharedstatedir=/usr/share/czmq \
    --localstatedir=/var/lib/czmq \
    --disable-czmq_selftest \
    --disable-zmakecert \
    --with-gnu-ld \
    --with-nss=no
  make
}

package() {
  cd "${_pkgname}/"

  msg2 'Installing license...'
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/czmq"

  msg2 'Installing...'
  make DESTDIR="${pkgdir}" install

  msg2 'Renaming binaries...'
  for _bin in $(find "${pkgdir}/usr/bin" -type f -printf '%f\n'); do
    mv "${pkgdir}/usr/bin/${_bin}" "${pkgdir}/usr/bin/${_pkgname}_${_bin}"
  done

  msg2 'Cleaning up pkgdir...'
  find "${pkgdir}" -type d -name .git -exec rm -r '{}' +
  find "${pkgdir}" -type f -name .gitignore -exec rm -r '{}' +
}