File usbimager.spec of Package usbimager

#
# spec file for package usbimager
#
# Copyright (c) 2025 Boian Berberov
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%global         gitdate  20260125
%global         gitrev   71ef0bca
%global         gitcomm  71ef0bca9db9cf72043e8cb4a5b72f738aa4e378
%global         gitrel   git%{gitdate}.%{gitrev}



Name:           usbimager
Version:        1.0.10+%{gitrel}
Release:        0%{?dist}
Summary:        GUI app that writes compressed disk images to USB drives
License:        MIT
URL:            https://bztsrc.gitlab.io/%{name}/

%if %{defined gitcomm}
Source0:        https://gitlab.com/bztsrc/%{name}/-/archive/%{gitcomm}/%{name}-%{gitcomm}.tar.gz
%endif

BuildRequires:  pkgconfig

BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(udisks2)
BuildRequires:  pkgconfig(x11)

%description
A really simple GUI application that writes compressed disk images to USB drives and creates backups.



%prep
%if %{defined gitcomm}
%setup -q -n %{name}-%{gitcomm}
%endif

# Patch desktop files
cd src/misc
# Remove invalid version
# https://specifications.freedesktop.org/desktop-entry-spec/latest/recognized-keys.html
%__sed -i \
	-e '/^Version=/d' \
	%{name}.desktop

%__cp %{name}.desktop %{name}-x11.desktop
%__cp %{name}.desktop %{name}-gtk.desktop

%__sed -i \
	-e 's/^Terminal=false/Terminal=true/' \
	-e 's/^Name=USBImager/Name=USBImager (TUI)/' \
	%{name}.desktop

%__sed -i \
	-e 's/^Name=USBImager/Name=USBImager (X11)/' \
	-e 's:^Exec=/usr/bin/%{name}:Exec=/usr/bin/%{name}-x11:' \
	%{name}-x11.desktop

%__sed -i \
	-e 's/^Name=USBImager/Name=USBImager (GTK)/' \
	-e 's:^Exec=/usr/bin/%{name}:Exec=/usr/bin/%{name}-gtk:' \
	%{name}-gtk.desktop



%build
cd src

%make_build DEBUG=1 USE_TUI=1 TARGET=%{name}
%make_build DEBUG=1 USE_GTK=1 TARGET=%{name}-gtk
%make_build DEBUG=1 USE_X11=1 TARGET=%{name}-x11



%install
cd src

%__install -D -m0755 %{name}      %{buildroot}%{_bindir}/%{name}
%__install -D -m0755 %{name}-gtk  %{buildroot}%{_bindir}/%{name}-gtk
%__install -D -m0755 %{name}-x11  %{buildroot}%{_bindir}/%{name}-x11

%__install -D -m0644 misc/%{name}.desktop      %{buildroot}%{_datadir}/applications/%{name}.desktop
%__install -D -m0644 misc/%{name}-gtk.desktop  %{buildroot}%{_datadir}/applications/%{name}-gtk.desktop
%__install -D -m0644 misc/%{name}-x11.desktop  %{buildroot}%{_datadir}/applications/%{name}-x11.desktop

for size in 16 32 64 128
do
	%__install -D -m0644 \
		"misc/icon${size}.png" \
		"%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%name.png"
done

%__install -D -m0644 misc/%{name}.8.gz  %{buildroot}%{_mandir}/man8/%{name}.8.gz



%files
%license        LICENSE
%{_bindir}/%{name}
%{_bindir}/%{name}-gtk
%{_bindir}/%{name}-x11
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}-gtk.desktop
%{_datadir}/applications/%{name}-x11.desktop
%{_datadir}/icons/hicolor/*
%{_mandir}/man8/%name.8*



%changelog

* Sat Jul 19 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by