# TODO: reenable once we get a basic build working # https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck # see build and install -- CXXFLAGS and LDFLAGS are enough # still need to debug #undefine _auto_set_build_flags %bcond_without manpages # requires missing header to be patched in %bcond_without libbpf %if 0%{?facebook} %bcond_with perl %else %bcond_without perl %endif %global tag_version 6.12 Name: perf Version: %{tag_version}.0 Release: %autorelease Summary: Performance monitoring for the Linux kernel License: GPL-2.0-only URL: https://perf.wiki.kernel.org/ Source: https://mirrors.edge.kernel.org/pub/linux/kernel/tools/perf/v%{version}/perf-%{version}.tar.xz Source1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/arm64/include/uapi/asm/bpf_perf_event.h?h=v%{tag_version}#/bpf_perf_event_arm64.h Source2: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/s390/include/uapi/asm/bpf_perf_event.h?h=v%{tag_version}#/bpf_perf_event_s390.h # No java-devel # No point having a 32-bit perf anyway as even in Fedora the kernel is 64-bit ExcludeArch: %{ix86} BuildRequires: make BuildRequires: bison BuildRequires: flex %if 0%{?facebook} %if 0%{?el9} # Temporarily pin to building against the older clang # so this works against an older Stream snapshot BuildRequires: clang = 18.1.8-3.el9 BuildRequires: llvm-devel = 18.1.8-3.el9 %endif %else BuildRequires: clang BuildRequires: llvm-devel %endif BuildRequires: gcc BuildRequires: binutils-devel BuildRequires: capstone-devel BuildRequires: elfutils-devel BuildRequires: elfutils-libelf-devel BuildRequires: java-devel BuildRequires: libbabeltrace-devel BuildRequires: libcap-devel BuildRequires: libtraceevent-devel BuildRequires: libunwind-devel BuildRequires: libbabeltrace-devel BuildRequires: libpfm-devel BuildRequires: libstdc++-devel BuildRequires: libunwind-devel BuildRequires: numactl-devel BuildRequires: python-devel BuildRequires: python3dist(setuptools) BuildRequires: openssl-devel %if %{with perl} BuildRequires: perl-devel BuildRequires: perl-interpreter BuildRequires: perl-ExtUtils-Embed %endif BuildRequires: systemtap-sdt-devel BuildRequires: slang-devel BuildRequires: zlib-devel %if %{with manpages} BuildRequires: asciidoc BuildRequires: xmlto %endif %description This package contains the perf tool, which enables performance monitoring of the Linux kernel. %package -n libperf Summary: The perf library from kernel source %description -n libperf This package contains the kernel source perf library. %package -n libperf-devel Summary: Development files for the perf library from kernel source Requires: libperf%{?_isa} = %{version}-%{release} %description -n libperf-devel This package includes libraries and header files needed for development of applications which use perf library from kernel source. %package -n python3-perf Summary: Python bindings for apps which will manipulate perf events %description -n python3-perf The python3-perf package contains a module that permits applications written in the Python programming language to use the interface to manipulate perf events. # technically Makefile.config checks for lib64 but it seems to not work # ifeq ($(SRCARCH)$(IS_64_BIT), x861) %global perf_flags VF=1 prefix=%{_prefix} lib=%{_lib} %if %{without libbpf} %global perf_flags %perf_flags NO_LIBBPF=1 %endif %global perf_make %make_build %{perf_flags} %global perf_make_install %make_install %{perf_flags} %prep %autosetup -p1 %if %{with libbpf} # copy in missing files UAPI_ASM_ARM_DIR=arch/arm64/include/uapi/asm UAPI_ASM_S390_DIR=arch/s390/include/uapi/asm mkdir -p $UAPI_ASM_ARM_DIR mkdir -p $UAPI_ASM_S390_DIR cp -p %{SOURCE1} $UAPI_ASM_ARM_DIR/bpf_perf_event.h cp -p %{SOURCE2} $UAPI_ASM_S390_DIR/bpf_perf_event.h %endif %build unset CXXFLAGS unset LDFLAGS # /usr/bin/ld: perf-in.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE #global optflags %{optflags} -fPIE %perf_make -C tools/perf %perf_make -C tools/lib/perf %install unset CXXFLAGS unset LDFLAGS %perf_make_install -C tools/perf %perf_make_install -C tools/lib/perf # python-perf extension %perf_make_install install-python_ext -C tools/perf # remove the 'trace' symlink. rm %{buildroot}%{_bindir}/trace rm -f %{buildroot}%{_libdir}/libperf.a %if %{without perl} rm %{buildroot}%{_libexecdir}/perf-core/tests/shell/common/*.pl %endif # TODO - make this customizable upstream mkdir -p %{buildroot}%{bash_completions_dir} mv %{buildroot}%{_sysconfdir}/bash_completion.d/perf %{buildroot}%{bash_completions_dir}/ rmdir %{buildroot}%{_sysconfdir}/bash_completion.d rmdir %{buildroot}%{_sysconfdir}/ %files # license add-license-file-here %doc tools/perf/CREDITS %{_bindir}/perf %{_datadir}/perf-core # tips.txt is both human readable and used by perf # and really hard to override %{_docdir}/perf-tip %dir %{_includedir}/perf %{_includedir}/perf/perf_dlfilter.h %{_libdir}/libperf-jvmti.so %{_libexecdir}/perf-core %{bash_completions_dir}/perf %if %{with manpages} %{_mandir}/man1/perf*.1* %endif %files -n libperf %{_libdir}/libperf.so.0 %{_libdir}/libperf.so.0.0.1 %files -n libperf-devel %{_libdir}/libperf.so %{_libdir}/pkgconfig/libperf.pc %{_includedir}/internal/*.h %{_includedir}/perf/bpf_perf.h %{_includedir}/perf/core.h %{_includedir}/perf/cpumap.h %{_includedir}/perf/event.h %{_includedir}/perf/evlist.h %{_includedir}/perf/evsel.h %{_includedir}/perf/mmap.h %{_includedir}/perf/threadmap.h %{_mandir}/man3/libperf.3.gz %{_mandir}/man7/libperf-counting.7.gz %{_mandir}/man7/libperf-sampling.7.gz %{_docdir}/libperf/examples/sampling.c %{_docdir}/libperf/examples/counting.c %{_docdir}/libperf/html/libperf.html %{_docdir}/libperf/html/libperf-counting.html %{_docdir}/libperf/html/libperf-sampling.html %files -n python3-perf %{python3_sitearch}/* %changelog %autochangelog -