]>
Commit | Line | Data |
---|---|---|
397b586d | 1 | # $Revision$, $Date$ |
d54662bf AF |
2 | # PLD rpm macros |
3 | ||
e05017c1 | 4 | %epoch 0 |
3241033b | 5 | %x8664 x86_64 amd64 ia32e |
9c404149 | 6 | |
ba1fdedc | 7 | # kernel compiler |
345d14e5 | 8 | %kgcc %{__cc} |
d2e1bc22 | 9 | %kgcc_package gcc |
ba1fdedc | 10 | |
3241033b ER |
11 | %_source_payload w9.gzdio |
12 | %_binary_payload w9.bzdio | |
13 | ||
33040789 | 14 | # Build system path macros. |
15 | # | |
bddadece JB |
16 | %__autoconf autoconf %{?debug:-Wall} |
17 | %__automake automake -a -c -f --foreign | |
f93109a0 | 18 | %__autopoint autopoint --force |
19 | ||
83094b62 | 20 | %__gettextize { \ |
3241033b | 21 | if ! gettextize --version | grep -q '0\.10\.' ; then \ |
8a995cff | 22 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ |
3241033b | 23 | gettextize --copy --force --no-changelog; \ |
97589b6e | 24 | else \ |
3241033b | 25 | gettextize --copy --force --no-changelog --intl; \ |
8a995cff JB |
26 | fi; \ |
27 | if [ ! -f po/Makevars ]; then \ | |
3241033b | 28 | cp -f po/Makevars{.template,}; \ |
8a995cff | 29 | fi; \ |
3241033b | 30 | else \ |
8a995cff | 31 | gettextize --copy --force; \ |
3241033b | 32 | fi; \ |
8a995cff | 33 | } |
f93109a0 | 34 | |
35 | %__glib_gettextize glib-gettextize --copy --force | |
36 | %__gnome_doc_common gnome-doc-common --copy | |
37 | %__gtkdocize gtkdocize --copy | |
38 | %__intltoolize intltoolize --copy --force | |
39 | %__libtoolize libtoolize --copy --force | |
33040789 | 40 | |
6a5eda77 | 41 | %dependencytracking %{nil} |
3241033b | 42 | |
e5da9169 ER |
43 | # Relations between package names that cause dependency loops |
44 | # with legacy packages that cannot be fixed. Relations are | |
45 | # specified as | |
46 | # p>q | |
47 | # where package p has a Requires: on something that package q Provides: | |
48 | # | |
49 | # XXX Note: that there cannot be any whitespace within the string "p>q", | |
50 | # and that both p and q are package names (i.e. no version/release). | |
51 | %_dependency_whiteout %{nil} | |
52 | ||
9c404149 | 53 | #----------------------------------------------------------------- |
9f4ce098 | 54 | %configure2_13 { \ |
9c404149 AM |
55 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
56 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
57 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
f4cc8832 | 58 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ |
9c404149 | 59 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ |
8ec1a12b | 60 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
8983c4c4 AM |
61 | %{?__cc:CC="%{__cc}" ; export CC ; } \ |
62 | %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ | |
8f74418b | 63 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ |
2a7cfd3f | 64 | --host=%{_target_platform} \ |
9c404149 AM |
65 | --prefix=%{_prefix} \ |
66 | --exec-prefix=%{_exec_prefix} \ | |
67 | --bindir=%{_bindir} \ | |
68 | --sbindir=%{_sbindir} \ | |
69 | --sysconfdir=%{_sysconfdir} \ | |
70 | --datadir=%{_datadir} \ | |
71 | --includedir=%{_includedir} \ | |
72 | --libdir=%{_libdir} \ | |
73 | --libexecdir=%{_libexecdir} \ | |
74 | --localstatedir=%{_localstatedir} \ | |
75 | --sharedstatedir=%{_sharedstatedir} \ | |
76 | --mandir=%{_mandir} \ | |
77 | --infodir=%{_infodir} \ | |
c0d1b3ad | 78 | --x-libraries=/usr/X11R6/%{_lib} \ |
93059874 | 79 | %{dependencytracking} \ |
9c404149 AM |
80 | } |
81 | ||
4a6b0d54 | 82 | #---------------------------------------------------------------- |
73f832b3 | 83 | %global configure_cache 0 |
84 | %configure_cache_file %{buildroot}.configure.cache | |
85 | ||
57f4166d | 86 | %configure {./configure \ |
4a6b0d54 AF |
87 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
88 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
f4cc8832 | 89 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ |
4a6b0d54 | 90 | FFLAGS="${FFLAGS:-%rpmcflags}" \ |
a2bd5992 | 91 | CPPFLAGS="${CPPFLAGS:-}" \ |
8983c4c4 AM |
92 | %{?__cc:CC="%{__cc}"} \ |
93 | %{?__cxx:CXX="%{__cxx}"} \ | |
8e4cb85a | 94 | --host=%{_target_platform} \ |
4a6b0d54 AF |
95 | --build=%{_target_platform} \ |
96 | --prefix=%{_prefix} \ | |
97 | --exec-prefix=%{_exec_prefix} \ | |
98 | --bindir=%{_bindir} \ | |
99 | --sbindir=%{_sbindir} \ | |
100 | --sysconfdir=%{_sysconfdir} \ | |
101 | --datadir=%{_datadir} \ | |
102 | --includedir=%{_includedir} \ | |
103 | --libdir=%{_libdir} \ | |
104 | --libexecdir=%{_libexecdir} \ | |
105 | --localstatedir=%{_localstatedir} \ | |
106 | --sharedstatedir=%{_sharedstatedir} \ | |
107 | --mandir=%{_mandir} \ | |
108 | --infodir=%{_infodir} \ | |
c0d1b3ad | 109 | --x-libraries=/usr/X11R6/%{_lib} \ |
93059874 | 110 | %{dependencytracking} \ |
73f832b3 | 111 | %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \ |
4a6b0d54 AF |
112 | } |
113 | ||
7dbab518 | 114 | # ------------------------------------------------------------------------ |
c80506a3 AM |
115 | # Overloading of some basic macros |
116 | %prep \ | |
117 | %%prep\ | |
118 | LANG=C\ | |
119 | export LANG\ | |
14e77e64 | 120 | unset DISPLAY ||:\ |
6db5639d | 121 | unset LINGUAS ||:\ |
c80506a3 AM |
122 | %{nil} |
123 | ||
124 | %build %%build\ | |
125 | LANG=C\ | |
126 | export LANG\ | |
14e77e64 | 127 | unset DISPLAY ||:\ |
6db5639d | 128 | unset LINGUAS ||:\ |
c80506a3 AM |
129 | %{nil} |
130 | ||
b4e3d367 ER |
131 | %install \ |
132 | %if 0%{?_enable_debug_packages}\ | |
133 | %{?buildsubdir:%{debug_package}}\ | |
134 | %endif\ | |
c80506a3 AM |
135 | %%install\ |
136 | LANG=C\ | |
137 | export LANG\ | |
14e77e64 | 138 | unset DISPLAY ||:\ |
6db5639d | 139 | unset LINGUAS ||:\ |
c80506a3 AM |
140 | %{nil} |
141 | ||
9c404149 AM |
142 | # Location of autoconf macros |
143 | %_aclocaldir %(aclocal --print-ac-dir) | |
144 | ||
e2804f99 AM |
145 | # Location of omf files |
146 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
147 | ||
e987a186 | 148 | # Location of pkgconfig files |
9a4e877a | 149 | %_pkgconfigdir /usr/%{_lib}/pkgconfig |
e987a186 | 150 | |
486b0b5f | 151 | # Location of desktop files |
152 | %_desktopdir /usr/share/applications | |
86dff2d0 | 153 | %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead |
486b0b5f | 154 | |
481463e9 | 155 | # Location of pixmaps for applnk/desktop files |
e1f0a822 | 156 | %_pixmapsdir /usr/share/pixmaps |
9c404149 | 157 | |
481463e9 | 158 | # Location of themable icons for applnk/desktop files |
b36c8e2a | 159 | %_iconsdir /usr/share/icons |
160 | ||
e987a186 JB |
161 | # Location of fonts directories |
162 | %_fontsdir /usr/share/fonts | |
163 | ||
b3282f3f | 164 | # Location of Gtk and associated libraries documentation |
6eed6d84 | 165 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html |
b3282f3f | 166 | |
fc4d7771 | 167 | # Location of KDE documentation |
168 | %_kdedocdir %{_defaultdocdir}/kde/HTML | |
169 | ||
5869828c | 170 | # unsermake script |
171 | %__unsermake /usr/share/unsermake/unsermake | |
172 | ||
9c404149 AM |
173 | # Current date |
174 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
175 | ||
176 | # tmp directory | |
177 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
178 | ||
179 | # Example files, programs, scripts... | |
180 | %_examplesdir /usr/src/examples | |
181 | ||
8377d27d | 182 | # The directory holding Linux kernel sources |
183 | %_kernelsrcdir /usr/src/linux | |
184 | ||
9c404149 | 185 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
8f74418b | 186 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
9c404149 | 187 | |
8f74418b | 188 | # Requires name = version-release |
ec4e8b11 | 189 | %requires_releq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not") |
8bf3719d | 190 | |
c12095e9 PS |
191 | %releq_kernel_up() %(LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") |
192 | %releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
193 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
194 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
8bf3719d | 195 | |
16cb1d91 | 196 | %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not") |
01a9f990 | 197 | |
c0b2771b | 198 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR) |
b9d5d440 | 199 | |
200 | # kernel version-release handling | |
3241033b ER |
201 | %__kernel_ver %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | head -n 1 | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } /^EXTRAVERSION/ { ever = $0; gsub(/EXTRAVERSION.*=/, NIL, ever); gsub(/ /, NIL, ever); } END { printf("%d.%d.%d%s", ver, plev, slev, ever); }' %{_kernelsrcdir}/Makefile 2> /dev/null)) |
202 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not") | |
f004e915 | 203 | %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not") |
3241033b | 204 | %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})} |
f62e856d | 205 | %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g') |
87be1cf0 | 206 | |
e00dd7f6 | 207 | # sgml macros |
3241033b ER |
208 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ; |
209 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ; | |
210 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
211 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ; | |
212 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ; | |
213 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ; | |
e00dd7f6 | 214 | %docbook_sgmlcat_fix() { for l in \ |
215 | '' \ | |
216 | ' -- default decl --' \ | |
217 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
218 | ' -- hacks for opensp --' \ | |
219 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
220 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
221 | '' \ | |
222 | ; do echo $l; done >> %1 \ | |
223 | } | |
224 | ||
9c404149 AM |
225 | #----------------------------------------------------------------- |
226 | # find and gzip all files in %{_mandir} and %{infodir} | |
227 | # | |
228 | # Requires: xargs, find | |
229 | # | |
230 | #%no_install_post_compress_docs 1 | |
231 | %__spec_install_post_compress_docs { \ | |
9c404149 | 232 | %{!?no_install_post_compress_docs: \ |
822d4d81 | 233 | echo "Compress man and info pages."; \ |
9c404149 AM |
234 | %{?verbose:set -x;} \ |
235 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
236 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
237 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
238 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
239 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
240 | fi; \ | |
241 | done; \ | |
242 | } } | |
243 | ||
244 | #----------------------------------------------------------------- | |
245 | # Strip executable binaries and shared object files | |
246 | # | |
247 | # Requires: find, awk, strip, cut, xargs | |
248 | # | |
249 | #%no_install_post_strip 1 | |
250 | %__spec_install_post_strip {%{!?debug: \ | |
251 | %{!?no_install_post_strip: \ | |
3241033b ER |
252 | %{?verbose:set -x;} \ |
253 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
8f74418b | 254 | echo "Strip executable binaries, archives and shared object files."; \ |
b4e3d367 | 255 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \ |
9c404149 AM |
256 | elfexelist=`echo $filelist | xargs -r file | \ |
257 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
258 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
259 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
8f74418b MM |
260 | elfarchiveslist=`echo $filelist | xargs -r file | \ |
261 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
9c404149 | 262 | if [ -n "$elfexelist" ]; then \ |
60ad88f2 | 263 | %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \ |
9c404149 AM |
264 | fi; \ |
265 | if [ -n "$elfsharedlist" ]; then \ | |
60ad88f2 | 266 | %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ |
8f74418b MM |
267 | fi; \ |
268 | if [ -n "$elfarchiveslist" ]; then \ | |
60ad88f2 | 269 | %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ |
9f0d4f36 | 270 | fi; \ |
3241033b | 271 | fi; } \ |
9c404149 | 272 | } } |
3241033b | 273 | |
fc5d7e20 | 274 | #----------------------------------------------------------------- |
275 | # remove all RPATH from executable binaries and shared object files | |
276 | # | |
277 | # Requires: find, awk, cut, xargs, chrpath, uname | |
278 | # | |
279 | #%no_install_post_chrpath 1 | |
280 | %__spec_install_post_chrpath {%{!?debug: \ | |
281 | %{!?no_install_post_chrpath: \ | |
282 | %{?verbose:set -x;} \ | |
9f0d4f36 | 283 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
fc5d7e20 | 284 | echo "Remove RPATH from executable binaries and shared object files."; \ |
adb39da4 | 285 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ |
5bed2bb7 | 286 | awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ |
fc5d7e20 | 287 | while read file ; do \ |
288 | rpath= ; \ | |
289 | chmod u+w "$file"; \ | |
290 | for dir in `chrpath -l "$file" | \ | |
3241033b | 291 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ |
fc5d7e20 | 292 | case $dir in \ |
494e368c | 293 | /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \ |
fc5d7e20 | 294 | echo "remove-rpath: $dir in $file"; \ |
295 | ;; \ | |
296 | * ) \ | |
297 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
298 | else rpath="$rpath:$dir" ; fi ; \ | |
299 | ;; \ | |
300 | esac ; \ | |
301 | done ; \ | |
302 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
303 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
9f0d4f36 JB |
304 | done; \ |
305 | fi; } \ | |
fc5d7e20 | 306 | } } |
3241033b | 307 | |
d72c185f | 308 | #----------------------------------------------------------------- |
ccb8ae8d | 309 | # Find and gzip all kernel modules |
310 | # | |
311 | # Requires: find | |
312 | # | |
313 | #%no_install_post_compress_modules 1 | |
314 | %__spec_install_post_compress_modules { \ | |
ccb8ae8d | 315 | %{!?no_install_post_compress_modules: \ |
3241033b ER |
316 | %{?verbose:set -x;} \ |
317 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
318 | echo "Compress kernel modules if any."; \ | |
319 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ | |
320 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \ | |
321 | xargs -r %{__gzip} -9nf; \ | |
322 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \ | |
323 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
324 | fi; \ | |
325 | fi; \ | |
ccb8ae8d | 326 | } } |
9c404149 | 327 | |
83094b62 | 328 | #----------------------------------------------------------------- |
0e4cb4dd | 329 | # Update GConf2 schemas |
83094b62 | 330 | # |
331 | # Requires: GConf2 | |
332 | # | |
46885239 | 333 | %gconf_schema_install() \ |
3241033b ER |
334 | umask 022; \ |
335 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null \ | |
336 | %{nil} | |
46885239 | 337 | |
338 | %gconf_schema_uninstall() \ | |
f93109a0 | 339 | if [ $1 = 0 ]; then \ |
3241033b ER |
340 | umask 022; \ |
341 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \ | |
f93109a0 | 342 | fi \ |
343 | %{nil} | |
344 | ||
345 | #----------------------------------------------------------------- | |
346 | # Update desktop MIME database | |
c0a4caa0 | 347 | # requires: desktop-file-utils |
f93109a0 | 348 | # |
820792a9 | 349 | %update_desktop_database_post() {{ \ |
f93109a0 | 350 | umask 022; \ |
351 | /usr/bin/update-desktop-database; \ | |
4565b525 | 352 | }} |
f93109a0 | 353 | |
09e3522b | 354 | %update_desktop_database_postun() {{ \ |
f93109a0 | 355 | if [ $1 = 0 ]; then \ |
356 | umask 022; \ | |
357 | /usr/bin/update-desktop-database; \ | |
358 | fi \ | |
4565b525 | 359 | }} |
f93109a0 | 360 | |
361 | #----------------------------------------------------------------- | |
362 | # Update scrollkeeper database | |
363 | # requires: scrollkeeper | |
364 | # | |
365 | %scrollkeeper_update_post() \ | |
f93109a0 | 366 | /usr/bin/scrollkeeper-update -q; \ |
367 | %{nil} | |
368 | ||
369 | %scrollkeeper_update_postun() \ | |
370 | if [ $1 = 0 ]; then \ | |
f93109a0 | 371 | /usr/bin/scrollkeeper-update -q; \ |
372 | fi \ | |
373 | %{nil} | |
374 | ||
375 | #----------------------------------------------------------------- | |
376 | # Run ldconfig after installing/deinstalling libraries | |
377 | # | |
378 | %ldconfig_post() \ | |
379 | /sbin/ldconfig; \ | |
380 | %{nil} | |
381 | ||
382 | %ldconfig_postun() \ | |
f93109a0 | 383 | /sbin/ldconfig; \ |
b430f866 | 384 | %{nil} |
83094b62 | 385 | |
9c404149 AM |
386 | #----------------------------------------------------------------- |
387 | # post %install sequence: | |
388 | # - autodeps exceptions | |
389 | # - compress all man and info pages, | |
390 | # - strip all ELF executables and ELF shared objects if not %debug. | |
8f74418b | 391 | # - compress kernel modules if any |
9c404149 AM |
392 | |
393 | ################################################################### | |
394 | # Requires/Provides automation | |
395 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
338726a6 | 396 | # |
2892b5df JB |
397 | %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} |
398 | %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} | |
399 | %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}} | |
400 | %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} | |
401 | %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}} | |
338726a6 JB |
402 | #%_noautocompressdoc %{nil} |
403 | # | |
8f74418b MM |
404 | %_missing_doc_files_terminate_build 1%{nil} |
405 | %_unpackaged_files_terminate_build %{nil} | |
8781dc74 | 406 | # (X)emacs support |
d77dcb61 | 407 | %___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}' |
8781dc74 AF |
408 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) |
409 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
25043cd4 | 410 | |
02b58f60 JK |
411 | %__php_provides %{nil} |
412 | %__php_requires %{nil} | |
413 | %__perl_provides %{nil} | |
414 | %__perl_requires %{nil} | |
fa3497cd | 415 | %__mono_provides %{nil} |
416 | %__mono_requires %{nil} | |
25043cd4 AF |
417 | |
418 | # Perl specific macro definitions. | |
34f59add ER |
419 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) |
420 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
421 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
c853f847 | 422 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) |
34f59add ER |
423 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) |
424 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
25043cd4 | 425 | |
45c00b39 | 426 | # Ruby |
c5472d67 ER |
427 | %ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR) |
428 | %ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR) | |
429 | %ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR) | |
430 | %ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR) | |
431 | %ruby_sitelibdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR) | |
432 | %ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR) | |
669604db ER |
433 | %ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version |
434 | %ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version | |
45c00b39 | 435 | |
c853f847 | 436 | %php_pear_dir %{_datadir}/pear |
25043cd4 | 437 | |
c1b2705c ER |
438 | # directory where php includes are installed on system. |
439 | %__php_includedir /usr/include/php | |
0c5d1b9b | 440 | # extract php/zend api versions |
e9b6395a | 441 | %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR) |
c1b2705c | 442 | %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR) |
68b68193 | 443 | %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR) |
c1b2705c ER |
444 | %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR) |
445 | %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR) | |
c0ac7203 | 446 | %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR}) |
c1b2705c ER |
447 | |
448 | # helper macro | |
f952c0f3 | 449 | %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}} |
c1b2705c ER |
450 | |
451 | # macros for public use | |
452 | # for php extensions (php-pecl) | |
68b68193 | 453 | %requires_php_extension %{__php_api_requires modules_api php_api_version} \ |
f952c0f3 ER |
454 | %{__php_api_requires -v %php_major_version debug php_debug} \ |
455 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
68b68193 | 456 | |
c1b2705c ER |
457 | # for zend extensions |
458 | %requires_zend_extension %{__php_api_requires zend_module_api} \ | |
68b68193 | 459 | %{__php_api_requires zend_extension_api} \ |
f952c0f3 ER |
460 | %{__php_api_requires -v %php_major_version debug php_debug} \ |
461 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
c1b2705c | 462 | |
25043cd4 AF |
463 | # Python specific macro definitions. |
464 | # python main version | |
3241033b | 465 | %py_ver %(python -c "import sys; print sys.version[:3]") |
25043cd4 AF |
466 | |
467 | # directories | |
3241033b ER |
468 | %py_prefix %(python -c "import sys; print sys.prefix") |
469 | %py_libdir %{py_prefix}/%{_lib}/python%{py_ver} | |
ef7ec0a8 | 470 | %py_scriptdir %{py_prefix}/share/python%{py_ver} |
3241033b | 471 | %py_incdir /usr/include/python%{py_ver} |
ef7ec0a8 JK |
472 | %py_sitedir %{py_libdir}/site-packages |
473 | %py_sitescriptdir %{py_scriptdir}/site-packages | |
3241033b | 474 | %py_dyndir %{py_libdir}/lib-dynload |
25043cd4 AF |
475 | |
476 | # pure python modules compilation | |
3241033b | 477 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
25043cd4 | 478 | |
3241033b | 479 | %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
25043cd4 AF |
480 | |
481 | # Software written in Python language require Python with main version | |
e63cd81d | 482 | %pyrequires_eq() Requires: %1 |
25043cd4 | 483 | |
f12c2314 AF |
484 | # Hardlink binary identical .pyc and .pyo files |
485 | # (idea by glen <at> pld-linux <dot> org) | |
486 | %__spec_install_post_py_hardlink {\ | |
d56b7e24 | 487 | %{!?no_install_post_py_hardlink: \ |
f12c2314 AF |
488 | [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \ |
489 | b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \ | |
490 | if cmp -s "$a" "$b"; then \ | |
491 | ln -f "$a" "$b"; \ | |
492 | fi; \ | |
493 | done \ | |
494 | } } | |
495 | ||
9227b3f9 | 496 | # remove python sources, so that check-files won't complain |
f12c2314 AF |
497 | # (idea by glen <at> pld-linux <dot> org) |
498 | %py_postclean() \ | |
0f82e280 | 499 | for d in %{py_sitescriptdir} %{py_sitedir} %*; do \ |
820792a9 | 500 | [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\ |
f12c2314 AF |
501 | done \ |
502 | %{nil} | |
503 | ||
0fc5cff8 | 504 | # depmod macro |
505 | %depmod() { \ | |
f6148427 | 506 | umask 022; \ |
0fc5cff8 | 507 | if [ -e /boot/System.map-%1 ]; then \ |
3241033b | 508 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ |
0fc5cff8 | 509 | else \ |
3241033b ER |
510 | if [ -e /boot/System.map ]; then \ |
511 | /sbin/depmod -a -F /boot/System.map %1; \ | |
512 | else \ | |
513 | /sbin/depmod -a %1; \ | |
514 | fi \ | |
0fc5cff8 | 515 | fi; \ |
516 | } | |
517 | ||
2afc6e64 | 518 | # XMMS specific macros |
3241033b ER |
519 | %xmms_prefix %(xmms-config --prefix 2>/dev/null) |
520 | %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null) | |
521 | %xmms_version %(xmms-config --version 2>/dev/null) | |
522 | %xmms_datadir %(xmms-config --data-dir 2>/dev/null) | |
523 | %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null) | |
524 | %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null) | |
525 | %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null) | |
526 | %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null) | |
527 | %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null) | |
528 | %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null) | |
2afc6e64 | 529 | |
d1537778 PS |
530 | %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/') |
531 | ||
848c0d68 | 532 | # user/group checking macros |
533 | # | |
534 | # Usage: | |
535 | # %userremove myuser | |
536 | # | |
537 | %userremove /usr/lib/rpm/user_group.sh user del | |
538 | %groupremove /usr/lib/rpm/user_group.sh group del | |
539 | # | |
540 | # Usage: | |
541 | # if %usertestrm myuser; then | |
542 | # /usr/sbin/userdel -r myuser | |
543 | # Note: | |
544 | # use these macros only if you need to call userdel/groupdel with | |
545 | # a non-standard option or take an extra action; otherwise use the | |
546 | # %userremove/%groupremove macros | |
547 | # | |
548 | %usertestrm /usr/lib/rpm/user_group.sh user testrm | |
549 | %grouptestrm /usr/lib/rpm/user_group.sh group testrm | |
08d9b1f6 JK |
550 | # user group membership management macros |
551 | # | |
552 | # Usage: | |
553 | # %addusertogroup myuser agroup | |
554 | # | |
555 | %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup | |
72fcfcb3 | 556 | |
557 | # banner support (useful in {pre,post}{,un} and triggers) | |
558 | # | |
559 | # Usage: | |
aa41c920 | 560 | # %banner name [-a] [-e] [-n] [-tn] <<EOF |
72fcfcb3 | 561 | # the banner text, the banner text |
aa41c920 ER |
562 | # the banner text, and following line |
563 | #EOF | |
564 | # You can use any form of here-document, <<'EOF' <<-EOT will do. | |
565 | # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. | |
566 | # | |
72fcfcb3 | 567 | # -a - append to the banner |
a8b9562a | 568 | # -e - send to stderr instead of stdout |
628754cb | 569 | # -n - no show banner (overrides -t) |
570 | # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 | |
aa41c920 | 571 | %banner(aent:) \ |
1b334fe4 | 572 | RPM_SCRIPTVERBOSITY=5 \ |
573 | [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ | |
574 | if [ -x /usr/bin/banner.sh ]; then \ | |
aa41c920 | 575 | CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \ |
1b334fe4 | 576 | else \ |
a8b9562a | 577 | CMD="cat%{-e: >&2}" \ |
1b334fe4 | 578 | fi \ |
c2e886e1 | 579 | eval $CMD %2%{?3: %3} \ |
72fcfcb3 | 580 | %nil |
628754cb | 581 | |
90627280 ER |
582 | # useradd/groupadd macros written by glen@pld-linux.org. |
583 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
584 | # | |
585 | # Usage: | |
586 | # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment] | |
587 | # [-g initial_group] [-G group[,...]] login | |
588 | # | |
589 | # -u uid. REQUIRED | |
590 | # -g gid/group. REQUIRED | |
591 | # -s defaults to /bin/false | |
592 | # -d defaults to /usr/share/empty | |
593 | # -c No default | |
594 | # -r is accepted but ignored (it's always set) | |
6bd4c218 | 595 | # -k skeleton dir. defaults to /usr/share/empty |
90627280 ER |
596 | # rpm specific flags |
597 | # -P package name. defaults to %{name} | |
598 | # | |
90627280 | 599 | %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \ |
9ba02ba9 ER |
600 | %{!-u:%{error:useradd: Required argument -u missing}} \ |
601 | %{!-g:%{error:useradd: Required argument -g missing}} \ | |
602 | %{!?1:%{error:useradd: Required parameter login missing}} \ | |
90627280 ER |
603 | if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \ |
604 | if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \ | |
605 | echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
606 | exit 1 \ | |
607 | fi \ | |
608 | else \ | |
609 | echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \ | |
610 | /usr/sbin/useradd \\\ | |
b5a7d552 | 611 | %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\ |
90627280 ER |
612 | -u %{-u*} \\\ |
613 | -r \\\ | |
614 | -d %{-d*}%{!-d:/usr/share/empty} \\\ | |
615 | -s %{-s*}%{!-s:/bin/false} \\\ | |
840e7b00 | 616 | %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\ |
90627280 ER |
617 | -g %{-g*} \\\ |
618 | %{-M} \\\ | |
619 | %{-G:-G %{-G*}} \\\ | |
840e7b00 | 620 | %{expand:%{%{#}}} 1>&2 \ |
90627280 ER |
621 | fi; |
622 | ||
90627280 ER |
623 | # Usage: |
624 | # %groupadd [-P package] [-g gid] group | |
625 | # | |
626 | # -g gid. REQUIRED | |
627 | # | |
628 | # Sample: | |
629 | # %groupadd -P %{name}-base -g %{gid} %{name} | |
630 | ||
631 | %groupadd(g:P:rfo) \ | |
9ba02ba9 ER |
632 | %{!-g:%{error:groupadd: Required argument -g missing}} \ |
633 | %{!?1:%{error:groupadd: Required parameter group missing}} \ | |
90627280 ER |
634 | if [ -n "`/usr/bin/getgid %{1}`" ]; then \ |
635 | if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \ | |
636 | echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
637 | exit 1 \ | |
638 | fi \ | |
639 | else \ | |
640 | echo "Adding group %{1} GID=%{-g*}." \ | |
840e7b00 | 641 | /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 \ |
90627280 | 642 | fi; |
7cb77741 ER |
643 | |
644 | # apache_config_{install/uninstall} macros written by glen@pld-linux.org. | |
645 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
646 | # | |
647 | # The config is installed/removed inside trigger, this means that you can any | |
648 | # time install apache1 or apache package and the configuration file is updated. | |
649 | # if you don't need the config for various reason for specific apache, just | |
650 | # remove the symlink from apache config directory. the trigger will not put the | |
651 | # config again to that version of apache. In other words the config is linked | |
652 | # to apache config directory on first install of PACKAGE or apache. | |
653 | # | |
654 | # should be called in trigger body: | |
655 | # %triggerin -- apache1 >= 1.3.33-2 | |
656 | # %apache_config_install -v 1 | |
657 | # | |
658 | # Add package's apache config to apache config. | |
659 | # | |
660 | # Usage: | |
661 | # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99 | |
662 | # | |
663 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
664 | # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf. | |
665 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
13ee223c | 666 | # -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers |
7cb77741 ER |
667 | # |
668 | # Internal macros. don't use ;). | |
669 | # expands apache config dir by apache version at build time. | |
670 | %__apache_confdir() %(if [ %{1} = 1 ]; then echo /etc/apache/conf.d; elif [ %{1} = 2 ]; then echo /etc/httpd/httpd.conf; else echo >&2 Unknown apache version specified; fi) | |
671 | # expands apache service name by apache version at build time. | |
672 | %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi) | |
673 | ||
13ee223c | 674 | %apache_config_install(fv:c:n:) \ |
7cb77741 ER |
675 | %{!-v:%{error:apache_config_install: Required argument -v missing}} \ |
676 | %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ | |
13ee223c | 677 | if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\ |
7cb77741 ER |
678 | ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\ |
679 | fi\ | |
e5a1a393 | 680 | # reload apache if the config symlink is there\ |
de11f042 | 681 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\ |
ab251261 ER |
682 | # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \ |
683 | if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\ | |
e5a1a393 | 684 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\ |
7cb77741 ER |
685 | fi\ |
686 | fi\ | |
687 | %{nil} | |
688 | ||
689 | # Remove package's apache config from apache config. | |
690 | # | |
691 | # Usage: | |
692 | # %apache_config_uninstall -v {1|2} -n 99 | |
693 | # | |
694 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
695 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
696 | %apache_config_uninstall(v:n:) \ | |
697 | %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \ | |
698 | %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \ | |
feb15ceb | 699 | # remove link if either of the packages are gone \ |
7cb77741 ER |
700 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ |
701 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \ | |
702 | rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \ | |
703 | if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \ | |
e5a1a393 | 704 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \ |
7cb77741 ER |
705 | fi \ |
706 | fi \ | |
707 | fi \ | |
708 | %{nil} | |
709 | ||
7c50f037 | 710 | # webapp macros |
35663282 ER |
711 | # |
712 | # The config is installed/removed inside trigger, this means that you can any | |
713 | # time install apache1/apache/lighttpd package and the configuration file is | |
714 | # updated. if you don't need the config for various reason for specific | |
715 | # webserver, just remove the symlink from config directory using webapp | |
716 | # program. the trigger will not recreate the symlink on upgrades. In other | |
717 | # words the config is linked to webserver config directory on first install of | |
718 | # PACKAGE or WEBSERVER. | |
719 | # | |
7c50f037 ER |
720 | # Add package's webserver config to webserver webapps dir. |
721 | # Usage: | |
df979130 | 722 | # %webapp_register WEBSERVER WEBAPP |
35663282 ER |
723 | # |
724 | %webapp_register() \ | |
725 | %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ | |
726 | if [ "$1" = "1" ] && [ "$2" = "1" ]; then\ | |
727 | /usr/sbin/webapp register %1 %2\ | |
728 | fi\ | |
694a8f2e ER |
729 | # reload webserver if the config symlink is there and skip reload if webserver is upgraded\ |
730 | if [ -L /etc/%1/webapps.d/%2.conf ] && [ "$2" -lt "2" ] && [ -f /var/lock/subsys/%1 ]; then\ | |
731 | /etc/rc.d/init.d/%1 reload 1>&2\ | |
35663282 ER |
732 | fi\ |
733 | %{nil} | |
734 | ||
735 | # Remove package's config from webserver webapps dir. | |
35663282 | 736 | # Usage: |
531c0efc ER |
737 | # %webapp_register [-f] WEBSERVER WEBAPP |
738 | %webapp_unregister(f) \ | |
35663282 ER |
739 | %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \ |
740 | # remove link if either of the packages are gone \ | |
531c0efc | 741 | if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%2.conf ]; then \ |
df979130 | 742 | /usr/sbin/webapp unregister %1 %2\ |
694a8f2e ER |
743 | if [ -f /var/lock/subsys/%1 ]; then \ |
744 | /etc/rc.d/init.d/%1 reload 1>&2 \ | |
35663282 ER |
745 | fi \ |
746 | fi \ | |
747 | %{nil} | |
748 | ||
d87a3f0b ER |
749 | # see browser-plugins.spec / template-browser-plugin.spec |
750 | # written by glen@pld-linux.org. | |
bba6d017 | 751 | %nsplugin_install(d:f) { \ |
d87a3f0b | 752 | # create link if it's first install of either of the packages \ |
bba6d017 | 753 | if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \ |
d87a3f0b ER |
754 | ( \ |
755 | %( \ | |
756 | for file in %{*}; do \ | |
757 | echo echo Installing $file to %{-d*}; \ | |
758 | echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \ | |
759 | done ) \ | |
760 | ) | ( %banner -t 5 -e %{name}-in ); fi; \ | |
761 | } | |
762 | ||
933139a5 | 763 | %nsplugin_uninstall(d:) { \ |
d87a3f0b ER |
764 | # remove link if either of the packages are gone \ |
765 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ | |
766 | ( \ | |
767 | %( \ | |
768 | for file in %{*}; do \ | |
769 | echo echo Removing $file from %{-d*}; \ | |
770 | echo "rm -f %{-d*}/$file;"; \ | |
771 | done ) \ | |
772 | ) | ( %banner -t 5 -e %{name}-un ); fi; \ | |
773 | } | |
462b26fa ER |
774 | |
775 | # service macro. | |
776 | # | |
777 | # calls usual service restart on package %post, but skips the restart if | |
778 | # administrator has disabled automatic service restarts in either global | |
779 | # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file. | |
780 | # | |
781 | # written by glen@pld-linux.org. | |
782 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
783 | # | |
784 | # Usage: | |
3e913a30 | 785 | # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"] |
462b26fa ER |
786 | # |
787 | # -q be silent when service isn't started (for postun scriplets) | |
788 | # | |
8b781cff | 789 | %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };} |