Blame kernel-tools.spec

Laura Abbott a8f134
# Much of this is borrowed from the original kernel.spec
Laura Abbott a8f134
# It needs a bunch of the macros for rawhide vs. not-rawhide builds.
Laura Abbott a8f134
Laura Abbott a8f134
# For a stable, released kernel, released_kernel should be 1. For rawhide
Laura Abbott a8f134
# and/or a kernel built from an rc or git snapshot, released_kernel should
Laura Abbott a8f134
# be 0.
Laura Abbott a8f134
%global released_kernel 0
Björn Esser 861533
%global baserelease 2
Laura Abbott a8f134
%global fedora_build %{baserelease}
Laura Abbott a8f134
Laura Abbott a8f134
# base_sublevel is the kernel version we're starting with and patching
Laura Abbott a8f134
# on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base,
Laura Abbott a8f134
# which yields a base_sublevel of 0.
Laura Abbott a8f134
%global base_sublevel 14
Laura Abbott a8f134
Laura Abbott a8f134
## If this is a released kernel ##
Laura Abbott a8f134
%if 0%{?released_kernel}
Laura Abbott a8f134
Laura Abbott a8f134
# Do we have a -stable update to apply?
Laura Abbott a8f134
%global stable_update 0
Laura Abbott a8f134
# Set rpm version accordingly
Laura Abbott a8f134
%if 0%{?stable_update}
Laura Abbott a8f134
%global stablerev %{stable_update}
Laura Abbott a8f134
%global stable_base %{stable_update}
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%global rpmversion 4.%{base_sublevel}.%{stable_update}
Laura Abbott a8f134
Laura Abbott a8f134
## The not-released-kernel case ##
Laura Abbott a8f134
%else
Laura Abbott a8f134
# The next upstream release sublevel (base_sublevel+1)
Laura Abbott a8f134
%global upstream_sublevel %(echo $((%{base_sublevel} + 1)))
Laura Abbott a8f134
# The rc snapshot level
Laura Abbott 517085
%global rcrev 8
Laura Abbott a8f134
# Set rpm version accordingly
Laura Abbott a8f134
%global rpmversion 4.%{upstream_sublevel}.0
Laura Abbott a8f134
%endif
Laura Abbott a8f134
# Nb: The above rcrev values automagically define Patch00 and Patch01 below.
Laura Abbott a8f134
Laura Abbott a8f134
# pkg_release is what we'll fill in for the rpm Release: field
Laura Abbott a8f134
%if 0%{?released_kernel}
Laura Abbott a8f134
Laura Abbott a8f134
%global pkg_release %{fedora_build}%{?buildid}%{?dist}
Laura Abbott a8f134
Laura Abbott a8f134
%else
Laura Abbott a8f134
Laura Abbott a8f134
# non-released_kernel
Laura Abbott a8f134
%if 0%{?rcrev}
Laura Abbott a8f134
%global rctag .rc%rcrev
Laura Abbott a8f134
%else
Laura Abbott a8f134
%global rctag .rc0
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%global gittag .git0
Laura Abbott a8f134
%global pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}%{?dist}
Laura Abbott a8f134
Laura Abbott a8f134
%endif
Laura Abbott a8f134
Laura Abbott a8f134
# The kernel tarball/base version
Laura Abbott a8f134
%global kversion 4.%{base_sublevel}
Laura Abbott a8f134
%global KVERREL %{version}-%{release}.%{_target_cpu}
Laura Abbott a8f134
Laura Abbott a8f134
%global _debuginfo_subpackages 1
Laura Abbott a8f134
%undefine _include_gdb_index
Laura Abbott a8f134
%undefine _include_minidebuginfo
Laura Abbott a8f134
Laura Abbott a8f134
BuildRequires: kmod, patch, bash, tar, git
Laura Abbott a8f134
BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl(Carp), perl-devel, perl-generators, make, diffutils, gawk
Laura Abbott a8f134
BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc
Laura Abbott a8f134
BuildRequires: net-tools, hostname, bc, elfutils-devel
Laura Abbott a8f134
BuildRequires: zlib-devel binutils-devel newt-devel python2-devel perl(ExtUtils::Embed) bison flex xz-devel
Laura Abbott a8f134
BuildRequires: audit-libs-devel
Laura Abbott a8f134
%ifnarch s390x %{arm}
Laura Abbott a8f134
BuildRequires: numactl-devel
Laura Abbott a8f134
%endif
Laura Abbott a8f134
BuildRequires: pciutils-devel gettext ncurses-devel
Laura Abbott a8f134
BuildConflicts: rhbuildsys(DiskFree) < 500Mb
Laura Abbott a8f134
BuildRequires: rpm-build, elfutils
Laura Abbott a8f134
%{?systemd_requires}
Laura Abbott a8f134
BuildRequires: systemd
Laura Abbott a8f134
Laura Abbott a8f134
Source0: https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{kversion}.tar.xz
Laura Abbott a8f134
Source10: perf-man-%{kversion}.tar.gz
Laura Abbott a8f134
Laura Abbott a8f134
# Sources for kernel-tools
Laura Abbott a8f134
Source2000: cpupower.service
Laura Abbott a8f134
Source2001: cpupower.config
Laura Abbott a8f134
Laura Abbott a8f134
# Here should be only the patches up to the upstream canonical Linus tree.
Laura Abbott a8f134
Laura Abbott a8f134
# For a stable release kernel
Laura Abbott a8f134
%if 0%{?stable_base}
Laura Abbott a8f134
Source5000: patch-4.%{base_sublevel}.%{stable_base}.xz
Laura Abbott a8f134
%else
Laura Abbott a8f134
# non-released_kernel case
Laura Abbott a8f134
# These are automagically defined by the rcrev value set up
Laura Abbott a8f134
# near the top of this spec file.
Laura Abbott a8f134
%if 0%{?rcrev}
Laura Abbott a8f134
Source5000: patch-4.%{upstream_sublevel}-rc%{rcrev}.xz
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%endif
Laura Abbott a8f134
Laura Abbott a8f134
# ongoing complaint, full discussion delayed until ksummit/plumbers
Laura Abbott a8f134
Patch0: 0001-iio-Use-event-header-from-kernel-tree.patch
Laura Abbott a8f134
Laura Abbott a8f134
# rpmlint cleanup
Laura Abbott a8f134
Patch1: 0001-perf-Remove-FSF-address.patch
Laura Abbott a8f134
Patch2: 0001-cpupower-Remove-FSF-address.patch
Laura Abbott a8f134
Patch3: 0001-tools-include-Sync-vmx.h-header-for-FSF-removal.patch
Laura Abbott a8f134
Patch4: 0001-tools-lib-Remove-FSF-address.patch
Laura Abbott a8f134
Patch5: 0001-tools-power-Don-t-make-man-pages-executable.patch
Laura Abbott a8f134
Patch6: 0002-perf-Don-t-make-sourced-script-executable.patch
Laura Abbott a8f134
Name: kernel-tools
Laura Abbott a8f134
Summary: Assortment of tools for the Linux kernel
Laura Abbott a8f134
License: GPLv2
Laura Abbott a8f134
URL: http://www.kernel.org/
Laura Abbott a8f134
Version: %{rpmversion}
Laura Abbott a8f134
Release: %{pkg_release}
Laura Abbott a8f134
Provides:  cpupowerutils = 1:009-0.6.p1
Laura Abbott a8f134
Obsoletes: cpupowerutils < 1:009-0.6.p1
Laura Abbott a8f134
Provides:  cpufreq-utils = 1:009-0.6.p1
Laura Abbott a8f134
Provides:  cpufrequtils = 1:009-0.6.p1
Laura Abbott a8f134
Obsoletes: cpufreq-utils < 1:009-0.6.p1
Laura Abbott a8f134
Obsoletes: cpufrequtils < 1:009-0.6.p1
Laura Abbott a8f134
Obsoletes: cpuspeed < 1:1.5-16
Laura Abbott a8f134
Requires: kernel-tools-libs = %{version}-%{release}
Laura Abbott a8f134
%description -n kernel-tools
Laura Abbott a8f134
This package contains the tools/ directory from the kernel source
Laura Abbott a8f134
and the supporting documentation.
Laura Abbott a8f134
Laura Abbott a8f134
Laura Abbott a8f134
%package -n perf
Laura Abbott a8f134
Summary: Performance monitoring for the Linux kernel
Laura Abbott a8f134
License: GPLv2
Laura Abbott a8f134
%description -n perf
Laura Abbott a8f134
This package contains the perf tool, which enables performance monitoring
Laura Abbott a8f134
of the Linux kernel.
Laura Abbott a8f134
Jeremy Cline 5c7275
%package -n python2-perf
Laura Abbott a8f134
Summary: Python bindings for apps which will manipulate perf events
Jeremy Cline 5c7275
%{?python_provide:%python_provide python2-perf}
Jeremy Cline 5c7275
%description -n python2-perf
Jeremy Cline 5c7275
The python2-perf package contains a module that permits applications
Laura Abbott a8f134
written in the Python programming language to use the interface
Laura Abbott a8f134
to manipulate perf events.
Laura Abbott a8f134
Laura Abbott a8f134
%package -n kernel-tools-libs
Laura Abbott a8f134
Summary: Libraries for the kernels-tools
Laura Abbott a8f134
License: GPLv2
Laura Abbott a8f134
%description -n kernel-tools-libs
Laura Abbott a8f134
This package contains the libraries built from the tools/ directory
Laura Abbott a8f134
from the kernel source.
Laura Abbott a8f134
Laura Abbott a8f134
%package -n kernel-tools-libs-devel
Laura Abbott a8f134
Summary: Assortment of tools for the Linux kernel
Laura Abbott a8f134
License: GPLv2
Laura Abbott a8f134
Requires: kernel-tools = %{version}-%{release}
Laura Abbott a8f134
Provides:  cpupowerutils-devel = 1:009-0.6.p1
Laura Abbott a8f134
Obsoletes: cpupowerutils-devel < 1:009-0.6.p1
Laura Abbott a8f134
Requires: kernel-tools-libs = %{version}-%{release}
Laura Abbott a8f134
Provides: kernel-tools-devel
Laura Abbott a8f134
%description -n kernel-tools-libs-devel
Laura Abbott a8f134
This package contains the development files for the tools/ directory from
Laura Abbott a8f134
the kernel source.
Laura Abbott a8f134
Laura Abbott a8f134
%prep
Laura Abbott a8f134
%setup -q -n kernel-%{kversion}%{?dist} -c
Laura Abbott a8f134
Laura Abbott a8f134
cd linux-%{kversion}
Laura Abbott a8f134
Laura Abbott a8f134
# This is for patching either an -rc or stable
Laura Abbott a8f134
%if 0%{?rcrev}
Laura Abbott a8f134
    xzcat %{SOURCE5000} | patch -p1 -F1 -s
Laura Abbott a8f134
%endif
Laura Abbott a8f134
Laura Abbott a8f134
%if 0%{?stable_base}
Laura Abbott a8f134
    xzcat %{SOURCE5000} | patch -p1 -F1 -s
Laura Abbott a8f134
%endif
Laura Abbott a8f134
Laura Abbott a8f134
%patch0 -p1
Laura Abbott a8f134
%patch1 -p1
Laura Abbott a8f134
%patch2 -p1
Laura Abbott a8f134
%patch3 -p1
Laura Abbott a8f134
%patch4 -p1
Laura Abbott a8f134
%patch5 -p1
Laura Abbott a8f134
%patch6 -p1
Laura Abbott a8f134
Laura Abbott a8f134
# END OF PATCH APPLICATIONS
Laura Abbott a8f134
Jeremy Cline f23d40
# Explicitly use Python 3 for kvm_stat
Jeremy Cline f23d40
sed -i '1s=^#!/usr/bin/python=#!%{__python3}=' tools/kvm/kvm_stat/kvm_stat
Jeremy Cline f23d40
Laura Abbott a8f134
###
Laura Abbott a8f134
### build
Laura Abbott a8f134
###
Laura Abbott a8f134
%build
Laura Abbott a8f134
Laura Abbott a8f134
cd linux-%{kversion}
Laura Abbott a8f134
Laura Abbott a8f134
%global perf_make \
Laura Abbott a8f134
  make -s EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 NO_JVMTI=1 prefix=%{_prefix}
Laura Abbott a8f134
# perf
Laura Abbott a8f134
# make sure check-headers.sh is executable
Laura Abbott a8f134
chmod +x tools/perf/check-headers.sh
Laura Abbott a8f134
%{perf_make} all
Laura Abbott a8f134
Laura Abbott a8f134
# cpupower
Laura Abbott a8f134
# make sure version-gen.sh is executable.
Laura Abbott a8f134
chmod +x tools/power/cpupower/utils/version-gen.sh
Laura Abbott a8f134
make %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false
Laura Abbott a8f134
%ifarch %{ix86}
Laura Abbott a8f134
    pushd tools/power/cpupower/debug/i386
Laura Abbott a8f134
    make %{?_smp_mflags} centrino-decode powernow-k8-decode
Laura Abbott a8f134
    popd
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%ifarch x86_64
Laura Abbott a8f134
    pushd tools/power/cpupower/debug/x86_64
Laura Abbott a8f134
    make %{?_smp_mflags} centrino-decode powernow-k8-decode
Laura Abbott a8f134
    popd
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%ifarch %{ix86} x86_64
Laura Abbott a8f134
   pushd tools/power/x86/x86_energy_perf_policy/
Laura Abbott a8f134
   make
Laura Abbott a8f134
   popd
Laura Abbott a8f134
   pushd tools/power/x86/turbostat
Laura Abbott a8f134
   make
Laura Abbott a8f134
   popd
Laura Abbott a8f134
%endif #turbostat/x86_energy_perf_policy
Laura Abbott a8f134
pushd tools/thermal/tmon/
Laura Abbott a8f134
make
Laura Abbott a8f134
popd
Laura Abbott a8f134
pushd tools/iio/
Laura Abbott a8f134
make
Laura Abbott a8f134
popd
Laura Abbott a8f134
pushd tools/gpio/
Laura Abbott a8f134
make
Laura Abbott a8f134
popd
Laura Abbott a8f134
Laura Abbott a8f134
###
Laura Abbott a8f134
### install
Laura Abbott a8f134
###
Laura Abbott a8f134
Laura Abbott a8f134
%install
Laura Abbott a8f134
Laura Abbott a8f134
cd linux-%{kversion}
Laura Abbott a8f134
Laura Abbott a8f134
# perf tool binary and supporting scripts/binaries
Laura Abbott a8f134
%{perf_make} DESTDIR=%{buildroot} lib=%{_lib} install-bin install-traceevent-plugins
Laura Abbott a8f134
# remove the 'trace' symlink.
Laura Abbott a8f134
rm -f %{buildroot}%{_bindir}/trace
Laura Abbott a8f134
# remove the perf-tips
Laura Abbott a8f134
rm -rf %{buildroot}%{_docdir}/perf-tip
Laura Abbott a8f134
Laura Abbott a8f134
# python-perf extension
Laura Abbott a8f134
%{perf_make} DESTDIR=%{buildroot} install-python_ext
Laura Abbott a8f134
Laura Abbott a8f134
# perf man pages (note: implicit rpm magic compresses them later)
Laura Abbott a8f134
mkdir -p %{buildroot}/%{_mandir}/man1
Laura Abbott a8f134
pushd %{buildroot}/%{_mandir}/man1
Laura Abbott a8f134
tar -xf %{SOURCE10}
Laura Abbott a8f134
popd
Laura Abbott a8f134
Laura Abbott a8f134
make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
Laura Abbott a8f134
rm -f %{buildroot}%{_libdir}/*.{a,la}
Laura Abbott a8f134
%find_lang cpupower
Laura Abbott a8f134
mv cpupower.lang ../
Laura Abbott a8f134
%ifarch %{ix86}
Laura Abbott a8f134
    pushd tools/power/cpupower/debug/i386
Laura Abbott a8f134
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
Laura Abbott a8f134
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
Laura Abbott a8f134
    popd
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%ifarch x86_64
Laura Abbott a8f134
    pushd tools/power/cpupower/debug/x86_64
Laura Abbott a8f134
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
Laura Abbott a8f134
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
Laura Abbott a8f134
    popd
Laura Abbott a8f134
%endif
Laura Abbott a8f134
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
Laura Abbott a8f134
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
Laura Abbott a8f134
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
Laura Abbott a8f134
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
Laura Abbott a8f134
%ifarch %{ix86} x86_64
Laura Abbott a8f134
   mkdir -p %{buildroot}%{_mandir}/man8
Laura Abbott a8f134
   pushd tools/power/x86/x86_energy_perf_policy
Laura Abbott a8f134
   make DESTDIR=%{buildroot} install
Laura Abbott a8f134
   popd
Laura Abbott a8f134
   pushd tools/power/x86/turbostat
Laura Abbott a8f134
   make DESTDIR=%{buildroot} install
Laura Abbott a8f134
   popd
Laura Abbott a8f134
%endif #turbostat/x86_energy_perf_policy
Laura Abbott a8f134
pushd tools/thermal/tmon
Laura Abbott a8f134
make INSTALL_ROOT=%{buildroot} install
Laura Abbott a8f134
popd
Laura Abbott a8f134
pushd tools/iio
Laura Abbott a8f134
make DESTDIR=%{buildroot} install
Laura Abbott a8f134
popd
Laura Abbott a8f134
pushd tools/gpio
Laura Abbott a8f134
make DESTDIR=%{buildroot} install
Laura Abbott a8f134
popd
Laura Abbott a8f134
pushd tools/kvm/kvm_stat
Laura Abbott a8f134
make INSTALL_ROOT=%{buildroot} install-tools
Laura Abbott a8f134
popd
Laura Abbott a8f134
Laura Abbott a8f134
###
Laura Abbott a8f134
### scripts
Laura Abbott a8f134
###
Laura Abbott a8f134
Laura Abbott a8f134
%post -n kernel-tools-libs -p /sbin/ldconfig
Laura Abbott a8f134
Laura Abbott a8f134
%postun -n kernel-tools-libs -p /sbin/ldconfig
Laura Abbott a8f134
Laura Abbott a8f134
%post -n kernel-tools
Laura Abbott a8f134
%systemd_post cpupower.service
Laura Abbott a8f134
Laura Abbott a8f134
%preun -n kernel-tools
Laura Abbott a8f134
%systemd_preun cpupower.service
Laura Abbott a8f134
Laura Abbott a8f134
%postun
Laura Abbott a8f134
%systemd_postun cpupower.service
Laura Abbott a8f134
Laura Abbott a8f134
%files -n perf
Laura Abbott a8f134
%{_bindir}/perf
Laura Abbott a8f134
%dir %{_libdir}/traceevent
Laura Abbott a8f134
%{_libdir}/traceevent/plugins/
Laura Abbott a8f134
%{_libexecdir}/perf-core
Laura Abbott a8f134
%{_datadir}/perf-core/
Laura Abbott a8f134
%{_mandir}/man[1-8]/perf*
Laura Abbott a8f134
%{_sysconfdir}/bash_completion.d/perf
Laura Abbott a8f134
%doc linux-%{kversion}/tools/perf/Documentation/examples.txt
Laura Abbott a8f134
%license linux-%{kversion}/COPYING
Laura Abbott a8f134
Jeremy Cline 5c7275
%files -n python2-perf
Laura Abbott a8f134
%license linux-%{kversion}/COPYING
Laura Abbott 2dc00b
%{python2_sitearch}
Laura Abbott a8f134
Laura Abbott a8f134
%files -n kernel-tools -f cpupower.lang
Laura Abbott a8f134
%{_bindir}/cpupower
Laura Abbott a8f134
%ifarch %{ix86} x86_64
Laura Abbott a8f134
%{_bindir}/centrino-decode
Laura Abbott a8f134
%{_bindir}/powernow-k8-decode
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%{_unitdir}/cpupower.service
Laura Abbott a8f134
%{_mandir}/man[1-8]/cpupower*
Laura Abbott a8f134
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
Laura Abbott a8f134
%ifarch %{ix86} x86_64
Laura Abbott a8f134
%{_bindir}/x86_energy_perf_policy
Laura Abbott a8f134
%{_mandir}/man8/x86_energy_perf_policy*
Laura Abbott a8f134
%{_bindir}/turbostat
Laura Abbott a8f134
%{_mandir}/man8/turbostat*
Laura Abbott a8f134
%endif
Laura Abbott a8f134
%{_bindir}/tmon
Laura Abbott a8f134
%{_bindir}/iio_event_monitor
Laura Abbott a8f134
%{_bindir}/iio_generic_buffer
Laura Abbott a8f134
%{_bindir}/lsiio
Laura Abbott a8f134
%{_bindir}/lsgpio
Laura Abbott a8f134
%{_bindir}/gpio-hammer
Laura Abbott a8f134
%{_bindir}/gpio-event-mon
Laura Abbott a8f134
%{_mandir}/man1/kvm_stat*
Laura Abbott a8f134
%{_bindir}/kvm_stat
Laura Abbott a8f134
%license linux-%{kversion}/COPYING
Laura Abbott a8f134
Laura Abbott a8f134
%files -n kernel-tools-libs
Laura Abbott a8f134
%{_libdir}/libcpupower.so.0
Laura Abbott a8f134
%{_libdir}/libcpupower.so.0.0.1
Laura Abbott a8f134
%license linux-%{kversion}/COPYING
Laura Abbott a8f134
Laura Abbott a8f134
%files -n kernel-tools-libs-devel
Laura Abbott a8f134
%{_libdir}/libcpupower.so
Laura Abbott a8f134
%{_includedir}/cpufreq.h
Laura Abbott a8f134
%{_includedir}/cpuidle.h
Laura Abbott a8f134
Laura Abbott a8f134
%changelog
Björn Esser 861533
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 4.15.0-0.rc8.git0.2
Björn Esser 861533
- Rebuilt for switch to libxcrypt
Björn Esser 861533
Laura Abbott 517085
* Tue Jan 16 2018 Laura Abbott <labbott@redhat.com> - 4.15.0-0.rc8.git0.1
Laura Abbott 517085
- Linux 4.15-rc8
Laura Abbott 517085
Laura Abbott 50e856
* Fri Jan 05 2018 Laura Abbott <labbott@redhat.com> - 4.15.0-0.rc7.git0.1
Laura Abbott a8f134
- Fork from the kernel package