git » range-v3-git.git » master » tree

[master] / PKGBUILD

# Maintainer: Patrick Northon <northon_patrick3@yahoo.ca>
# Contributor: Theodoros Theodoridis <theodoridisgr@gmail.com>

#Note: get rid of this package after gcc upgrade (only here to give gcc 12 a ranges::to)

_pkgname='range-v3'
pkgname=${_pkgname}-git
pkgver=0.12.0.r47.gca1388fb9
pkgrel=1
pkgdesc='Experimental range library for C++11/14/17'
arch=('any')
url='https://github.com/ericniebler/range-v3'
license=('BSL-1.0')
makedepends=('git' 'cmake')
source=("git+https://github.com/ericniebler/${_pkgname}.git")
md5sums=('SKIP')

_dir="${_pkgname}"

_flags=(
	-Wno-dev
	-DCMAKE_INSTALL_PREFIX=/usr
	-DRANGE_V3_EXAMPLES=OFF
	-DRANGE_V3_PERF=OFF
	-DRANGES_ENABLE_WERROR=OFF
	-DRANGES_NATIVE=OFF
	-DRANGES_CXX_STD=23
)

pkgver() {
	cd "${_dir}"
	git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cmake -S "${_dir}" -B 'build' \
		"${_flags[@]}" \
		-DRANGE_V3_TESTS=OFF \
		-DRANGE_V3_HEADER_CHECKS=OFF
	cmake --build 'build'
}

check() {
	cmake -S "${_dir}" -B 'build' \
		"${_flags[@]}" \
		-DRANGE_V3_TESTS=ON \
		-DRANGE_V3_HEADER_CHECKS=ON
	cmake --build 'build'
	cmake --build 'build' --target test
}

package() {
	DESTDIR="${pkgdir}" cmake --install 'build'

	cd "${_dir}"
	# install custom license
	install -Dm644 "LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}