diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a28af5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/libpfm-4.2.0.tar.gz diff --git a/dead.package b/dead.package deleted file mode 100644 index 4c8548c..0000000 --- a/dead.package +++ /dev/null @@ -1,2 +0,0 @@ -Obsolete package - diff --git a/libpfm-siginfo_t.patch b/libpfm-siginfo_t.patch new file mode 100644 index 0000000..06f4561 --- /dev/null +++ b/libpfm-siginfo_t.patch @@ -0,0 +1,24 @@ +diff -up libpfm-4.2.0/perf_examples/notify_group.c.siginfo_t libpfm-4.2.0/perf_examples/notify_group.c +--- libpfm-4.2.0/perf_examples/notify_group.c.siginfo_t 2012-06-07 14:48:30.969999948 -0400 ++++ libpfm-4.2.0/perf_examples/notify_group.c 2012-06-07 14:49:13.124000197 -0400 +@@ -51,7 +51,7 @@ static int num_fds; + static int buffer_pages = 1; /* size of buffer payload (must be power of 2) */ + + static void +-sigio_handler(int n, struct siginfo *info, struct sigcontext *sc) ++sigio_handler(int n, siginfo_t *info, struct sigcontext *sc) + { + struct perf_event_mmap_page *hdr; + struct perf_event_header ehdr; +diff -up libpfm-4.2.0/perf_examples/notify_self.c.siginfo_t libpfm-4.2.0/perf_examples/notify_self.c +--- libpfm-4.2.0/perf_examples/notify_self.c.siginfo_t 2012-06-07 14:48:39.559998906 -0400 ++++ libpfm-4.2.0/perf_examples/notify_self.c 2012-06-07 14:49:02.143000006 -0400 +@@ -47,7 +47,7 @@ static int num_fds = 0; + static int buffer_pages = 1; /* size of buffer payload (must be power of 2)*/ + + static void +-sigio_handler(int n, struct siginfo *info, void *uc) ++sigio_handler(int n, siginfo_t *info, void *uc) + { + struct perf_event_header ehdr; + int ret, id; diff --git a/libpfm.spec b/libpfm.spec new file mode 100644 index 0000000..6eb0999 --- /dev/null +++ b/libpfm.spec @@ -0,0 +1,132 @@ +%bcond_without python +%if %{with python} +%define python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") +%define python_prefix %(python -c "import sys; print sys.prefix") +%{?filter_setup: +%filter_provides_in %{python_sitearch}/perfmon/.*\.so$ +%filter_setup +} +%endif + +Name: libpfm +Version: 4.2.0 +Release: 6%{?dist} + +Summary: Library to encode performance events for use by perf tool + +Group: System Environment/Libraries +License: MIT +URL: http://perfmon2.sourceforge.net/ +Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz +Patch1: libpfm4-python.patch +Patch2: libpfm-siginfo_t.patch + +%if %{with python} +BuildRequires: python-devel +BuildRequires: python-setuptools-devel +BuildRequires: swig +%endif + +%description + +libpfm4 is a library to help encode events for use with operating system +kernels performance monitoring interfaces. The current version provides support +for the perf_events interface available in upstream Linux kernels since v2.6.31. + +%package devel +Summary: Development library to encode performance events for perf_events based tools +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version} + +%description devel +Development library and header files to create performance monitoring +applications for the perf_events interface. + +%package static +Summary: Static library to encode performance events for perf_events based tools +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version} + +%description static +Static version of the libpfm library for performance monitoring +applications for the perf_events interface. + +%if %{with python} +%package python +Summary: Python bindings for libpfm and perf_event_open system call +Group: Development/Languages +Requires: %{name}%{?_isa} = %{version} + +%description python +Python bindings for libpfm4 and perf_event_open system call. +%endif + +%prep +%setup -q + +%patch1 -p1 +%patch2 -p1 + +%build +%if %{with python} +%global python_config CONFIG_PFMLIB_NOPYTHON=n +%else +%global python_config CONFIG_PFMLIB_NOPYTHON=y +%endif +make %{python_config} %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT + +%if %{with python} +%global python_config CONFIG_PFMLIB_NOPYTHON=n PYTHON_PREFIX=$RPM_BUILD_ROOT/%{python_prefix} +%else +%global python_config CONFIG_PFMLIB_NOPYTHON=y +%endif + +make \ + PREFIX=$RPM_BUILD_ROOT%{_prefix} \ + LIBDIR=$RPM_BUILD_ROOT%{_libdir} \ + %{python_config} \ + install + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc README +%{_libdir}/lib*.so.* + +%files devel +%{_includedir}/* +%{_mandir}/man3/* +%{_libdir}/lib*.so + +%files static +%{_libdir}/lib*.a + +%if %{with python} +%files python +%{python_sitearch}/* +%endif + +%changelog +* Thu Jun 7 2012 William Cohen 4.2.0-6 +- Eliminate rpm_build_root macro in build section. +- Correct location of shared library files. + +* Thu Jun 7 2012 William Cohen 4.2.0-5 +- Use siginfo_t for some examples. + +* Mon Jun 4 2012 William Cohen 4.2.0-4 +- Correct python files. + +* Wed Mar 28 2012 William Cohen 4.2.0-3 +- Additional spec file fixup for rhbz804666. + +* Wed Mar 14 2012 William Cohen 4.2.0-2 +- Some spec file fixup. + +* Wed Jan 12 2011 Arun Sharma 4.2.0-0 +Initial revision diff --git a/libpfm4-python.patch b/libpfm4-python.patch new file mode 100644 index 0000000..6f0e907 --- /dev/null +++ b/libpfm4-python.patch @@ -0,0 +1,35 @@ +From fe0b30189334f048db0cab10987b9e2295c5b93c Mon Sep 17 00:00:00 2001 +From: Arun Sharma +Date: Thu, 26 Apr 2012 17:37:02 +0200 +Subject: [PATCH] drop shbang from python scripts + +do not make then executable by dropping the +!/usr/bin/env python invocation. + +Signed-off-by: Arun Sharma +--- + python/src/pmu.py | 1 - + python/src/session.py | 1 - + 2 files changed, 0 insertions(+), 2 deletions(-) + +diff --git a/python/src/pmu.py b/python/src/pmu.py +index e90b72a..47c3e75 100644 +--- a/python/src/pmu.py ++++ b/python/src/pmu.py +@@ -1,4 +1,3 @@ +-#!/usr/bin/env python + # + # Copyright (c) 2008 Google, Inc. + # Contributed by Arun Sharma +diff --git a/python/src/session.py b/python/src/session.py +index df22ea6..f598aa4 100644 +--- a/python/src/session.py ++++ b/python/src/session.py +@@ -1,4 +1,3 @@ +-#!/usr/bin/env python + # + # Copyright (c) 2008 Google, Inc. + # Contributed by Arun Sharma +-- +1.7.4.1 + diff --git a/sources b/sources new file mode 100644 index 0000000..30a9666 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +09e298572ee810cc6319494f3fd5979c libpfm-4.2.0.tar.gz