%global debug_package %{nil}

Name:           setup-tool
Version:        1.7.2
Release:        1
Summary:        A simple setup tool suit
BuildArch:      %{_target_cpu}

License:        MPL-2.0
Source0:        %{name}-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  make
BuildRequires:  libstp
Requires:       setup-tool-cli
#Requires:       setup-tool-tui
#Requires:       setup-tool-gui
Requires:       libstp
%if 0%{?fedora} || 0%{?epel}
Requires: fastfetch
%endif

%description
A simple setup program for RPM-based distros.

%prep
%setup -q


%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_datadir}/doc/%{name}
mkdir -p %{buildroot}/%{_mandir}/man1
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/512x512/apps/
mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps/
mkdir -p %{buildroot}/%{_datadir}/applications/
mkdir -p %{buildroot}/%{_datadir}/licenses/%{name}
mkdir -p %{buildroot}/%{_sysconfdir}
gcc setup-tool.c -I/usr/lib64/libstp -L/usr/lib64/libstp /usr/lib64/libstp/libstp-c.so -o setup-tool
cp setup-tool %{buildroot}/%{_bindir}
cp LICENSE %{buildroot}/%{_datadir}/licenses/%{name}
cp README.md %{buildroot}/%{_datadir}/doc/%{name}
cp Setup-Tool.desktop %{buildroot}/%{_datadir}/applications
cp setup-tool-512.png %{buildroot}/%{_datadir}/icons/hicolor/512x512/apps
cp setup-tool-128.png %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps
cp setup-tool.1 %{buildroot}/%{_mandir}/man1
cp setup-tool.conf %{buildroot}/%{_sysconfdir}/
chmod -x %{buildroot}/%{_mandir}/man1/setup-tool.1
chmod 666 %{buildroot}/%{_sysconfdir}/setup-tool.conf

%files
%license %{_datadir}/licenses/%{name}/LICENSE
%doc %{_datadir}/doc/%{name}/README.md
%{_bindir}/setup-tool
%{_datadir}/applications/Setup-Tool.desktop
%{_datadir}/icons/hicolor/512x512/apps/setup-tool-512.png
%{_datadir}/icons/hicolor/128x128/apps/setup-tool-128.png
%{_mandir}/man1/setup-tool.1*
%{_sysconfdir}/setup-tool.conf

%changelog
%autochangelog