aboutsummaryrefslogtreecommitdiffstats
path: root/community/linux-tools/APKBUILD
blob: 5879e98c1b5874c672459f66a568b09e4841c599 (plain) (blame)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=linux-tools
pkgver=5.10.4
_kernver=${pkgver%.*}
pkgrel=0
pkgdesc="Linux kernel tools meta package"
url="https://www.kernel.org/"
arch="all"
license="GPL-2.0-only"
depends="perf cpupower $pkgname-gpio $pkgname-iio"
depends_dev="pciutils-dev readline-dev gettext-dev"
makedepends="$depends_dev elfutils-dev bash linux-headers flex bison diffutils
	zlib-dev findutils python3"
subpackages="perf perf-bash-completion:bashcomp:noarch cpupower cpupower-openrc
	$pkgname-gpio $pkgname-iio $pkgname-doc $pkgname-dev"
source="https://kernel.org/pub/linux/kernel/v5.x/linux-$_kernver.tar.xz
	https://kernel.org/pub/linux/kernel/v5.x/patch-$pkgver.xz
	cpupower-libs.patch
	cpupower.initd
	cpupower.confd
	"

builddir="$srcdir"/linux-$_kernver

prepare() {
	cd "$srcdir"/linux-$_kernver
	if [ "${pkgver%.0}" = "$pkgver" ]; then
		msg "Applying patch-$pkgver.xz"
		unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N
	fi
	default_prepare
}

_make_tools() {
	make -C "$builddir"/tools \
		VERSION=$pkgver-$pkgrel NLS=false LIBINTL_LIBS=-lintl WERROR=0 \
		prefix=/usr libdir=/usr/lib lib=lib mandir=/usr/share/man \
		"$@"
}

build() {
	_make_tools perf cpupower gpio iio
}

package() {
	mkdir -p "$pkgdir"
	_make_tools DESTDIR="$pkgdir" \
		perf_install cpupower_install gpio_install iio_install

	mv "$pkgdir"/etc/bash_completion.d "$pkgdir"/usr/share/bash-completion/completions
}

cpupower() {
	pkgdesc="Linux kernel tool to set CPU power features"
	depends=""
	mkdir -p "$subpkgdir"/usr/sbin \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/lib \
		"$subpkgdir"/etc

	mv "$pkgdir"/usr/bin/cpu* "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/sbin/cpu* "$subpkgdir"/usr/sbin/
	mv "$pkgdir"/usr/lib/libcpu*.so.* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/etc/cpu* "$subpkgdir"/etc/
	install -Dm755 "$srcdir"/$subpkgname.initd \
		"$pkgdir"/etc/init.d/$subpkgname
	install -Dm644 "$srcdir"/$subpkgname.confd \
		"$pkgdir"/etc/conf.d/$subpkgname

}

perf() {
	pkgdesc="Linux kernel performance auditing tool"
	depends=""
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/bin/perf \
		"$pkgdir"/usr/bin/trace \
		"$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/lib/traceevent \
		"$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/libexec "$subpkgdir"/usr/
}

gpio() {
	pkgdesc="Linux kernel GPIO tools"
	depends=""
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/*gpio* "$subpkgdir"/usr/bin
}

iio() {
	pkgdesc="Linux kernel IIO tools"
	depends=""
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/*iio* "$subpkgdir"/usr/bin
}

bashcomp() {
	replaces="$pkgname-bash-completion" # Backward compatibility
	pkgdesc="Bash autocompletion for $pkgname"
	install_if="perf=$pkgver-r$pkgrel bash-completion"
	mkdir -p "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/share/bash-completion "$subpkgdir"/usr/share/
}

sha512sums="95bc137d0cf9148da6a9d1f1a878698dc27b40f68e22c597544010a6c591ce1b256f083489d3ff45ff77753289b535135590194d88ef9f007d0ddab3d74de70e  linux-5.10.tar.xz
893733c9b9290f7a91bfb31ca9baa762a6460665b59efad6ee194b67807ae3990cf44464a32ea4a7e9620b58d7810ff15a30a7d92f0bf1b14cff3b5730fce49c  patch-5.10.4.xz
a46e3a84b00a39a356618831d0ddfb7f0d10f0a3799d1307ba2cc832e73c01f8d637a4e801a6dd25025f6f13155c6ad8b836422ff72d365e51063ac0bf907f52  cpupower-libs.patch
97ecfeaaaa8efca7af585316b843bf7be885e88095bbdfbf52bc9a96b14dc862435482781e205ea022ab208978aaa4aabb317354fab890ed514a5088ae5045c8  cpupower.initd
63cd12a4d8782198c71662e9205e346e064b65bae5e3e175b5bc43bdf7ec6ddf675b60349750afe3c37c8a925f9ae9a93530671821342581bd282a69e0773b8c  cpupower.confd"