PKGBUILDs/extra/linux-tools/PKGBUILD

294 lines
7.8 KiB
Bash
Raw Normal View History

2013-02-19 20:07:36 +00:00
# Maintainer: Sébastien Luttringer
2012-07-23 23:25:09 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
2015-05-14 14:19:46 +00:00
# - removed x86_energy_perf_policy and turbostat build/package, uses x86 asm
2014-01-21 01:48:34 +00:00
# - removed numactl dep
2015-11-03 00:33:56 +00:00
# - use tarball source
2017-02-28 01:53:16 +00:00
# - add GPIO and IIO utilities packages
2020-10-23 23:07:50 +00:00
# - build perf with WERROR=0
2012-07-23 23:25:09 +00:00
pkgbase=linux-tools
2014-01-21 01:36:06 +00:00
pkgname=(
2021-11-02 18:21:55 +00:00
'bootconfig'
2019-01-03 02:54:34 +00:00
'bpf'
2014-01-21 01:36:06 +00:00
'cpupower'
2017-09-06 00:56:23 +00:00
'hyperv'
2014-01-21 01:36:06 +00:00
'linux-tools-meta'
'perf'
'tmon'
'usbip'
2017-02-28 01:53:16 +00:00
'gpio-utils'
'iio-utils'
2014-01-21 01:36:06 +00:00
)
2024-07-23 00:20:32 +00:00
pkgver=6.10
pkgrel=1
2024-05-16 00:33:23 +00:00
license=('GPL-2.0-only')
2017-12-10 14:07:27 +00:00
arch=('x86_64')
2016-12-31 15:16:39 +00:00
url='https://www.kernel.org'
2023-09-30 16:42:46 +00:00
options=('!strip' '!lto' '!distcc' '!makeflags')
2015-11-03 00:33:56 +00:00
makedepends=('git')
2012-07-23 23:25:09 +00:00
# split packages need all package dependencies set manually in makedepends
2012-08-09 13:40:15 +00:00
# kernel source deps
2015-11-03 00:33:56 +00:00
makedepends+=('asciidoc' 'xmlto')
2012-08-09 13:40:15 +00:00
# perf deps
2023-06-03 18:32:34 +00:00
makedepends+=('perl' 'python' 'python-setuptools' 'slang' 'elfutils' 'libunwind'
'audit' 'zstd' 'libcap' 'libtraceevent' 'openssl' 'clang')
2012-08-09 13:40:15 +00:00
# cpupower deps
makedepends+=('pciutils')
# usbip deps
2014-07-30 22:17:35 +00:00
makedepends+=('glib2' 'sysfsutils' 'udev')
2014-01-21 01:36:06 +00:00
# tmon deps
makedepends+=('ncurses')
2019-09-16 13:21:22 +00:00
# bpf deps
2020-12-21 15:32:25 +00:00
makedepends+=('readline' 'zlib' 'libelf' 'libcap' 'python-docutils')
# turbostat deps
makedepends+=('libcap')
2022-03-26 00:19:14 +00:00
# bpftool
makedepends+=('llvm' 'clang')
2012-08-09 13:40:15 +00:00
groups=("$pkgbase")
2022-10-18 00:50:23 +00:00
source=("https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${pkgver}.tar.xz"
2024-05-16 00:33:23 +00:00
# "https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-$pkgver.2.xz"
2013-02-19 20:07:36 +00:00
'cpupower.default'
2012-08-07 16:11:48 +00:00
'cpupower.systemd'
2012-08-09 13:40:15 +00:00
'cpupower.service'
2019-09-16 13:21:22 +00:00
'usbipd.service'
'hv_kvp_daemon.service'
2023-08-07 12:37:45 +00:00
'hv_vss_daemon.service'
)
2024-07-23 00:20:32 +00:00
sha256sums=('e7ef67dfdf83e23ca49bb679dd32782c6d06088696bfa3b3a626705f51635d29'
2019-12-02 13:43:28 +00:00
'4fa509949d6863d001075fa3e8671eff2599c046d20c98bb4a70778595cd1c3f'
2020-12-02 19:26:53 +00:00
'b692f4859ed3fd9831a058a450a84d8c409bf7e3e45aac1c2896a14bb83f3d7a'
2020-10-23 23:07:50 +00:00
'42d2ec9f1d9cc255ee7945a27301478364ef482f5a6ddfc960189f03725ccec2'
2019-12-02 13:43:28 +00:00
'2e187734d8aec58a3046d79883510d779aa93fb3ab20bd3132c1a607ebe5498f'
'b1315cb77a35454e1af9172f821a52e2a0cb18561be05a340d21cf337b01ae61'
2023-12-17 12:38:50 +00:00
'2d5e2f8d40b6f19bf2e1dead57ca105d72098fb0b418c09ff2e0cb91089710af')
2014-01-21 01:36:06 +00:00
prepare() {
2016-03-16 01:23:43 +00:00
cd linux-$pkgver
2017-06-06 12:25:42 +00:00
2016-03-16 01:23:43 +00:00
# apply patch from the source array (should be a pacman feature)
2020-02-16 17:55:39 +00:00
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
src="${src%.xz}"
[[ $src = *.patch || $src = patch-* ]] || continue
echo ":: Applying patch $src"
patch -p1 -N -i "$srcdir/$src"
2015-05-14 14:19:46 +00:00
done
2023-06-03 18:32:34 +00:00
# force our perf version
cat > tools/perf/util/PERF-VERSION-GEN << EOF
#!/bin/sh
echo '#define PERF_VERSION "$pkgver-$pkgrel"' > "\${1:-.}"/PERF-VERSION-FILE
EOF
2014-01-21 01:36:06 +00:00
}
2013-07-01 23:50:42 +00:00
build() {
2020-02-16 17:55:39 +00:00
echo ':: perf'
2012-07-23 23:25:09 +00:00
pushd linux-$pkgver/tools/perf
2016-10-09 15:15:45 +00:00
make -f Makefile.perf \
2016-04-17 12:40:18 +00:00
prefix=/usr \
2016-10-09 15:15:45 +00:00
lib=lib/perf \
perfexecdir=lib/perf \
2024-07-05 22:45:23 +00:00
WERROR=0 \
2016-10-09 15:15:45 +00:00
NO_SDT=1 \
2023-09-30 16:42:46 +00:00
BUILD_BPF_SKEL=1 \
2020-10-23 23:07:50 +00:00
WERROR=0 \
2018-10-26 12:23:53 +00:00
PYTHON=python \
PYTHON_CONFIG=python-config \
2019-12-02 13:43:28 +00:00
DESTDIR="$pkgdir"
2012-07-23 23:25:09 +00:00
popd
2020-02-16 17:55:39 +00:00
echo ':: cpupower'
2012-07-23 23:25:09 +00:00
pushd linux-$pkgver/tools/power/cpupower
make VERSION=$pkgver-$pkgrel
popd
2012-08-09 13:40:15 +00:00
2020-02-16 17:55:39 +00:00
echo ':: usbip'
2014-10-06 01:22:49 +00:00
pushd linux-$pkgver/tools/usb/usbip
2019-07-15 00:48:37 +00:00
# Fix gcc compilation
2020-06-02 17:40:58 +00:00
sed -i 's,-Wall -Werror -Wextra,-fcommon,' configure.ac
2012-08-09 13:40:15 +00:00
./autogen.sh
2013-05-13 00:01:34 +00:00
./configure --prefix=/usr --sbindir=/usr/bin
2012-08-09 13:40:15 +00:00
make
popd
2014-01-21 01:36:06 +00:00
2020-02-16 17:55:39 +00:00
echo ':: tmon'
2014-01-21 01:36:06 +00:00
pushd linux-$pkgver/tools/thermal/tmon
make
popd
2020-02-16 17:55:39 +00:00
echo ':: hv'
2017-09-06 00:56:23 +00:00
pushd linux-$pkgver/tools/hv
2024-07-23 00:20:32 +00:00
CFLAGS+=' -DKVP_SCRIPTS_PATH=\"/usr/lib/hypervkvpd/\"' make
2017-09-06 00:56:23 +00:00
popd
2020-02-16 17:55:39 +00:00
echo ':: gpio'
2017-02-28 01:53:16 +00:00
pushd linux-$pkgver/tools/gpio
2018-04-02 00:41:40 +00:00
make
2017-02-28 01:53:16 +00:00
popd
2020-02-16 17:55:39 +00:00
echo ':: iio'
2017-02-28 01:53:16 +00:00
pushd linux-$pkgver/tools/iio
2018-04-02 00:41:40 +00:00
make
2017-02-28 01:53:16 +00:00
popd
2019-01-03 02:54:34 +00:00
2020-02-16 17:55:39 +00:00
echo ':: bpf'
2019-01-03 04:12:53 +00:00
pushd linux-$pkgver/tools/bpf
2020-04-02 00:36:32 +00:00
# doesn't compile when we don't first compile bpftool in its own directory and
# man pages require to be also launch from the subdirectory
2019-09-16 13:21:22 +00:00
make -C bpftool all doc
2020-04-02 00:36:32 +00:00
# runqslower, require kernel binary path to build, skip it
make -W runqslower
2019-01-03 02:54:34 +00:00
popd
2021-11-02 18:21:55 +00:00
echo ':: bootconfig'
2021-11-02 19:20:35 +00:00
pushd linux-$pkgver/tools/bootconfig
2021-11-02 18:21:55 +00:00
make
popd
2012-07-23 23:25:09 +00:00
}
2013-02-05 16:24:00 +00:00
package_linux-tools-meta() {
pkgdesc='Linux kernel tools meta package'
groups=()
2014-01-21 01:36:06 +00:00
depends=(
2021-11-02 18:21:55 +00:00
'bootconfig'
2019-01-03 02:54:34 +00:00
'bpf'
2014-01-21 01:36:06 +00:00
'cpupower'
2017-09-06 00:56:23 +00:00
'hyperv'
2014-01-21 01:36:06 +00:00
'perf'
'tmon'
'usbip'
)
2015-05-14 17:53:51 +00:00
conflicts=(
'acpidump'
)
2013-02-05 16:24:00 +00:00
}
2012-07-23 23:25:09 +00:00
package_perf() {
pkgdesc='Linux kernel performance auditing tool'
2018-10-26 12:23:53 +00:00
depends=('glibc' 'perl' 'python' 'slang' 'elfutils' 'libunwind' 'binutils'
2020-12-21 15:32:25 +00:00
'numactl' 'audit' 'coreutils' 'glib2' 'xz' 'zlib' 'libelf' 'bash'
2023-06-03 18:32:34 +00:00
'zstd' 'libcap' 'libtraceevent' 'openssl')
2012-07-23 23:25:09 +00:00
cd linux-$pkgver/tools/perf
2016-10-09 15:15:45 +00:00
make -f Makefile.perf \
2016-04-17 12:40:18 +00:00
prefix=/usr \
2016-10-09 15:15:45 +00:00
lib=lib/perf \
perfexecdir=lib/perf \
2022-05-31 23:47:23 +00:00
EXTRA_CFLAGS=' -Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum' \
2016-10-09 15:15:45 +00:00
NO_SDT=1 \
2023-09-30 16:42:46 +00:00
BUILD_BPF_SKEL=1 \
2020-10-23 23:07:50 +00:00
WERROR=0 \
2018-10-26 12:23:53 +00:00
PYTHON=python \
PYTHON_CONFIG=python-config \
2016-10-09 15:15:45 +00:00
DESTDIR="$pkgdir" \
2023-06-03 18:32:34 +00:00
install install-python_ext
2013-02-05 16:24:00 +00:00
cd "$pkgdir"
2017-02-11 22:11:23 +00:00
# add linker search path
mkdir "$pkgdir/etc/ld.so.conf.d"
echo '/usr/lib/perf' > "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"
2016-04-17 12:40:18 +00:00
# move completion in new directory
install -Dm644 etc/bash_completion.d/perf usr/share/bash-completion/completions/perf
2017-02-11 22:11:23 +00:00
rm -r etc/bash_completion.d
2016-04-17 12:40:18 +00:00
# no exec on usr/share
find usr/share -type f -exec chmod a-x {} \;
2012-07-23 23:25:09 +00:00
}
package_cpupower() {
pkgdesc='Linux kernel tool to examine and tune power saving related features of your processor'
2013-02-19 20:07:36 +00:00
backup=('etc/default/cpupower')
2018-10-26 12:23:53 +00:00
depends=('glibc' 'bash' 'pciutils')
2012-07-23 23:25:09 +00:00
conflicts=('cpufrequtils')
2012-10-01 12:41:07 +00:00
replaces=('cpufrequtils')
2013-01-26 20:29:24 +00:00
install=cpupower.install
2012-07-23 23:25:09 +00:00
pushd linux-$pkgver/tools/power/cpupower
make \
DESTDIR="$pkgdir" \
2013-05-13 00:01:34 +00:00
sbindir='/usr/bin' \
2018-02-03 16:14:43 +00:00
libdir='/usr/lib' \
2012-07-23 23:25:09 +00:00
mandir='/usr/share/man' \
docdir='/usr/share/doc/cpupower' \
install install-man
popd
2012-08-23 12:33:46 +00:00
# install startup scripts
2013-02-19 20:07:36 +00:00
install -Dm 644 $pkgname.default "$pkgdir/etc/default/$pkgname"
2012-08-07 16:11:48 +00:00
install -Dm 644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
install -Dm 755 $pkgname.systemd "$pkgdir/usr/lib/systemd/scripts/$pkgname"
2012-07-23 23:25:09 +00:00
}
2012-08-07 16:11:48 +00:00
2012-08-09 13:40:15 +00:00
package_usbip() {
pkgdesc='An USB device sharing system over IP network'
2019-03-05 04:05:30 +00:00
depends=('glibc' 'glib2' 'sysfsutils' 'systemd-libs')
2012-08-09 13:40:15 +00:00
2014-10-06 01:22:49 +00:00
pushd linux-$pkgver/tools/usb/usbip
2012-08-09 13:40:15 +00:00
make install DESTDIR="$pkgdir"
popd
# module loading
install -Dm 644 /dev/null "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
printf 'usbip-core\nusbip-host\n' > "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
2013-02-19 20:07:36 +00:00
# systemd
2012-08-09 13:40:15 +00:00
install -Dm 644 usbipd.service "$pkgdir/usr/lib/systemd/system/usbipd.service"
}
2014-01-21 01:36:06 +00:00
package_tmon() {
pkgdesc='Monitoring and Testing Tool for Linux kernel thermal subsystem'
depends=('glibc' 'ncurses')
cd linux-$pkgver/tools/thermal/tmon
make install INSTALL_ROOT="$pkgdir"
}
2017-09-06 00:56:23 +00:00
package_hyperv() {
pkgdesc='Hyper-V tools'
depends=('glibc')
cd linux-$pkgver/tools/hv
2024-07-23 00:20:32 +00:00
make install DESTDIR="$pkgdir" sbindir=/usr/bin libexecdir=/usr/lib
for _p in hv_kvp_daemon hv_vss_daemon; do
2019-09-16 13:21:22 +00:00
install -Dm644 "$srcdir/$_p.service" "$pkgdir/usr/lib/systemd/system/$_p.service"
2017-09-06 00:56:23 +00:00
done
}
2017-02-28 01:53:16 +00:00
package_gpio-utils() {
pkgdesc='GPIO character device utilities'
depends=('glibc')
cd linux-$pkgver/tools/gpio
make install DESTDIR="$pkgdir"
}
package_iio-utils() {
pkgdesc='Industrial IO utilities'
depends=('glibc')
cd linux-$pkgver/tools/iio
2017-12-10 14:32:14 +00:00
make install DESTDIR="$pkgdir"
2017-02-28 01:53:16 +00:00
}
2019-01-03 02:54:34 +00:00
package_bpf() {
pkgdesc='BPF tools'
2023-06-03 18:32:34 +00:00
depends=('glibc' 'readline' 'zlib' 'libelf' 'libcap' 'zstd' 'llvm-libs' 'binutils')
2019-01-03 02:54:34 +00:00
2019-01-03 04:12:53 +00:00
cd linux-$pkgver/tools/bpf
2020-04-02 00:36:32 +00:00
# skip runsqlower until disabled in build
make -W runqslower_install install prefix=/usr DESTDIR="$pkgdir"
2019-01-03 02:54:34 +00:00
# fix bpftool hard written path
mv "$pkgdir"/usr/sbin/bpftool "$pkgdir"/usr/bin/bpftool
rmdir "$pkgdir"/usr/sbin
2019-09-16 13:21:22 +00:00
# install man pages
2019-12-02 13:43:28 +00:00
make -C bpftool doc-install prefix=/usr/share DESTDIR="$pkgdir"
2019-01-03 02:54:34 +00:00
}
2021-11-02 18:21:55 +00:00
package_bootconfig() {
pkgdesc='Apply, delete or show boot config to initrd'
depends=('glibc')
2021-11-02 19:20:35 +00:00
cd linux-$pkgver/tools/bootconfig
2021-11-02 18:21:55 +00:00
install -dm755 "$pkgdir/usr/bin"
make install DESTDIR="$pkgdir"
}
2012-12-15 02:14:36 +00:00
# vim:set ts=2 sw=2 et: