%define efidir %{_datadir}/efitools/efi

Name:           efitools
Version:        1.9.2
Release:        1%{?dist}
Summary:        Tools for manipulating UEFI secure boot platforms

License:        GPLv2
URL:            http://git.kernel.org/cgit/linux/kernel/git/jejb/efitools.git

# http://git.kernel.org/cgit/linux/kernel/git/jejb/efitools.git
Source0:        https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/snapshot/%{name}-%{version}.tar.gz

# perl(File::Slurp) 
BuildRequires:  gnu-efi-devel >= 3.0q sbsigntools openssl-devel openssl help2man gcc perl-File-Slurp
Requires:       sbsigntools openssl parted dosfstools mtools

%description
This package installs a variety of tools for manipulating keys and binary signatures
on UEFI secure boot platforms.

%prep
%autosetup

%build
make CRTOBJ=crt0-efi-x64.o \
  LDSCRIPT=elf_x64_efi.lds \
  LDFLAGS='-nostdlib -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH) -L %{_libdir} -L %{_libdir}/gnuefi -T $(LDSCRIPT)' \
  INCDIR='-I$(TOPDIR)include -I/usr/include/efi -I/usr/include/efi/x64 -I/usr/include/efi/protocol' && \

%install
%make_install

# docs should not be installed under /usr/share/efitools
rm -f %{buildroot}/%{_datadir}/efitools/COPYING
rm -f %{buildroot}/%{_datadir}/efitools/README
        
# the LockDown binary has the wrong keys in it
rm -f %{buildroot}/%{efidir}/LockDown.efi

# provide empty dirs for keys and USB image built by mkusb script
install -d %{buildroot}/%{efidir}/keys
install -d %{buildroot}/%{efidir}/usb

%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/*
%{efidir}/*
%doc COPYING
%doc README

%changelog
* Mon Apr 01 2019 Dmitri Smirnov <dmitri@smirnov.ee>
- update to efitools-1.9.2

* Thu Sep 17 2015 Michal Sekletar <msekleta@redhat.com>
- import efitools-1.5.3