%global gittagdate 20180702
%global gittag qemu-slof-%{gittagdate}

Name:           SLOF
Version:        0.1.git%{gittagdate}
Release:        1%{?dist}
Summary:        Slimline Open Firmware
License:        BSD
URL:            http://www.openfirmware.info/SLOF
BuildArch:      noarch
# There are no upstream tarballs.  To prepare a tarball, do:
# git clone git://github.com/aik/SLOF.git
# cd SLOF
# git archive -o ../SLOF-%{gittagdate}.tar.gz \
#     --prefix=SLOF-%{gittagdate}/ %{gittag}
Source0:        https://github.com/aik/SLOF/archive/qemu-slof-%{gittagdate}.tar.gz
%ifarch x86_64 aarch64
BuildRequires:  gcc-powerpc64-linux-gnu
%endif
BuildRequires:  perl(Data::Dumper)


%description
Slimline Open Firmware (SLOF) is initialization and boot source code
based on the IEEE-1275 (Open Firmware) standard, developed by 
engineers of the IBM Corporation.
The SLOF source code provides illustrates what's needed to initialize
and boot Linux or a hypervisor on the industry Open Firmware boot
standard.


%package bin
Summary: Slimline Open Firmware BINs
%description bin
The BIN files for SLOF, an IEEE-1275 Slimline Open Firmware
Note that you normally wouldn't need to install this package
separately.  It is a dependency of qemu-system-ppc64.


%prep
%setup -q -n SLOF-%{gittag}                                                                                                                                    


%build
%ifnarch ppc64 ppc64le
export CROSS="powerpc64-linux-gnu-"
%endif
make qemu %{?_smp_mflags} V=2


%install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/qemu
cp -a boot_rom.bin $RPM_BUILD_ROOT%{_datadir}/qemu/slof.bin


%files
%doc FlashingSLOF.pdf
%doc LICENSE
%doc README


%files bin
%dir %{_datadir}/qemu
%{_datadir}/qemu/slof.bin


%changelog
