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