File coreboot-utils.spec of Package coreboot-utils

# spec file for package coreboot-utils
# Copyright (c) 2021 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

Name:           coreboot-utils
Version:        4.10
Release:        0
Summary:        A universal flash programming utility
License:        GPL-2.0-only
Group:          Development/Tools/Other
Source3:        %{name}.keyring
Patch1:         no-pie.patch
Patch2:         k8resdump.diff
Patch3:         do-explicit-fallthrough.patch
Patch4:         msrtool-fix-build-with-gcc-10.patch
BuildRequires:  gcc-c++
BuildRequires:  pciutils-devel
BuildRequires:  xz
BuildRequires:  zlib-devel
ExclusiveArch:  %ix86 x86_64

coreboot is a Free Software project aimed at replacing the proprietary BIOS
(firmware) found in most computers. This package contains various utilities
used to develop and configure systems with coreboot.

%setup -q -n coreboot-%{version}
%if 0%{?suse_version} > 1320
%patch1 -p1
%patch2 -p1
%if 0%{?suse_version} > 1320
%patch3 -p1
%patch4 -p1

make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/ectool
make %{?_smp_mflags} CC="cc %{optflags}" -C util/superiotool
make %{?_smp_mflags} CFLAGS="%{optflags} -DCMOS_HAL=1 -I." -C util/nvramtool
make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/romcc romcc
make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/cbmem
make %{?_smp_mflags} CFLAGS="%{optflags} -I../../src/commonlib/include" -C util/ifdtool
make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/cbfstool
make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/k8resdump
%ifarch %{ix86} x86_64
make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/inteltool
make %{?_smp_mflags} CFLAGS="%{optflags}" -C util/intelmetool
make %{?_smp_mflags} HOSTCC="cc %{optflags}"  -C util/amdfwtool
make %{?_smp_mflags} CFLAGS="%{optflags} -I." -C util/viatool
(cd util/msrtool && %configure && make %{?_smp_mflags})

install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}
install -d %{buildroot}%{_mandir}/man1

make %{?_smp_mflags} PREFIX=%{buildroot}/%{_prefix} -C util/ectool install
make %{?_smp_mflags} DESTDIR=%{buildroot} PREFIX=%{_prefix} -C util/superiotool install
make %{?_smp_mflags} DESTDIR=%{buildroot} PREFIX=%{_prefix} -C util/nvramtool install
make %{?_smp_mflags} DESTDIR=%{buildroot} PREFIX=%{_prefix} -C util/intelmetool install
# ifdtool & viatool install targets try to install a nonexistent manpage...
install util/ifdtool/ifdtool %{buildroot}%{_bindir}
install util/cbfstool/cbfstool %{buildroot}%{_bindir}
install util/cbmem/cbmem %{buildroot}%{_bindir}
install util/romcc/romcc %{buildroot}%{_bindir}
install -pm644 util/romcc/romcc.1 %{buildroot}%{_mandir}/man1/
install util/k8resdump/k8resdump %{buildroot}%{_sbindir}
install util/amdtools/*.pl %{buildroot}%{_sbindir}
install util/amdtools/ %{buildroot}%{_sbindir}
%ifarch %{ix86} x86_64
make %{?_smp_mflags} DESTDIR=%{buildroot} PREFIX=%{_prefix} -C util/inteltool install
install util/viatool/viatool %{buildroot}%{_bindir}
install util/amdfwtool/amdfwtool %{buildroot}%{_sbindir}
make -C util/msrtool DESTDIR=%{buildroot} PREFIX=%{_prefix} install

install -pm644 util/superiotool/README README.superiotool
install -pm644 util/superiotool/COPYING COPYING.superiotool
install -pm644 util/nvramtool/README README.nvramtool
install -pm644 util/nvramtool/COPYING COPYING.nvramtool
install -pm644 util/nvramtool/DISCLAIMER DISCLAIMER.nvramtool
install -pm644 util/romcc/COPYING COPYING.romcc
install -pm644 util/amdtools/README README.amdtools
cp -a util/amdtools/example_input example_input.amdtools
%ifarch %{ix86} x86_64
install -pm644 util/viatool/README README.viatool
install -pm644 util/msrtool/COPYING COPYING.msrtool

%license COPYING.superiotool
%doc README.superiotool
%license COPYING.nvramtool
%doc README.nvramtool DISCLAIMER.nvramtool
%doc README.amdtools example_input.amdtools

openSUSE Build Service is sponsored by