aboutsummaryrefslogtreecommitdiffstats
path: root/community/linux-tools/APKBUILD
blob: 7491e1e4eb7e2532a37230c2d97de9caa3338de3 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=linux-tools
pkgver=5.15.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 ncurses-dev
	automake autoconf libtool libudev-zero-dev sysfsutils-dev glib-dev"
subpackages="perf perf-bash-completion:bashcomp:noarch cpupower cpupower-openrc
	$pkgname-gpio $pkgname-iio $pkgname-doc $pkgname-dev
	$pkgname-tmon $pkgname-usbip $pkgname-usbip-openrc"
source="https://kernel.org/pub/linux/kernel/v5.x/linux-$_kernver.tar.xz
	https://kernel.org/pub/linux/kernel/v5.x/patch-$pkgver.xz
	tmon-musl-includes.patch
	cpupower-libs.patch
	cpupower.initd
	cpupower.confd
	usbip.initd
	usbip.confd
	"

builddir="$srcdir"/linux-$_kernver

[ "$CARCH" = "riscv64" ] && options="$options textrels"

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 tmon
	( cd tools/usb/usbip ;
	./autogen.sh
	sed -i 's,-Wall -Werror -Wextra,-fcommon,' configure.ac ;
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--libdir=/usr/lib \
		--datarootdir=/usr/share ;
	make )
}

package() {
	mkdir -p "$pkgdir"
	_make_tools DESTDIR="$pkgdir" \
		perf_install cpupower_install gpio_install iio_install
	( cd tools/thermal/tmon;
		make install INSTALL_ROOT="$pkgdir"; )
	( cd tools/usb/usbip ;
		make DESTDIR="$pkgdir" 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
}

usbip() {
	pkgdesc="utilities for USB device sharing over IP network"
	replaces="usbip-utils"
	provides="usbip-utils=$pkgver-r$pkgrel"
	depends=""
	mkdir -p "$subpkgdir"/usr/sbin \
		"$subpkgdir"/usr/lib \
		"$subpkgdir"/usr/include/usbip \
		"$subpkgdir"/etc
	mv "$pkgdir"/usr/sbin/usb* "$subpkgdir"/usr/sbin
	mv "$pkgdir"/usr/lib/libusb* "$subpkgdir"/usr/lib
	install -Dm755 "$srcdir"/usbip.initd "$pkgdir"/etc/init.d/usbip
	install -Dm644 "$srcdir"/usbip.confd "$pkgdir"/etc/conf.d/usbip
}

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
}

tmon() {
	pkgdesc="Linux kernel thermal monitor tools"
	replaces="tmon"
	depends=""
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/tmon "$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="
d25ad40b5bcd6a4c6042fd0fd84e196e7a58024734c3e9a484fd0d5d54a0c1d87db8a3c784eff55e43b6f021709dc685eb0efa18d2aec327e4f88a79f405705a  linux-5.15.tar.xz
3301c98ec2be607d29674a0f1fdb1baf1bda4e01c9c595281e42c936c6df9378c07e684edda6e4d30115af291c0935ed80bfc7a1616fad05903cf6bd4d9b0a90  patch-5.15.4.xz
15d6d80e9ed2cdea3bb09574f1cf524007b088699204cfc9d326edd9cf461a38300cfafd82dae4a5a78a179944ef10f51ed7d51c3a8aeb8c08e7c6754d9e123b  tmon-musl-includes.patch
a46e3a84b00a39a356618831d0ddfb7f0d10f0a3799d1307ba2cc832e73c01f8d637a4e801a6dd25025f6f13155c6ad8b836422ff72d365e51063ac0bf907f52  cpupower-libs.patch
97ecfeaaaa8efca7af585316b843bf7be885e88095bbdfbf52bc9a96b14dc862435482781e205ea022ab208978aaa4aabb317354fab890ed514a5088ae5045c8  cpupower.initd
63cd12a4d8782198c71662e9205e346e064b65bae5e3e175b5bc43bdf7ec6ddf675b60349750afe3c37c8a925f9ae9a93530671821342581bd282a69e0773b8c  cpupower.confd
fcbd64d844c9bc187d08cef5995e91a46c0df78deb24e96ac9210c0e2c730eca0301970d9b8ffbf003df274682d05072431a26b59d8c491f396618268a12ec92  usbip.initd
eb8de617e27c4d5fdfee9c442e8f74b0afb4d0fe7b59eca3a19629eb70fea7e09b3c125bc968aa8810d845ce661c829bd0f3fdb2288664f2cccf423bc0ae6ae8  usbip.confd
"