summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cc1a702ac779b393a1d73d03fd1746227e373551 (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
# Modifications to use source from git master
# Maintainer: James P. Harvey <jamespharvey20 at gmail dot com>
# Contributor: Ranieri Althoff <ranisalt at protonmail dot com>

# Original Community Repo
# Maintainer: Baptiste Jonglez <archlinux at bitsofnetworks dot org>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Bart Verhagen <barrie.verhagen at gmail dot com>

pkgname=catch2-git
pkgver=3.1.1.r45.gb65c0e27
pkgrel=1
pkgdesc="Modern, C++-native, header-only, test framework for unit-tests, TDD and BDD (developmental version)"
arch=('x86_64')
url="https://github.com/catchorg/catch2"
license=('Boost')
makedepends=('cmake' 'python' 'git') # python seems to be necessary for building tests (FS#60273)
provides=("catch2=$pkgver")
conflicts=(catch2)
source=(
  "git+https://github.com/catchorg/Catch2"
  "0001-Remove-misguided-attempt-at-reproducibility-that-bre.patch"
  "0002-ApprovalTests-fix-path-rewriting-for-debug-builds.patch"
)
sha256sums=('SKIP'
            'd26bd252d163e4648217c942bc5a9ac36edba6a151759edd57597ae437866d8e'
            '72fd49a773699f85eb0954074231c9229ee442c58e2c4e476c25d4ce2328381b')

pkgver() {
  cd Catch2

  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/^v//'
}

prepare() {
  cd Catch2

  patch -p1 < "$srcdir/0001-Remove-misguided-attempt-at-reproducibility-that-bre.patch"
  patch -p1 < "$srcdir/0002-ApprovalTests-fix-path-rewriting-for-debug-builds.patch"
}

build() {
  cmake -B build -S Catch2 \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCATCH_USE_VALGRIND=OFF \
    -DCATCH_DEVELOPMENT_BUILD=ON \
    -DCATCH_BUILD_EXAMPLES=OFF \
    -DCATCH_ENABLE_COVERAGE=OFF \
    -DCATCH_ENABLE_WERROR=OFF \
    -DCATCH_BUILD_TESTING=ON
  make -C build
}

check() {
  # dbgsrcdir needs to be passed to the testsuite, since it does some pathname mangling that is
  # broken by -ffile-prefix-map - see 0002-ApprovalTests-fix-path-rewriting-for-debug-builds.patch
  dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}/$pkgbase" make -C build test
}

package() {
  make -C build DESTDIR="$pkgdir" install
}

# vim: set et ts=2: