%global hash 72f39d4
%global date 20180715

Name:           sgabios
Epoch:          1
Version:        0.%{date}git
Release:        1%{?dist}
Summary:        Open-source serial graphics BIOS option rom
Group:          Applications/Emulators
License:        ASL 2.0
URL:            https://github.com/qemu/sgabios
Source0:        sgabios-%{date}-git%{hash}.tar.xz
Patch0:         sgabios-hostcc.patch

BuildRequires:  binutils-x86_64-linux-gnu gcc-x86_64-linux-gnu

Requires: %{name}-bin = %{epoch}:%{version}-%{release}
Buildarch: noarch

# Sgabios is noarch, but required on architectures which cannot build it.
# Disable debuginfo because it is of no use to us.
%global debug_package %{nil}

%description
SGABIOS is designed to be inserted into a BIOS as an option rom to provide over
a serial port the display and input capabilities normally handled by a VGA
adapter and a keyboard, and additionally provide hooks for logging displayed
characters for later collection after an operating system boots.

%package bin
Summary: Sgabios for x86
Buildarch: noarch

%description bin
SGABIOS is designed to be inserted into a BIOS as an option rom to provide over
a serial port the display and input capabilities normally handled by a VGA
adapter and a keyboard, and additionally provide hooks for logging displayed
characters for later collection after an operating system boots.

%prep
%setup -q -n sgabios-%{date}-git%{hash}
#%patch0 -p1

%build
unset MAKEFLAGS
make \
        HOSTCC=gcc \
        CC=x86_64-linux-gnu-gcc \
        AS=x86_64-linux-gnu-as \
        LD=x86_64-linux-gnu-ld \
        OBJCOPY=x86_64-linux-gnu-objcopy \
        OBJDUMP=x86_64-linux-gnu-objdump



%install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/qemu/
install -m 0644 sgabios.bin $RPM_BUILD_ROOT%{_datadir}/qemu


%files
%doc COPYING design.txt


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


%changelog
