summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bb13f3f0bdf0c22e40cfb8c71e9fd3b03b90a232 (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
# Maintainer: Matt Coffin <mcoffin13@gmail.com>

pkgname=libscfg-git
_pkgver='branch=master'
pkgver=0.1.1.r0.649514f
pkgrel=1
pkgdesc="A C library for scfg"
arch=(x86_64)
url="https://git.sr.ht/~emersion/libscfg"
license=('MIT')
groups=()
depends=()
makedepends=(git meson ninja zsh gyosu) # 'bzr', 'git', 'mercurial' or 'subversion'
provides=(libscfg)
conflicts=("${pkgname%-git}")
replaces=()
backup=()
options=('staticlibs')
install=
source=("${pkgname%-git}::git+https://git.sr.ht/~emersion/libscfg#${_pkgver}")
noextract=()
b2sums=('SKIP')

# Please refer to the 'USING VCS SOURCES' section of the PKGBUILD man page for
# a description of each element in the source array.

pkgver() {
	# cd "$srcdir/${pkgname%-git}"
	# printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

	git -C "$srcdir/${pkgname%-git}" describe --long \
		| awk -F '-' '{ sub(/^v/, ""); v = $1 ".r" $2 "." substr($3, 2); printf "%s", v; }'
}

prepare() {
	return 0
}

build() {
	arch-meson \
		-Ddefault_library=both \
		-Db_lto=false \
		"$srcdir/${pkgname%-git}" \
		"$srcdir/build"
	ninja -C "$srcdir/build" -v
	[ ! -e "$srcdir/docs" ] \
		|| rm -rf "$srcdir/docs" \
		&& mkdir -p "$srcdir/docs"
	find "$srcdir/${pkgname%-git}/include" -type f -name '*.h' -print0 \
		| xargs -0 gyosu \
		-I "$srcdir/${pkgname%-git}/include" \
		-ffile-prefix-map="$srcdir/${pkgname%-git}/include"/= \
		-o "$srcdir/docs"
}

check() {
	ninja -C "$srcdir/build" test
}

package() {
	DESTDIR="$pkgdir/" ninja -C "$srcdir/build" install
	[ -d "$pkgdir/usr/share/$pkgname" ] || mkdir -p "$pkgdir/usr/share/$pkgname"
	[ ! -e "$pkgdir/usr/share/$pkgname/docs" ] || rm -rf "$pkgdir/usr/share/$pkgname/docs"
	cp -r "$srcdir"/docs "$pkgdir"/usr/share/"$pkgname"/
	install -Dm0644 -t "$pkgdir"/usr/share/licenses/"$pkgname" "$srcdir/${pkgname%-git}/LICENSE"
}