hook gvariant vectors up to kdbus
[platform/upstream/glib.git] / packaging / macros.glib2
1 # RPM macros for packages installing a GSettings schema or GIO module
2 #
3 ###
4 #
5 # When a package installs a GSettings schemas, it should use all
6 # three macros:
7 #
8 #  - %glib2_gsettings_schema_requires in the preamble
9 #  - %glib2_gsettings_schema_post in %post
10 #  - %glib2_gsettings_schema_postun in %postun
11 #
12 ###
13 #
14 # When a package installs a GIO module, it should use all
15 # three macros:
16 #
17 #  - %glib2_gio_module_requires in the preamble
18 #  - %glib2_gio_module_post in %post
19 #  - %glib2_gio_module_postun in %postun
20 #
21 # Note that %glib2_gio_module_post and %glib2_gio_module_postun can
22 # optionally take the path to the directory where modules live. This
23 # is useful for applications using the GIO module system on their own,
24 # since they will install modules in their own directory. If no
25 # argument is passed, the path for the modules for GIO itself is used.
26 #
27 ###
28
29 %glib2_gsettings_schema_requires                                \
30 Requires(post): glib2-tools                                     \
31 Requires(postun): glib2-tools
32
33 %glib2_gsettings_schema_post                                    \
34 %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
35
36 # Note: we ignore upgrades (already handled in %post of the new package).
37 %glib2_gsettings_schema_postun                                  \
38 if [ $1 -eq 0 ]; then                                           \
39   %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : \
40 fi
41
42 %glib2_gio_module_requires                                      \
43 Requires(post): glib2-tools                                     \
44 Requires(postun): glib2-tools
45
46 # On install, update the cache
47 %glib2_gio_module_post()                                        \
48 %if "x%1" != "x%%1"                                             \
49   GIO_MODULES_DIR="%1"                                          \
50 %else                                                           \
51   GIO_MODULES_DIR="%{_libdir}/gio/modules"                      \
52 %endif                                                          \
53 %if "%{_lib}" == "lib64"                                        \
54   %{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}"           \
55 %else                                                           \
56   %{_bindir}/gio-querymodules "${GIO_MODULES_DIR}"              \
57 %endif
58
59 # On uninstall, update the cache. Note: we ignore upgrades (already
60 # handled in %post of the new package).
61 %glib2_gio_module_postun()                                      \
62 if [ $1 -eq 0 ]; then                                           \
63   %if "x%1" != "x%%1"                                           \
64     GIO_MODULES_DIR="%1"                                        \
65   %else                                                         \
66     GIO_MODULES_DIR="%{_libdir}/gio/modules"                    \
67   %endif                                                        \
68   %if "%_lib" == "lib64"                                        \
69     %{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}"         \
70   %else                                                         \
71     %{_bindir}/gio-querymodules "${GIO_MODULES_DIR}"            \
72   %endif                                                        \
73 fi