Summary:        Building EFI Applications Using the GNU Toolchain
Name:           gnu-efi
Version:        3.0.2
Release:        1%{?_dist_release}

Group:          System Environment/Libraries
License:        BSD
URL:            http://sourceforge.net/projects/gnu-efi/
Source0:        %{name}-%{version}.tar.bz2

Patch0:         0001-Add-setjmp-back-once-again.patch

Vendor:         Project Vine
Distribution:   Vine Linux
Packager:       Takemikaduchi

%global efidir  vine

%ifarch x86_64
%global efiarch x86_64
%endif
%ifarch %{ix86}
%global efiarch ia32
%endif


%description
Develop EFI applications for ARM-64, ARM-32, x86_64, IA-64 (IPF),
and IA-32 (x86) platforms using the GNU toolchain and the EFI
development environment.


%package        devel
Summary:        Development tools for %{name}
Summary(ja):    %{name} の開発環境
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description    devel
Header files and libraries for building a extension library for the %{name}.


%package        utils
Summary:        Utilities for EFI systems
Group:          Applications/System

%description utils
This package contains utilties for debugging and developing EFI systems.


%prep
%setup -q
%patch0 -p1

%build
make
make apps

%install
rm -rf $RPM_BUILD_ROOT
make install INSTALLROOT=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir}
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

mkdir -p $RPM_BUILD_ROOT%{_libdir}/gnuefi
mv $RPM_BUILD_ROOT%{_libdir}/*.lds $RPM_BUILD_ROOT%{_libdir}/*.o $RPM_BUILD_ROOT%{_libdir}/gnuefi

mkdir -p $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/
mv %{efiarch}/apps/{route80h.efi,modelist.efi} $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%doc README.gnuefi README.efilib README.elilo ChangeLog
%defattr(-,root,root,-)
%{_libdir}/*

%files devel
%defattr(-,root,root,-)
%{_includedir}/efi

%files utils
%dir /boot/efi/EFI/%{efidir}/
%attr(0644,root,root) /boot/efi/EFI/%{efidir}/*.efi


%changelog
* Sun Aug 16 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.2-1
- initial build based on fedora
