File imagewriter.spec of Package imagewriter

#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Url:            https://github.com/openSUSE/imagewriter
Name:           imagewriter
BuildRequires:  gcc-c++, xz

%if 0%{?rhel_version} == 600
     %define dist el6
     %define breq qt-devel
     %define backend hal-devel
     %define qmake /usr/bin/qmake-qt4
     %define lrelease /usr/bin/lrelease-qt4
     %define definedbackend USEHAL
%endif

%if 0%{?fedora}
    %define breq qt4-devel
    %define backend udisks2
    %define qmake /usr/bin/qmake-qt4
    %define lrelease /usr/bin/lrelease-qt4
    %define definedbackend USEUDISKS2
%endif

%if 0%{?mandriva_version}
    %define breq libqt4-devel
    %define backend hal-devel
    %define qmake /usr/lib/qt4/bin/qmake
    %define lrelease /usr/lib/qt4/bin/lrelease
    %define definedbackend USEHAL
%endif  

%if 0%{?suse_version}
    %define breq libqt4-devel update-desktop-files
    %define qmake /usr/bin/qmake
    %define lrelease /usr/bin/lrelease
%endif

%if 0%{?suse_version} <= 1130
    %define backend hal-devel
    %define definedbackend USEHAL
%endif

%if 0%{?suse_version} == 1140 || 0%{?suse_version} == 1210
    %define backend udisks
    %define definedbackend USEUDISKS
%endif

%if 0%{?suse_version} >= 1220
    %define backend udisks2
    %define definedbackend USEUDISKS2
%endif

Summary:        Utility for writing disk images to USB keys
Version:        1.10.1396965491.a4dcffa
Release:        0
Group:          Hardware/Other
License:        GPL-2.0
Source:         imagewriter-%{version}.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  %{breq} %{backend}
BuildRequires:  hicolor-icon-theme
Requires:       xdg-utils

%description
A graphical utility for writing raw disk images & hybrid ISOs to USB keys

%prep
%setup

%build
%{qmake} PREFIX=%{buildroot}/%{_prefix} DEFINES=%{definedbackend} imagewriter.pro
make buildroot=%{buildroot} CFLAGS="%{optflags} -DKIOSKHACK"

%install
# I don't know why 'make install' ignores the binary when built in OBS
install -d %{buildroot}/usr/bin
install -m 755 -p imagewriter %{buildroot}/%{_bindir}
make install
%if 0%{?suse_version}
    %suse_update_desktop_file imagewriter
%endif

%if 0%{?suse_version} >= 1140
%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif

%files
%defattr(-,root,root)
%{_bindir}/imagewriter
%{_datadir}/applications/imagewriter.desktop
%{_datadir}/icons/hicolor/*/apps/imagewriter.*
%doc COPYING

%changelog