PKGBUILDs/community/linux-tools/PKGBUILD

285 lines
6.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
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
'libtraceevent'
'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
)
2019-05-11 17:39:33 +00:00
pkgver=5.1
2019-06-11 04:05:37 +00:00
pkgrel=3
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
2018-10-26 12:23:53 +00:00
makedepends+=('perl' 'python' 'slang' 'elfutils' 'libunwind' 'audit' 'gtk2')
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')
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"
# 'https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-4.12.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'
2016-12-31 15:16:39 +00:00
'usbipd.service')
2019-03-05 04:05:30 +00:00
md5sums=('7381ce8aac80a01448e065ce795c19c0'
2015-11-03 00:33:56 +00:00
'56883c159381ba89e50ab8ea65efec77'
2016-04-17 12:40:18 +00:00
'34f5ecc19770a1abbcd0fd65bfd1f065'
'86c4e419e4ba80835c330d49ba3f56ad'
2016-12-31 15:16:39 +00:00
'bb35634f480325a78b943f7e10165e86')
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)
local filename
for filename in "${source[@]}"; do
2017-09-06 00:56:23 +00:00
filename="${filename##*/}"
2016-03-16 01:23:43 +00:00
if [[ "$filename" =~ \.patch$ ]]; then
2017-09-06 00:56:23 +00:00
msg2 "Applying patch $filename"
patch -p1 -N -i "$srcdir/$filename"
elif [[ "$filename" =~ ^patch- ]]; then
msg2 "Applying linux $filename"
patch -p1 -N -i "$srcdir/${filename%.*}"
2016-03-16 01:23:43 +00:00
fi
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() {
2014-01-21 01:36:06 +00:00
msg2 'libtraceevent'
2012-12-15 02:14:36 +00:00
pushd linux-$pkgver/tools/lib/traceevent
make
popd
2014-01-21 01:36:06 +00:00
msg2 '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 \
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 \
2017-09-06 00:56:23 +00:00
DESTDIR="$pkgdir" \
2012-07-23 23:25:09 +00:00
all man
popd
2014-01-21 01:36:06 +00:00
msg2 '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
2014-01-21 01:36:06 +00:00
msg2 'usbip'
2014-10-06 01:22:49 +00:00
pushd linux-$pkgver/tools/usb/usbip
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
msg2 'tmon'
pushd linux-$pkgver/tools/thermal/tmon
make
popd
msg2 'cgroup_event_listener'
pushd linux-$pkgver/tools/cgroup
make
popd
2017-02-28 01:53:16 +00:00
2017-09-06 00:56:23 +00:00
msg2 'hv'
pushd linux-$pkgver/tools/hv
2017-12-10 14:07:27 +00:00
CFLAGS+=' -DKVP_SCRIPTS_PATH=/usr/lib/hyperv/kvp_scripts/' make
2017-09-06 00:56:23 +00:00
popd
2017-02-28 01:53:16 +00:00
msg2 'gpio'
pushd linux-$pkgver/tools/gpio
2018-04-02 00:41:40 +00:00
make
2017-02-28 01:53:16 +00:00
popd
msg2 'iio'
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
msg2 'bpf'
2019-01-03 04:12:53 +00:00
pushd linux-$pkgver/tools/bpf
2019-01-03 02:54:34 +00:00
# doesn't compile when we don't first compile bpftool in its directory
cd bpftool
make
cd ..
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=(
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
'libtraceevent'
'perf'
'tmon'
'usbip'
)
2015-05-14 17:53:51 +00:00
conflicts=(
'acpidump'
)
2013-02-05 16:24:00 +00:00
}
2012-12-15 02:14:36 +00:00
package_libtraceevent() {
pkgdesc='Linux kernel trace event library'
2012-12-19 05:09:53 +00:00
depends=('glibc')
2012-12-15 02:14:36 +00:00
cd linux-$pkgver/tools/lib/traceevent
install -dm 755 "$pkgdir/usr/lib"
2014-10-06 01:22:49 +00:00
install -m 644 libtraceevent.so "$pkgdir/usr/lib"
2012-12-15 02:14:36 +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'
'audit' 'coreutils' 'glib2' 'xz' 'zlib' 'libelf' 'bash')
2015-07-26 18:03:25 +00:00
optdepends=('gtk2: support GTK2 browser for perf report')
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 \
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" \
2012-07-23 23:25:09 +00:00
install install-man
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"
}
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"
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'
depends=('glibc')
2019-01-03 04:12:53 +00:00
cd linux-$pkgver/tools/bpf
2019-01-03 02:54:34 +00:00
make install prefix=/usr DESTDIR="$pkgdir"
# fix bpftool hard written path
mv "$pkgdir"/usr/sbin/bpftool "$pkgdir"/usr/bin/bpftool
rmdir "$pkgdir"/usr/sbin
}
2012-12-15 02:14:36 +00:00
# vim:set ts=2 sw=2 et: