Blame kernel-tools.spec

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