File uarch-bench.spec of Package uarch-bench

#
# spec file for package uarch-bench
#
# Copyright (c) 2020 SUSE LLC
#
# 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:           uarch-bench
Version:        20220208T132023.e4f54d5
Release:        0
Summary:        A benchmark for low-level CPU micro-architectural features
License:        MIT
Url:            https://github.com/travisdowns/uarch-bench
Source0:        %name-%version.tar.xz
Source1:        %name-rpmlintrc
ExclusiveArch:  x86_64
BuildRequires:  bash
BuildRequires:  chrpath
BuildRequires:  gcc-c++
BuildRequires:  kernel-default-devel
%if 0%{?suse_version} > 1315
BuildRequires:  nasm
%endif
%if 0%{?suse_version} < 1550
BuildRequires:  gcc8
BuildRequires:  gcc8-c++
%endif
BuildRequires:  pkgconfig(python2)
Requires:       gawk
Requires:       grep
Requires:       sed
Requires:       sudo

%description
A fine-grained micro-benchmark intended to investigate micro-architectural details of a target CPU, or to precisely benchmark small functions in a repeatable manner.

%prep
%autosetup -p1

%build
test -x "$(type -p gcc)"     && CC=$_
test -x "$(type -p gcc-7)" && CC=$_
test -x "$(type -p gcc-8)" && CC=$_
test -x "$(type -p gcc-9)" && CC=$_
test -x "$(type -p g++)"     && CXX=$_
test -x "$(type -p g++-7)" && CXX=$_
test -x "$(type -p g++-8)" && CXX=$_
test -x "$(type -p g++-9)" && CXX=$_
CC="`readlink -f $CC`"
CXX="`readlink -f $CXX`"
%make_build \
	"CC=${CC}" \
	"CXX=${CXX}" \
	"O_LEVEL=%optflags" \
	uarch-bench \
	util/seqtest \
	unit-test \
	%nil

%install
b='%buildroot%_bindir'
l='%buildroot%_libdir/%name'
mkdir -p "${b}" "${l}"
(
echo "#!$(type -P bash)"
cat uarch-bench.sh
) > "${b}/%name"
chmod -c 0555 "${b}/%name"
cp -aL uarch-bench "${l}/%name"
cp -aL util/seqtest "${l}/seqtest"
cp -aL unit-test "${l}/unit-test"
cp -aLt "${l}" */libpfc.so
cp -aLt "${l}" */*/libpfm.so.4

%files
%doc README.md
%license LICENSE
%_bindir/*
%_libdir/%name

%changelog

openSUSE Build Service is sponsored by