273 lines
7.3 KiB
Bash
273 lines
7.3 KiB
Bash
# Template file for 'linux-tools'
|
|
pkgname=linux-tools
|
|
version=5.10.4
|
|
revision=10
|
|
build_style=meta
|
|
hostmakedepends="asciidoc automake flex gettext libtool perl python3
|
|
python3-docutils xmlto"
|
|
makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
|
|
libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
|
|
libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
|
|
slang-devel libaudit-devel"
|
|
depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
|
|
short_desc="Linux kernel tools meta-pkg"
|
|
maintainer="Enno Boland <gottox@voidlinux.org>"
|
|
license="GPL-2.0-only"
|
|
homepage="https://www.kernel.org"
|
|
distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
|
|
checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
|
|
python_version=3
|
|
|
|
subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
|
|
|
|
CFLAGS="-Wno-error -fcommon"
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*|x86_64*)
|
|
makedepends+=" libnuma-devel"
|
|
depends+=" x86_energy_perf_policy>=${version} turbostat>=${version}"
|
|
subpackages+=" x86_energy_perf_policy turbostat"
|
|
;;
|
|
ppc64*)
|
|
makedepends+=" libnuma-devel"
|
|
;;
|
|
esac
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) ;;
|
|
*) subpackages+=" bpftool";; # needs FTW_ACTIONRETVAL
|
|
esac
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686-musl) makedepends+=" libunwind-devel" ;;
|
|
esac
|
|
|
|
post_extract() {
|
|
vsed -i 's/\$(LIBS)/& $(LDFLAGS)/' tools/power/cpupower/bench/Makefile
|
|
vsed -i 's/ \-Werror / /g' tools/build/feature/Makefile \
|
|
tools/lib/bpf/Makefile
|
|
}
|
|
|
|
pre_configure() {
|
|
echo "#define PERF_VERSION \"${version}_${revision}\"" \
|
|
>tools/perf/PERF-VERSION-FILE
|
|
}
|
|
|
|
do_build() {
|
|
local arch subarch
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*) arch=i386;;
|
|
x86_64*) arch=x86_64;;
|
|
arm*) arch=arm;;
|
|
aarch64*) arch=arm64;;
|
|
ppc64le*) arch=powerpc; subarch=ppc64le;;
|
|
ppc64*) arch=powerpc; subarch=ppc64;;
|
|
ppc*) arch=powerpc; subarch=ppc;;
|
|
mips*) arch=mips;;
|
|
esac
|
|
|
|
make -C tools/build V=1 \
|
|
CC=$CC LD=$LD \
|
|
CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" \
|
|
LDFLAGS="$LDFLAGS" \
|
|
WERROR=0 NO_GTK2=1 NO_SDT=1 PYTHON=python3
|
|
|
|
make -C tools/perf ${makejobs} V=1 ARCH=$arch \
|
|
CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
|
|
WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
|
|
NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
|
|
all man
|
|
|
|
make -C tools/power/cpupower V=1 ARCH=$arch \
|
|
CC=$CC LDFLAGS="$LDFLAGS" VERSION=${version}_${revision}
|
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*|x86_64*)
|
|
make -C tools/power/x86/x86_energy_perf_policy ${makejobs} V=1 \
|
|
ARCH=${arch}
|
|
|
|
make -C tools/power/x86/turbostat ${makejobs} V=1 ARCH=$arch \
|
|
CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
|
|
esac
|
|
|
|
make -C tools/laptop/freefall
|
|
|
|
cd ${wrksrc}/tools/usb/usbip
|
|
# fix missing man page
|
|
sed -i 's/usbip_bind_driver.8//' Makefile.am
|
|
./autogen.sh
|
|
./configure --prefix=/usr --sbindir=/usr/bin \
|
|
--build=$XBPS_TRIPLET --host=$XBPS_CROSS_TRIPLET \
|
|
--with-sysroot=$XBPS_CROSS_BASE
|
|
make ${makejobs}
|
|
|
|
cd $wrksrc
|
|
make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
|
|
CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
|
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) ;;
|
|
*)
|
|
make -C tools/bpf/bpftool ARCH=$arch all doc
|
|
make -C tools/bpf/bpftool ARCH=$arch -W runqslower
|
|
esac
|
|
}
|
|
|
|
do_install() {
|
|
local arch subarch
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*) arch=i386;;
|
|
x86_64*) arch=x86_64;;
|
|
arm*) arch=arm;;
|
|
aarch64*) arch=arm64;;
|
|
ppc64le*) arch=powerpc; subarch=ppc64le;;
|
|
ppc64*) arch=powerpc; subarch=ppc64;;
|
|
ppc*) arch=powerpc; subarch=ppc;;
|
|
mips*) arch=mips;;
|
|
esac
|
|
|
|
# cpupower
|
|
cd ${wrksrc}/tools/power/cpupower
|
|
make DESTDIR=${DESTDIR} ARCH=$arch \
|
|
sbindir='/usr/bin' \
|
|
mandir='/usr/share/man' \
|
|
docdir='/usr/share/doc/cpupower' \
|
|
install install-man
|
|
|
|
# freefall
|
|
vbin "${wrksrc}/tools/laptop/freefall/freefall"
|
|
|
|
# perf
|
|
cd ${wrksrc}/tools/perf
|
|
make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
|
|
WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
|
|
NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
|
|
install install-man
|
|
# move completion in new directory
|
|
vmkdir usr/share/bash-completion/completions
|
|
mv ${DESTDIR}/etc/bash_completion.d/perf \
|
|
${DESTDIR}/usr/share/bash-completion/completions
|
|
|
|
# usbip
|
|
cd ${wrksrc}/tools/usb/usbip
|
|
make install ARCH=$arch DESTDIR=${DESTDIR}
|
|
vmkdir usr/lib/modules-load.d
|
|
printf '%s\n' usbip-core usbip-host \
|
|
>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
|
|
|
|
# bpf
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl) ;;
|
|
*)
|
|
cd ${wrksrc}/tools/bpf
|
|
make -W runqslower_install install \
|
|
DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
|
|
make -C bpftool doc-install \
|
|
DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
|
|
rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
|
|
mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
|
|
esac
|
|
|
|
rm ${DESTDIR}/usr/include/cpuidle.h
|
|
}
|
|
|
|
bpftool_package() {
|
|
short_desc="Linux kernel tools for BPF"
|
|
pkg_install() {
|
|
vmove "usr/bin/bpf*"
|
|
vmove usr/share/bash-completion/completions/bpftool
|
|
vmove "usr/share/man/man8/bpf*"
|
|
}
|
|
}
|
|
cpupower_package() {
|
|
short_desc="Linux kernel tool to set CPU power features"
|
|
conf_files="/etc/cpufreq-bench.conf"
|
|
pkg_install() {
|
|
vmove "usr/bin/cpu*"
|
|
vmove "usr/share/man/man1/cpu*"
|
|
vmove usr/share/bash-completion/completions/cpupower
|
|
vmove usr/share/doc/cpupower
|
|
vmove usr/share/locale
|
|
vmove etc/cpufreq-bench.conf
|
|
}
|
|
}
|
|
libcpupower_package() {
|
|
short_desc="Linux kernel tool to set CPU power features - runtime library"
|
|
pkg_install() {
|
|
vmove "usr/lib/libcpupower.so.*"
|
|
}
|
|
}
|
|
libcpupower-devel_package() {
|
|
short_desc="Linux kernel tool to set CPU power features - development files"
|
|
depends="libcpupower-${version}_${revision}"
|
|
pkg_install() {
|
|
vmove usr/include/cpufreq.h
|
|
vmove usr/lib/libcpupower.so
|
|
}
|
|
}
|
|
libusbip_package() {
|
|
short_desc="USB device sharing system over IP network - runtime library"
|
|
pkg_install() {
|
|
vmove "usr/lib/libusbip.so.*"
|
|
}
|
|
}
|
|
libusbip-devel_package() {
|
|
short_desc="USB device sharing system over IP network - development files"
|
|
depends="libusbip-${version}_${revision}"
|
|
pkg_install() {
|
|
vmove usr/include/usbip
|
|
vmove usr/lib/libusbip.a
|
|
vmove usr/lib/libusbip.so
|
|
}
|
|
}
|
|
perf_package() {
|
|
short_desc="Linux kernel performance auditing tool"
|
|
pkg_install() {
|
|
vmove usr/bin/perf
|
|
vmove usr/bin/trace
|
|
vmove usr/lib/perf
|
|
vmove usr/libexec/perf-core
|
|
vmove usr/share/bash-completion/completions/perf
|
|
vmove usr/share/perf-core
|
|
vmove /usr/share/doc/perf-tip
|
|
vmove "usr/share/man/man1/perf*"
|
|
}
|
|
}
|
|
x86_energy_perf_policy_package() {
|
|
short_desc="Read or write MSR_IA32_ENERGY_PERF_BIAS"
|
|
pkg_install() {
|
|
cd ${wrksrc}/tools/power/x86/x86_energy_perf_policy
|
|
vbin x86_energy_perf_policy
|
|
vman x86_energy_perf_policy.8
|
|
}
|
|
}
|
|
usbip_package() {
|
|
short_desc="USB device sharing system over IP network"
|
|
pkg_install() {
|
|
vmove "usr/bin/usbip*"
|
|
vmove "usr/share/man/man8/usbip*"
|
|
vmove usr/lib/modules-load.d/usbip.conf
|
|
vsv usbipd
|
|
}
|
|
}
|
|
freefall_package() {
|
|
short_desc="Disk protection for HP/DELL machines"
|
|
pkg_install() {
|
|
vmove usr/bin/freefall
|
|
vsv freefall
|
|
}
|
|
}
|
|
turbostat_package() {
|
|
short_desc="Report processor frequency and idle statistics"
|
|
pkg_install() {
|
|
cd ${wrksrc}/tools/power/x86/turbostat
|
|
vbin turbostat
|
|
vman turbostat.8
|
|
}
|
|
}
|
|
tmon_package() {
|
|
short_desc="Monitoring and Testing Tool for Linux kernel thermal subsystem"
|
|
pkg_install() {
|
|
cd ${wrksrc}/tools/thermal/tmon
|
|
vbin tmon
|
|
vman tmon.8
|
|
}
|
|
}
|