File macros.gtk4 of Package gtk4

# RPM macros for packages installing a GTK+ IM module
#
###
#
# When a package installs a GTK+ IM module, it should use all
# three macros:
#
#  - %gtk4_immodule_requires in the preamble
#  - %gtk4_immodule_post in %post
#  - %gtk4_immodule_postun in %postun
#
###

%gtk4_immodule_requires                                  \
Requires(post): glib2-tools                               \
Requires(postun): glib2-tools

# On install, update the cache
%gtk4_immodule_post                                      \
if [[ -x %{_bindir}/gio-querymodules-64 ]]; then       \
  %{_bindir}/gio-querymodules-64 %{_libdir}/gtk-4.0/4.0.0/immodules \
else                                                   \
  %{_bindir}/gio-querymodules %{_libdir}/gtk-4.0/4.0.0/immodules \
fi

# On uninstall, update the cache. Note: we ignore upgrades (already
# handled in %post of the new package).
%gtk4_immodule_postun                                    \
if [ $1 -eq 0 ]; then                                    \
  if [[ -x %{_bindir}/gio-querymodules-64 ]]; then       \
    %{_bindir}/gio-querymodules-64 %{_libdir}/gtk-4.0/4.0.0/immodules \
  else                                                   \
    %{_bindir}/gio-querymodules %{_libdir}/gtk-4.0/4.0.0/immodules \
  fi                                                     \    
fi
openSUSE Build Service is sponsored by