File trustedgrub2.spec of Package trustedgrub2

#
# spec file for package trustedgrub2
#
# 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:           trustedgrub2
Version:        1.4.0
Release:        0
Summary:        Bootloader with TCG (TPM) support  
License:        GPL-3.0+
Group:          System/Boot
Url:            https://github.com/Sirrix-AG/TrustedGRUB2
Source0:        %{name}-%{version}.tar.gz
Source1:        trustedgrub2.rpmlintrc
Source2:        HOWTO.luks-keyfile
Patch1:         use-grub2-as-a-package-name.patch
Patch2:         grub2-linguas.sh-no-rsync.patch
# Btrfs snapshot booting related patches
Patch101:       grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
Patch102:       grub2-btrfs-02-export-subvolume-envvars.patch
Patch103:       grub2-btrfs-03-follow_default.patch
Patch104:       grub2-btrfs-04-subvol-mount.patch
Patch105:       grub2-btrfs-05-subvol-fallback.patch
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc
BuildRequires:  python
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %{ix86} x86_64

%define _unpackaged_files_terminate_build 0

# Modules code is dynamically loaded and collected from a _fixed_ path.
%define _libdir %{_exec_prefix}/lib

%ifarch %{ix86} x86_64
%define grubcpu i386
%define platform pc
%endif

%define grubarch %{grubcpu}-%{platform}

%description
This package provides the alternatives made to transform a standard GRUB2
into a version that offers TCG (TPM) support for granting the integrity of the
boot process (trusted boot). This project was highly inspired by the former
projects TrustedGrub1 and GRUB-IMA. However TrustedGRUB2 was completely written
from scratch.

%package %{grubarch}

Summary:        Bootloader with TCG (TPM) support
Group:          System/Boot
BuildArch:      noarch

%description %{grubarch}
This package provides the alternatives made to transform a standard GRUB2
into a version that offers TCG (TPM) support for granting the integrity of the
boot process (trusted boot). This project was highly inspired by the former
projects TrustedGrub1 and GRUB-IMA. However TrustedGRUB2 was completely written
from scratch.

This package contains modules for %{platform} systems.

%prep
%setup
%patch1 -p1
%patch2 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1

# HOWTO.luks-keyfile
cp %{SOURCE2} .

mkdir build

%build
./autogen.sh
# We don't want to let rpm override *FLAGS with default a.k.a bogus values.
CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "
CXXFLAGS=" "
FFLAGS=" "
export CFLAGS CXXFLAGS FFLAGS

cd build

%define _configure ../configure
%configure \
	--target=%{grubcpu} \
	--with-platform=%{platform} \
	--program-transform-name=s,grub,%{name},

make %{?_smp_mflags}

%install
cd build
make install-data DESTDIR=%{buildroot} %{?_smp_mflags}

# *.module files are installed with executable bits due to the way grub2 build
# system works. Clear executable bits to not confuse find-debuginfo.sh
find $RPM_BUILD_ROOT%{_libdir}/%{name} \
       \( -name '*.module' -o -name '*.image' -o -name '*.exec' \) -print0 | \
       xargs --no-run-if-empty -0 chmod a-x

%post

%postun

%files
%defattr(-,root,root,-)
%doc COPYING README.md Changelog.md HOWTO.luks-keyfile

%files %{grubarch}
%defattr(-,root,root,-)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{grubarch}
%{_libdir}/%{name}/%{grubarch}/*

%changelog
openSUSE Build Service is sponsored by