File papi.spec of Package papi

#
# spec file for package papi
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           papi
Version:        5.5.0
Release:        0
Summary:        Performance Application Programming Interface
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            http://icl.cs.utk.edu/papi/index.html
Source:         http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
Source1000:     baselibs.conf
Patch0:         papi-codecleanup.patch
BuildRequires:  autoconf >= 2.61
BuildRequires:  automake
BuildRequires:  chrpath
BuildRequires:  gcc-fortran
BuildRequires:  libpfm-devel >= 4.3.0
BuildRequires:  libpfm-devel-static >= 4.3.0
BuildRequires:  libsensors4-devel
BuildRequires:  linux-kernel-headers
BuildRequires:  ncurses-devel
BuildRequires:  pkg-config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#PAPI doesn't support the s390 architecture
ExcludeArch:    s390 s390x
%ifarch %ix86 x86_64 ia64
%if 0%{?suse_version} > 1201
BuildRequires:  libquadmath0
%else
%if 0%{?suse_version} == 1201
BuildRequires:  libquadmath46
%endif
%endif
%endif
%ifarch ppc64
BuildRequires:  gcc-32bit
BuildRequires:  gcc-fortran-32bit
BuildRequires:  glibc-devel-32bit
%endif
#BuildRequires:  libibmad-devel

%description

PAPI aims to provide the tool designer and application engineer with a
consistent interface and methodology for use of the performance counter
hardware found in most major microprocessors. PAPI enables software
engineers to see, in near real time, the relation between software
performance and processor events.

%package        devel
Summary:        Software Development Kit for PAPI
Group:          Development/Libraries/C and C++
Requires:       linux-kernel-headers
Requires:       papi = %{version}

%description    devel
This package includes the C header files that specify the PAPI userspace
libraries and interfaces. This is required for rebuilding any program
that uses PAPI.

%package        devel-static
Summary:        Static PAPI libraries
Group:          Development/Libraries/C and C++
Requires:       linux-kernel-headers
Requires:       papi-devel = %{version}

%description    devel-static
This package includes the static PAPI libraries.

%package -n     libpapi
Summary:        PAPI runtime library
Group:          System/Libraries

%description -n libpapi
This package contains the PAPI runtime library.

%prep
%setup -q
%patch0

%build
#export SUSE_ASNEEDED=0
cd src
autoreconf -fi
for c in lmsensors; do
    cd components/$c
    autoconf
    %configure \
	--with-sensors_incdir=%{_includedir}/sensors \
        --with-sensors_libdir=%{_libdir}
    cd -
done
export CFLAGS="%{optflags} -Wno-unused-parameter"

%configure \
	--with-components="appio lmsensors coretemp example net" \
	--with-perf-events --with-shared-lib=yes \
	--with-shlib --with-pthread-mutexes  \
	--with-pfm-incdir=%{_includedir} \
	--with-pfm-libdir=%{_libdir}

#DBG workaround to make sure libpfm just uses the normal CFLAGS
DBG="" make DOCDIR=%{_defaultdocdir}/%{name} %{?_smp_mflags}

%install
cd src
make DESTDIR=%{buildroot} install %{?_smp_mflags} DOCDIR=%{_defaultdocdir}/%{name} LDCONFIG=/bin/true
chrpath --delete %{buildroot}%{_libdir}/*.so*

%post -n libpapi -p /sbin/ldconfig

%postun -n libpapi -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_bindir}/papi_clockres
%{_bindir}/papi_command_line
%{_bindir}/papi_cost
%{_bindir}/papi_decode
%{_bindir}/papi_event_chooser
%{_bindir}/papi_mem_info
%{_bindir}/papi_native_avail
%{_bindir}/papi_version
%{_bindir}/papi_xml_event_info
%{_bindir}/papi_component_avail
%{_bindir}/papi_error_codes
%{_bindir}/papi_multiplex_cost
%{_datadir}/%{name}
%{_bindir}/papi_avail
%doc ChangeLog*.txt LICENSE.txt README RELEASENOTES.txt

%files devel
%defattr(-,root,root)
%{_includedir}/f77papi.h
%{_includedir}/f90papi.h
%{_includedir}/fpapi.h
%{_includedir}/papi.h
%{_includedir}/papiStdEventDefs.h
%doc %{_mandir}/man3/*.gz
%doc %{_mandir}/man1/*
%{_libdir}/libpapi.so
%{_libdir}/pkgconfig/*.pc

%files devel-static
%defattr(-,root,root)
%{_libdir}/lib*.a

%files -n libpapi
%defattr(-,root,root)
%{_libdir}/libpapi.so.*

%changelog
openSUSE Build Service is sponsored by