summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9e3f83abd93d78799e13e3f6148962e93ad72908 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Contributor: Johannes Dewender  arch at JonnyJD dot net
pkgbase=voglperf
pkgname=('voglperf32' 'voglperf64')
pkgver=0.2
pkgrel=7
pkgdesc="benchmarking tool for OpenGL games (frame info, logs, steam support)"
arch=('x86_64' 'i686')
url="https://github.com/ValveSoftware/voglperf"
license=('custom:MIT', 'BSD')
makedepends=('cmake' 'ncurses' 'libedit')
if [ "$CARCH" = "x86_64" ]; then
	makedepends+=('gcc-multilib' 'lib32-ncurses' 'lib32-libedit')
fi
conflicts=('voglperf')
replaces=('voglperf')
source=(https://github.com/ValveSoftware/$pkgbase/archive/$pkgver.tar.gz
	multilib-libraries.patch native-libedit.patch)
sha256sums=('c91ab58aaa69d84312ce67090252f28a104952d4335595bbc728e357bf2ad545'
            'fdde9ba59e2d3ae2cf8a0225d007b15732adf271bc283366eff377e762dac66f'
            '72c2cb961df7466984bb6aab44e03a8e2793c5ba867da12bcba18842a1210c31')

prepare() {
	cd "$srcdir/$pkgbase-$pkgver"
	if [ "$CARCH" = "x86_64" ]; then
		sed -i -e 's|./libvoglperf32.so|/usr/lib32/libvoglperf.so|' \
			-e 's|./libvoglperf64.so|/usr/lib/libvoglperf.so|' \
			src/voglperfrun.cpp
	else
		# does the 32 bit version need the 64 bit library?
		# if so, this wouldn't work
		sed -i -e 's|./libvoglperf32.so|/usr/lib/libvoglperf.so|' \
			src/voglperfrun.cpp
	fi

	# use system libedit
	patch -p1 < ../multilib-libraries.patch
	patch -p1 < ../native-libedit.patch

	# ncurses provides libtinfo functionality
	# we don't split ncurses into an extra libtinfo on Arch
	# fixed in voglperf > 0.2 (8ea79efa85b8970295ae834eb2e41c00ba18df82)
	sed -i -e 's|tinfo|ncurses|g' src/CMakeLists.txt
}

build() {
	cd "$srcdir/$pkgbase-$pkgver"
	if [ "$CARCH" = "x86_64" ]; then
		make voglperf64 voglperf32
	else
		make voglperf32
	fi
}

package_voglperf32() {
	arch=('x86_64' 'i686')
	if [ "$CARCH" = "i686" ]; then
		depends=('ncurses' 'libedit')
	else
		depends=('lib32-ncurses' 'lib32-libedit' 'lib32-gcc-libs')
	fi
	cd "$srcdir/$pkgbase-$pkgver/bin"
	install -D voglperfrun32 "$pkgdir/usr/bin/voglperfrun32"
	if [ "$CARCH" = "x86_64" ]; then
		install -Dm644 libvoglperf32.so \
			"$pkgdir/usr/lib32/libvoglperf.so"
	else
		install -Dm644 libvoglperf32.so \
			"$pkgdir/usr/lib/libvoglperf.so"
	fi

	cd "$srcdir/$pkgbase-$pkgver"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	cd "$srcdir/$pkgbase-$pkgver/src/webby"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/webby/LICENSE"
}

package_voglperf64() {
	arch=('x86_64')
	depends=('ncurses' 'libedit' 'gcc-libs-multilib')
	cd "$srcdir/$pkgbase-$pkgver/bin"
	install -D voglperfrun64 "$pkgdir/usr/bin/voglperfrun64"
	install -Dm644 libvoglperf64.so "$pkgdir/usr/lib/libvoglperf.so"

	cd "$srcdir/$pkgbase-$pkgver"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	cd "$srcdir/$pkgbase-$pkgver/src/webby"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/webby/LICENSE"
}