From e92243f74dd1fc1ec452465194259c3d329a1a4e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 1 Nov 2012 13:07:20 -0700 Subject: [PATCH] add packaging --- packaging/desktop-file-utils.spec | 64 +++++++++++++++++++++++++++++ packaging/macros.desktop-file-utils | 38 +++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 packaging/desktop-file-utils.spec create mode 100644 packaging/macros.desktop-file-utils diff --git a/packaging/desktop-file-utils.spec b/packaging/desktop-file-utils.spec new file mode 100644 index 0000000..a400d26 --- /dev/null +++ b/packaging/desktop-file-utils.spec @@ -0,0 +1,64 @@ +Name: desktop-file-utils +Version: 0.20 +Release: 0 +Summary: Utilities for Manipulating Desktop Files +License: GPL-2.0+ +Group: Development/Tools/Other +Url: http://www.freedesktop.org/wiki/Software/desktop-file-utils +Source0: http://www.freedesktop.org/software/desktop-file-utils/releases/%{name}-%{version}.tar.xz +Source2: macros.desktop-file-utils +BuildRequires: glib2-devel +BuildRequires: pkg-config +# Only needed because we don't (and won't) support building xz tarballs by default... See bnc#697467 +BuildRequires: xz + +%description +This packages contains a couple of command line utilities for +working with desktop files. + +More information about desktop files can be found at: +http://freedesktop.org/wiki/Specifications/desktop-entry-spec + +%prep +%setup -q + +%build +%configure \ + --with-lispdir=%{_datadir}/emacs/site-lisp +%__make %{?_smp_mflags} + +%install +%makeinstall +# we don't want to buildrequire emacs, but recent automake make it +# impossible to install a lisp file without emacs installed. So we +# manually do it. +test ! -f %{buildroot}%{_datadir}/emacs/site-lisp/desktop-entry-mode.el +install -D -m644 misc/desktop-entry-mode.el %{buildroot}%{_datadir}/emacs/site-lisp/desktop-entry-mode.el +# Install rpm macros +install -D -m644 %{S:2} %{buildroot}%{_sysconfdir}/rpm/macros.desktop-file-utils +# Create ghosts based on default $XDG_DATA_DIRS: +mkdir -p %{buildroot}%{_datadir}/applications +touch %{buildroot}%{_datadir}/applications/mimeinfo.cache + +%post +%{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true + +%files +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog NEWS README +%{_bindir}/desktop-file-edit +%{_bindir}/desktop-file-install +%{_bindir}/desktop-file-validate +%{_bindir}/update-desktop-database +%ghost %{_datadir}/applications/mimeinfo.cache +%{_mandir}/man1/desktop-file-edit.1* +%{_mandir}/man1/desktop-file-install.1* +%{_mandir}/man1/desktop-file-validate.1* +%{_mandir}/man1/update-desktop-database.1* +# Own directories to not require emacs installed. +%dir %{_datadir}/emacs +%dir %{_datadir}/emacs/site-lisp +%{_datadir}/emacs/site-lisp/*.el* +%{_sysconfdir}/rpm/macros.desktop-file-utils + +%changelog diff --git a/packaging/macros.desktop-file-utils b/packaging/macros.desktop-file-utils new file mode 100644 index 0000000..d65aa87 --- /dev/null +++ b/packaging/macros.desktop-file-utils @@ -0,0 +1,38 @@ +# RPM macros for packages installing desktop files +# +### +# +# When a package installs a desktop file, it should use both macros: +# +# - %desktop_database_post in %post +# - %desktop_database_postun in %postun +# +# Note that these macros can optionally take as argument the directory +# where the desktop file is installed. If no argument is passed, then +# %{_datadir}/applications will be used (which is where applications +# usually install their desktop file). +# +### + +# On install, update the desktop database +%desktop_database_post() \ +if test -x %{_bindir}/update-desktop-database; then \ +%if "x%1" != "x%%1" \ + %{_bindir}/update-desktop-database --quiet "%1" || true \ +%else \ + %{_bindir}/update-desktop-database --quiet "%{_datadir}/applications" || true \ +%endif \ +fi + +# On uninstall, update the desktop database. Note: we ignore upgrades (already +# handled in %post of the new package). +%desktop_database_postun() \ +if [ $1 -eq 0 ]; then \ + if test -x %{_bindir}/update-desktop-database; then \ +%if "x%1" != "x%%1" \ + %{_bindir}/update-desktop-database --quiet "%1" || true \ +%else \ + %{_bindir}/update-desktop-database --quiet "%{_datadir}/applications" || true \ +%endif \ + fi \ +fi -- 2.34.1