summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 10b20aa75264a1a51004fc6ea44d5d33cfe15949 (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
# Maintainer: Simon Legner <Simon.Legner@gmail.com>
# Maintainer: peippo <christoph+aur@christophfink.com>
pkgname=protozero
pkgver=1.7.1
pkgrel=4
pkgdesc="Minimalist protocol buffer decoder and encoder in C++"
url="https://github.com/mapbox/protozero"
arch=('any')
license=('custom')
makedepends=('clang' 'cmake' 'cppcheck' 'include-what-you-use')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/mapbox/${pkgname}/archive/v${pkgver}.tar.gz")

build() {
  mkdir -p "${srcdir}/${pkgname}-${pkgver}/build"
  cd "${srcdir}/${pkgname}-${pkgver}/build"

  # clang++ is strict with mixing C++11 and C++17 features,
  # fails to build test,
  # see https://aur.archlinux.org/packages/protozero#comment-855739
  if [[ "${CXX}" == "clang++" ]]; then
    cmake \
      -DCMAKE_CXX_STANDARD=17 \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DIWYU_TOOL=/usr/bin/iwyu-tool \
      -DBUILD_TESTING=OFF \
      -DCLANG_TIDY=OFF \
      ..
  else
    cmake \
      -DCMAKE_CXX_STANDARD=17 \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DIWYU_TOOL=/usr/bin/iwyu-tool \
      ..
  fi

  make
}

check() {
  if [[ "${CXX}" != "clang++" ]]; then
    cd "${srcdir}/${pkgname}-${pkgver}/build"
    make test
  fi
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}/build"
  make DESTDIR="${pkgdir}" install
  install -Dm644 ../LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha256sums=('27e0017d5b3ba06d646a3ec6391d5ccc8500db821be480aefd2e4ddc3de5ff99')