PKGBUILDs/community/linux-tools/PKGBUILD

296 lines
7.7 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=(
2019-01-03 02:54:34 +00:00
'bpf'
2014-01-21 01:36:06 +00:00
'cgroup_event_listener'
'cpupower'
2017-09-06 00:56:23 +00:00
'hyperv'
2014-01-21 01:36:06 +00:00
'linux-tools-meta'
'perf'
2019-07-15 00:48:37 +00:00
# 'python-perf'
2014-01-21 01:36:06 +00:00
'tmon'
'usbip'
2017-02-28 01:53:16 +00:00
'gpio-utils'
'iio-utils'
2014-01-21 01:36:06 +00:00
)
2021-07-11 16:55:35 +00:00
pkgver=5.13
2021-02-16 15:03:28 +00:00
pkgrel=1
2012-07-23 23:25:09 +00:00
license=('GPL2')
2017-12-10 14:07:27 +00:00
arch=('x86_64')
2016-12-31 15:16:39 +00:00
url='https://www.kernel.org'
2018-04-02 00:41:40 +00:00
options=('!strip' '!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
2020-12-21 15:32:25 +00:00
makedepends+=('perl' 'python' 'slang' 'elfutils' 'libunwind' 'audit' 'zstd' 'libcap')
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')
2012-08-09 13:40:15 +00:00
groups=("$pkgbase")
2019-03-05 04:05:30 +00:00
source=("https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${pkgver}.tar.xz"
2021-02-16 15:03:28 +00:00
# "https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-$pkgver.1.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_fcopy_daemon.service'
'hv_kvp_daemon.service'
'hv_vss_daemon.service')
2021-07-11 16:55:35 +00:00
sha256sums=('3f6baa97f37518439f51df2e4f3d65a822ca5ff016aa8e60d2cc53b95a6c89d9'
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'
'16855c197d2334f820cb190312a5a7fffe9165189db01344a957e582e39e17d8'
'b1315cb77a35454e1af9172f821a52e2a0cb18561be05a340d21cf337b01ae61'
'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
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 \
NO_SDT=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 \
2012-07-23 23:25:09 +00:00
PERF_VERSION=$pkgver-$pkgrel \
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 ':: cgroup_event_listener'
2014-01-21 01:36:06 +00:00
pushd linux-$pkgver/tools/cgroup
make
popd
2017-02-28 01:53:16 +00:00
2020-02-16 17:55:39 +00:00
echo ':: hv'
2017-09-06 00:56:23 +00:00
pushd linux-$pkgver/tools/hv
2019-12-02 13:43:28 +00:00
CFLAGS+=' -DKVP_SCRIPTS_PATH=\"/usr/lib/hyperv/kvp_scripts/\"' 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
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=(
2019-01-03 02:54:34 +00:00
'bpf'
2014-01-21 01:36:06 +00:00
'cgroup_event_listener'
'cpupower'
2017-09-06 00:56:23 +00:00
'hyperv'
2014-01-21 01:36:06 +00:00
'perf'
2019-07-15 00:48:37 +00:00
# 'python-perf'
2014-01-21 01:36:06 +00:00
'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'
'zstd' 'libcap')
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 \
NO_SDT=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 \
2012-07-23 23:25:09 +00:00
PERF_VERSION=$pkgver-$pkgrel \
2016-10-09 15:15:45 +00:00
DESTDIR="$pkgdir" \
2019-12-02 13:43:28 +00:00
install
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
}
2019-07-15 00:48:37 +00:00
#package_python-perf(){
# pkgdesc='Linux kernel performance auditing tool (python bindings)'
# depends=('python')
#
# cd linux/tools/perf
#
# make install-python_ext PYTHON=python DESTDIR="$pkgdir"
#}
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"
}
package_cgroup_event_listener() {
pkgdesc='Simple listener of cgroup events'
depends=('glibc')
cd linux-$pkgver/tools/cgroup
install -Dm755 cgroup_event_listener "$pkgdir/usr/bin/cgroup_event_listener"
}
2017-09-06 00:56:23 +00:00
package_hyperv() {
pkgdesc='Hyper-V tools'
depends=('glibc')
cd linux-$pkgver/tools/hv
for _p in hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon; do
install -Dm755 "$_p" "$pkgdir/usr/bin/$_p"
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-12-10 14:07:27 +00:00
install -dm755 "$pkgdir/usr/lib/hyperv/kvp_scripts"
2017-09-06 00:56:23 +00:00
}
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'
2020-12-21 15:32:25 +00:00
depends=('glibc' 'readline' 'zlib' 'libelf' 'libcap')
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
}
2012-12-15 02:14:36 +00:00
# vim:set ts=2 sw=2 et: