summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c033dc4c0d21f807f77009b7f7895b182d0a7038 (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
# Maintainer: Jesin <Jesin00@gmail.com>
# Contributor: Eduardo Sánchez Muñoz
pkgname=nlohmann-json-git
_name="${pkgname%-git}"
pkgver=3.7.3
pkgrel=1
pkgdesc='Header-only JSON library for Modern C++'
url='https://github.com/nlohmann/json'
license=(MIT)
arch=(x86_64)
makedepends=(cmake git)
provides=("$_name=${pkgver%%+*}")
conflicts=("$_name")
source=("git+$url")
sha256sums=(SKIP)

pkgver() {
	cd json
	local v="$(git describe --tags)"
	v="${v#v}"
	printf %s "${v//-/+}"
}

_cmake_flags=(
	-DCMAKE_BUILD_TYPE=Release
	-DCMAKE_INSTALL_LIBDIR=lib
	-DCMAKE_INSTALL_PREFIX=/usr
)

build() {
	mkdir build
	cd build
	cmake ../json "${_cmake_flags[@]}" -DBUILD_TESTING=OFF
	make
}

check() {
	cd build
	cmake ../json "${_cmake_flags[@]}" -DBUILD_TESTING=ON
	make
	ctest --output-on-failure
}

package() {
	cd build
	make "DESTDIR=$pkgdir" install
	install -Dm644 "-t$pkgdir/usr/share/licenses/$_name" ../json/LICENSE.MIT
}