summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 573f8095220114493d14ad68331faf940f31e480 (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
# Uncomment to build documentation
#_with_docs=1

pkgname=libcomps
pkgver=0.1.18
pkgrel=1
pkgdesc="Comps XML file manipulation library"
arch=('i686' 'x86_64')
url="https://github.com/rpm-software-management/$pkgname"
license=('GPL2')
depends=('expat' 'libxml2' 'zlib')
makedepends=('cmake>=3.13' 'python' 'python-setuptools')
((_with_docs)) && makedepends+=('doxygen' 'python-sphinx')
checkdepends=('check')
optdepends=('python: for python bindings')
source=("$url/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('02f8aa83dfd19beb7ce250b39818017a6eda7c3984caf8efbd2fc0c70d97bc9a')

build() {
	cd "$pkgname-$pkgver"

	cmake -B build -S libcomps \
	      -DCMAKE_BUILD_TYPE=Release \
	      -DCMAKE_C_FLAGS_RELEASE='-DNDEBUG' \
	      -DCMAKE_INSTALL_PREFIX=/usr \
	      -DCMAKE_INSTALL_LIBDIR=lib \
	      -Wno-dev

	make -C build

	if ((_with_docs)); then
		make -C build docs
		make -C build pydocs
	fi
}

check() {
	cd "$pkgname-$pkgver"

	make -C build test
	make -C build pytest
}

package() {
	cd "$pkgname-$pkgver"

	make -C build DESTDIR="$pkgdir/" install

	# Install documentation
	if ((_with_docs)); then
		mkdir -p "$pkgdir/usr/share/doc/$pkgname"/{doxygen,sphinx}
		cp -Rp build/docs/libcomps-doc/html/ "$pkgdir/usr/share/doc/$pkgname/doxygen/"
		cp -Rp build/src/python/docs/html/   "$pkgdir/usr/share/doc/$pkgname/sphinx/"
	fi

	install -Dp -m644 README.md  "$pkgdir/usr/share/doc/$pkgname/README.md"
}

# vim: set ft=sh ts=4 sw=4 noet: