shimmerproject / elementary-xfce

Elementary icons forked from upstream, extended and maintained for Xfce
GNU General Public License v2.0
274 stars 37 forks source link

suggesting a rpm specfile #162

Open ghost opened 5 years ago

ghost commented 5 years ago
Summary:    Elementary icons for xfce
Name:       elementary-xfce
Version:    0.13.1
Release:    %mkrel 1
License:    GPLv2+
Group:      Graphical desktop/XFCE
URL:        https://github.com/shimmerproject
### Source is just a empty folder named %{name}-%{version} to build from git-master ###
Source0:    https://github.com/shimmerproject/releases/%{name}-%{version}.tar.xz
### if you want build from released tarball ###
### Source should be https://github.com/shimmerproject/elementary-xfce/archive/v0.13.1.tar.gz ### 
BuildRequires: optipng

Requires:  gtk+3.0

%description
XFCE elementary icons from shimmerproject.org

%prep
### to build released : %setup -q -n %{name}-%{version} ###
%setup 
git clone https://github.com/shimmerproject/elementary-xfce.git

%build
# just if you build git-master #
cd elementary-xfce
# also a ./configure --prefix=/usr should work
%configure2_5x --prefix=/usr
%make

%install
rm -rf %buildroot
install -d %{buildroot}%{_datadir}/icons/%{name}
install -d %{buildroot}%{_docdir}/%{name}
install -d %{buildroot}%{_datadir}/pkgconfig

cd elementary-xfce

cp -f LICENSE AUTHORS README.md CONTRIBUTORS %{buildroot}%{_docdir}/%{name}/

%make DESTDIR=%{buildroot} install

# clean broken links    
rm -rf %{buildroot}%{_datadir}/icons/*/CONTRIBUTORS
rm -rf %{buildroot}%{_datadir}/icons/*/AUTHORS
rm -rf %{buildroot}%{_datadir}/icons/*/README.md

# icon-theme.caches would create with triggers
install -d %buildroot%{_var}/lib/rpm/filetriggers
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}.filter << EOF
^./usr/share/icons/gnome/
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}-dark.filter << EOF
^./usr/share/icons/gnome/
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}-darker.filter << EOF
^./usr/share/icons/gnome/
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}-darkest.filter << EOF
^./usr/share/icons/gnome/
EOF

cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}.script << EOF
#!/bin/sh
if [ -x /usr/bin/gtk-update-icon-cache ]; then 
  /usr/bin/gtk-update-icon-cache -f /usr/share/icons/%{name}
fi
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}-dark.script << EOF
#!/bin/sh
if [ -x /usr/bin/gtk-update-icon-cache ]; then 
  /usr/bin/gtk-update-icon-cache -f /usr/share/icons/%{name}-dark
fi
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}-darker.script << EOF
#!/bin/sh
if [ -x /usr/bin/gtk-update-icon-cache ]; then 
  /usr/bin/gtk-update-icon-cache -f /usr/share/icons/%{name}-darker
fi
EOF
cat > %buildroot%{_var}/lib/rpm/filetriggers/gtk-icon-cache-%{name}-darkest.script << EOF
#!/bin/sh
if [ -x /usr/bin/gtk-update-icon-cache ]; then 
  /usr/bin/gtk-update-icon-cache -f /usr/share/icons/%{name}-darkest
fi
EOF

# make a .pc file
%__cat > %{buildroot}%{_datadir}/pkgconfig/%{name}.pc <<EOF
Name: %{name}
Description: A collection of icons used for xfce themes
Version: %{version}
Requires: gtk+3.0
EOF

%clean
rm -rf %buildroot

%post
%update_icon_cache %{name}
%update_icon_cache %{name}-dark
%update_icon_cache %{name}-darker
%update_icon_cache %{name}-darkest

%postun
%clean_icon_cache %{name}*

%files
%defattr(-,root,root,-)
%{_docdir}/%{name}/*
%dir %{_datadir}/icons/%{name}*/
%{_datadir}/icons/%{name}*/*
%{_datadir}/pkgconfig/%{name}.pc
%{_var}/lib/rpm/filetriggers/gtk-icon-cache-*.*

%changelog
* Fri Jul 05 2019 onkelho <oh.quait at gmail.com> 0.13.1-1pclos2019
- release

just to help for packaging, build runs and install and uninstall works without errors,

m4u9 commented 5 years ago

What is the purpose? Afaik RPM distros already package it

ghost commented 5 years ago

I forgot to say that it may be annoying to new package builders to remove the broken links in each subtopic (dark, darker, darkest,) first. But this is in the spec file. Maybe you should have a spec.in file available here that indicates this.