glib2/macros.glib2

74 lines
3.1 KiB
Plaintext
Raw Normal View History

# RPM macros for packages installing a GSettings schema or GIO module
#
###
#
# When a package installs a GSettings schemas, it should use all
# three macros:
#
# - %glib2_gsettings_schema_requires in the preamble
# - %glib2_gsettings_schema_post in %post
# - %glib2_gsettings_schema_postun in %postun
#
###
#
# When a package installs a GIO module, it should use all
# three macros:
#
# - %glib2_gio_module_requires in the preamble
# - %glib2_gio_module_post in %post
# - %glib2_gio_module_postun in %postun
#
# Note that %glib2_gio_module_post and %glib2_gio_module_postun can
# optionally take the path to the directory where modules live. This
# is useful for applications using the GIO module system on their own,
# since they will install modules in their own directory. If no
# argument is passed, the path for the modules for GIO itself is used.
#
###
%glib2_gsettings_schema_requires \
Requires(post): glib2-tools \
Requires(postun): glib2-tools
%glib2_gsettings_schema_post \
%{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas
# Note: we ignore upgrades (already handled in %post of the new package).
%glib2_gsettings_schema_postun \
if [ $1 -eq 0 ]; then \
%{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas \
fi
%glib2_gio_module_requires \
Requires(post): glib2-tools \
Requires(postun): glib2-tools
# On install, update the cache
%glib2_gio_module_post() \
%if "x%1" != "x%%1" \
GIO_MODULES_DIR="%1" \
%else \
GIO_MODULES_DIR="%{_libdir}/gio/modules" \
%endif \
%if "%{_lib}" == "lib64" \
%{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}" \
%else \
%{_bindir}/gio-querymodules "${GIO_MODULES_DIR}" \
%endif
# On uninstall, update the cache. Note: we ignore upgrades (already
# handled in %post of the new package).
%glib2_gio_module_postun() \
if [ $1 -eq 0 ]; then \
%if "x%1" != "x%%1" \
GIO_MODULES_DIR="%1" \
%else \
GIO_MODULES_DIR="%{_libdir}/gio/modules" \
%endif \
%if "%_lib" == "lib64" \
%{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}" \
%else \
%{_bindir}/gio-querymodules "${GIO_MODULES_DIR}" \
%endif \
fi