]>
Commit | Line | Data |
---|---|---|
b52fc1f1 | 1 | # $Revision$, $Date$ |
a8bf9720 AF |
2 | # PLD rpm macros |
3 | ||
90c0eaed | 4 | %epoch 0 |
31b569b6 | 5 | %x8664 x86_64 amd64 ia32e |
cd33aab7 | 6 | |
a544555d | 7 | # kernel compiler |
6f86c45e | 8 | %kgcc %{__cc} |
cabacfeb | 9 | %kgcc_package gcc |
a544555d | 10 | |
31b569b6 ER |
11 | %_source_payload w9.gzdio |
12 | %_binary_payload w9.bzdio | |
13 | ||
5f9f9bd7 | 14 | # Build system path macros. |
15 | # | |
8af1c6f5 JB |
16 | %__autoconf autoconf %{?debug:-Wall} |
17 | %__automake automake -a -c -f --foreign | |
429d047e | 18 | %__autopoint autopoint --force |
19 | ||
aad1c8e4 | 20 | %__gettextize { \ |
31b569b6 | 21 | if ! gettextize --version | grep -q '0\.10\.' ; then \ |
4cd84746 | 22 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ |
31b569b6 | 23 | gettextize --copy --force --no-changelog; \ |
93bce43f | 24 | else \ |
31b569b6 | 25 | gettextize --copy --force --no-changelog --intl; \ |
4cd84746 JB |
26 | fi; \ |
27 | if [ ! -f po/Makevars ]; then \ | |
31b569b6 | 28 | cp -f po/Makevars{.template,}; \ |
4cd84746 | 29 | fi; \ |
31b569b6 | 30 | else \ |
4cd84746 | 31 | gettextize --copy --force; \ |
31b569b6 | 32 | fi; \ |
4cd84746 | 33 | } |
429d047e | 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 | |
5f9f9bd7 | 40 | |
bd1cd543 | 41 | %dependencytracking %{nil} |
31b569b6 | 42 | |
073ae3ba 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 | ||
cd33aab7 | 53 | #----------------------------------------------------------------- |
9f0287b5 | 54 | %configure2_13 { \ |
cd33aab7 AM |
55 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
56 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
57 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
af18d245 | 58 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ |
cd33aab7 | 59 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ |
c55f2219 | 60 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
4eac2e49 AM |
61 | %{?__cc:CC="%{__cc}" ; export CC ; } \ |
62 | %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ | |
5b0f0ac9 | 63 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ |
fa74a11c | 64 | --host=%{_target_platform} \ |
cd33aab7 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} \ | |
c3420100 | 78 | --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \ |
8b4be1e1 | 79 | %{dependencytracking} \ |
cd33aab7 AM |
80 | } |
81 | ||
85f82bec | 82 | #---------------------------------------------------------------- |
7e4e3f2b | 83 | %global configure_cache 0 |
84 | %configure_cache_file %{buildroot}.configure.cache | |
85 | ||
b8cf6778 | 86 | %configure {./configure \ |
85f82bec AF |
87 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
88 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
af18d245 | 89 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ |
85f82bec | 90 | FFLAGS="${FFLAGS:-%rpmcflags}" \ |
418d9760 | 91 | CPPFLAGS="${CPPFLAGS:-}" \ |
4eac2e49 AM |
92 | %{?__cc:CC="%{__cc}"} \ |
93 | %{?__cxx:CXX="%{__cxx}"} \ | |
a9bea0f7 | 94 | --host=%{_target_platform} \ |
85f82bec 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} \ | |
c3420100 | 109 | --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \ |
8b4be1e1 | 110 | %{dependencytracking} \ |
7e4e3f2b | 111 | %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \ |
85f82bec AF |
112 | } |
113 | ||
617b7266 | 114 | # ------------------------------------------------------------------------ |
a0bade1c AM |
115 | # Overloading of some basic macros |
116 | %prep \ | |
117 | %%prep\ | |
118 | LANG=C\ | |
119 | export LANG\ | |
7febf367 | 120 | unset DISPLAY ||:\ |
7507b4fa | 121 | unset LINGUAS ||:\ |
a0bade1c AM |
122 | %{nil} |
123 | ||
124 | %build %%build\ | |
125 | LANG=C\ | |
126 | export LANG\ | |
7febf367 | 127 | unset DISPLAY ||:\ |
7507b4fa | 128 | unset LINGUAS ||:\ |
a0bade1c AM |
129 | %{nil} |
130 | ||
1fcb29e9 ER |
131 | %install \ |
132 | %if 0%{?_enable_debug_packages}\ | |
133 | %{?buildsubdir:%{debug_package}}\ | |
134 | %endif\ | |
a0bade1c AM |
135 | %%install\ |
136 | LANG=C\ | |
137 | export LANG\ | |
7febf367 | 138 | unset DISPLAY ||:\ |
7507b4fa | 139 | unset LINGUAS ||:\ |
a0bade1c AM |
140 | %{nil} |
141 | ||
cd33aab7 AM |
142 | # Location of autoconf macros |
143 | %_aclocaldir %(aclocal --print-ac-dir) | |
144 | ||
32720a50 AM |
145 | # Location of omf files |
146 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
147 | ||
c5eece2c | 148 | # Location of pkgconfig files |
a46897a7 | 149 | %_pkgconfigdir /usr/%{_lib}/pkgconfig |
c5eece2c | 150 | |
c917274d | 151 | # Location of desktop files |
152 | %_desktopdir /usr/share/applications | |
510f694c | 153 | %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead |
c917274d | 154 | |
fb08fb4a | 155 | # Location of pixmaps for applnk/desktop files |
3a9bb008 | 156 | %_pixmapsdir /usr/share/pixmaps |
cd33aab7 | 157 | |
fb08fb4a | 158 | # Location of themable icons for applnk/desktop files |
986c3bcd | 159 | %_iconsdir /usr/share/icons |
160 | ||
c5eece2c JB |
161 | # Location of fonts directories |
162 | %_fontsdir /usr/share/fonts | |
163 | ||
5cfcbc9e | 164 | # Location of Gtk and associated libraries documentation |
e9f33a26 | 165 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html |
5cfcbc9e | 166 | |
eee08b2d | 167 | # Location of KDE documentation |
168 | %_kdedocdir %{_defaultdocdir}/kde/HTML | |
169 | ||
a7cad6ae | 170 | # unsermake script |
171 | %__unsermake /usr/share/unsermake/unsermake | |
172 | ||
cd33aab7 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 | ||
bd63739a | 182 | # The directory holding Linux kernel sources |
183 | %_kernelsrcdir /usr/src/linux | |
184 | ||
cd33aab7 | 185 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
5b0f0ac9 | 186 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
cd33aab7 | 187 | |
5b0f0ac9 | 188 | # Requires name = version-release |
5237e419 | 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") |
511ee4c6 | 190 | |
7348a2f8 ER |
191 | %releq_kernel_up() %((LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | 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 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
dd4e969a ER |
193 | %requires_releq_kernel_up(s:) Requires%{-s:(%{-s*})}: %releq_kernel_up |
194 | %requires_releq_kernel_smp(s:) Requires%{-s:(%{-s*})}: %releq_kernel_smp | |
511ee4c6 | 195 | |
c7359865 | 196 | %requires_eq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") |
d0bdd45a | 197 | %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not") |
e478b9e7 | 198 | |
4ca2266c | 199 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR) |
8dea1306 | 200 | |
201 | # kernel version-release handling | |
31b569b6 ER |
202 | %__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)) |
203 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not") | |
ed0057d9 | 204 | %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not") |
31b569b6 | 205 | %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})} |
066309eb | 206 | %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g') |
fd4d8ee0 | 207 | |
c2c27a5a | 208 | # sgml macros |
31b569b6 ER |
209 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ; |
210 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ; | |
211 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
212 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ; | |
213 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ; | |
214 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ; | |
c2c27a5a | 215 | %docbook_sgmlcat_fix() { for l in \ |
216 | '' \ | |
217 | ' -- default decl --' \ | |
218 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
219 | ' -- hacks for opensp --' \ | |
220 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
221 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
222 | '' \ | |
223 | ; do echo $l; done >> %1 \ | |
224 | } | |
225 | ||
cd33aab7 AM |
226 | #----------------------------------------------------------------- |
227 | # find and gzip all files in %{_mandir} and %{infodir} | |
228 | # | |
229 | # Requires: xargs, find | |
230 | # | |
231 | #%no_install_post_compress_docs 1 | |
232 | %__spec_install_post_compress_docs { \ | |
f67bd19e | 233 | %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \ |
89f18684 | 234 | echo "Compress man and info pages."; \ |
cd33aab7 AM |
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; \ | |
f67bd19e | 242 | }; __spec_install_post_compress_docs } } |
cd33aab7 AM |
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: \ | |
f67bd19e | 251 | %{!?no_install_post_strip:__spec_install_post_strip() { \ |
31b569b6 | 252 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
5b0f0ac9 | 253 | echo "Strip executable binaries, archives and shared object files."; \ |
1fcb29e9 | 254 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \ |
cd33aab7 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`; \ | |
5b0f0ac9 MM |
259 | elfarchiveslist=`echo $filelist | xargs -r file | \ |
260 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
cd33aab7 | 261 | if [ -n "$elfexelist" ]; then \ |
aaa1486f | 262 | %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \ |
cd33aab7 AM |
263 | fi; \ |
264 | if [ -n "$elfsharedlist" ]; then \ | |
aaa1486f | 265 | %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ |
5b0f0ac9 MM |
266 | fi; \ |
267 | if [ -n "$elfarchiveslist" ]; then \ | |
aaa1486f | 268 | %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ |
f80cefa3 | 269 | fi; \ |
f67bd19e | 270 | fi; }; __spec_install_post_strip } } } |
31b569b6 | 271 | |
cc545e1a | 272 | #----------------------------------------------------------------- |
273 | # remove all RPATH from executable binaries and shared object files | |
274 | # | |
275 | # Requires: find, awk, cut, xargs, chrpath, uname | |
276 | # | |
277 | #%no_install_post_chrpath 1 | |
278 | %__spec_install_post_chrpath {%{!?debug: \ | |
f67bd19e | 279 | %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \ |
f80cefa3 | 280 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
cc545e1a | 281 | echo "Remove RPATH from executable binaries and shared object files."; \ |
d274a19d | 282 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ |
3d66db15 | 283 | awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ |
cc545e1a | 284 | while read file ; do \ |
285 | rpath= ; \ | |
286 | chmod u+w "$file"; \ | |
287 | for dir in `chrpath -l "$file" | \ | |
31b569b6 | 288 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ |
cc545e1a | 289 | case $dir in \ |
570a0c29 | 290 | /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \ |
cc545e1a | 291 | echo "remove-rpath: $dir in $file"; \ |
292 | ;; \ | |
293 | * ) \ | |
294 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
295 | else rpath="$rpath:$dir" ; fi ; \ | |
296 | ;; \ | |
297 | esac ; \ | |
298 | done ; \ | |
299 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
300 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
f80cefa3 | 301 | done; \ |
f67bd19e | 302 | fi; }; __spec_install_post_chrpath } } } |
31b569b6 | 303 | |
22a54b3e | 304 | #----------------------------------------------------------------- |
93b46c00 | 305 | # Find and gzip all kernel modules |
306 | # | |
307 | # Requires: find | |
308 | # | |
309 | #%no_install_post_compress_modules 1 | |
310 | %__spec_install_post_compress_modules { \ | |
f67bd19e | 311 | %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \ |
31b569b6 ER |
312 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
313 | echo "Compress kernel modules if any."; \ | |
314 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ | |
315 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \ | |
316 | xargs -r %{__gzip} -9nf; \ | |
317 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \ | |
318 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
319 | fi; \ | |
320 | fi; \ | |
f67bd19e | 321 | }; __spec_install_post_compress_modules } } |
cd33aab7 | 322 | |
e4d71427 ER |
323 | # Remove common Perl files we don't package |
324 | %__spec_install_post_perl_clean {\ | |
325 | %{!?no_install_post_perl_clean: \ | |
326 | %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \ | |
327 | } } | |
328 | ||
aad1c8e4 | 329 | #----------------------------------------------------------------- |
cc6c554c | 330 | # Update GConf2 schemas |
aad1c8e4 | 331 | # |
332 | # Requires: GConf2 | |
333 | # | |
5b8ed3c0 | 334 | %gconf_schema_install() \ |
31b569b6 ER |
335 | umask 022; \ |
336 | 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 \ | |
337 | %{nil} | |
5b8ed3c0 | 338 | |
339 | %gconf_schema_uninstall() \ | |
429d047e | 340 | if [ $1 = 0 ]; then \ |
31b569b6 ER |
341 | umask 022; \ |
342 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \ | |
429d047e | 343 | fi \ |
344 | %{nil} | |
345 | ||
346 | #----------------------------------------------------------------- | |
347 | # Update desktop MIME database | |
96999189 | 348 | # requires: desktop-file-utils |
429d047e | 349 | # |
9ba5542a | 350 | %update_desktop_database_post() {{ \ |
429d047e | 351 | umask 022; \ |
352 | /usr/bin/update-desktop-database; \ | |
17c49976 | 353 | }} |
429d047e | 354 | |
38267983 | 355 | %update_desktop_database_postun() {{ \ |
429d047e | 356 | if [ $1 = 0 ]; then \ |
357 | umask 022; \ | |
358 | /usr/bin/update-desktop-database; \ | |
359 | fi \ | |
17c49976 | 360 | }} |
429d047e | 361 | |
362 | #----------------------------------------------------------------- | |
363 | # Update scrollkeeper database | |
364 | # requires: scrollkeeper | |
365 | # | |
366 | %scrollkeeper_update_post() \ | |
429d047e | 367 | /usr/bin/scrollkeeper-update -q; \ |
368 | %{nil} | |
369 | ||
370 | %scrollkeeper_update_postun() \ | |
371 | if [ $1 = 0 ]; then \ | |
429d047e | 372 | /usr/bin/scrollkeeper-update -q; \ |
373 | fi \ | |
374 | %{nil} | |
375 | ||
376 | #----------------------------------------------------------------- | |
377 | # Run ldconfig after installing/deinstalling libraries | |
378 | # | |
379 | %ldconfig_post() \ | |
380 | /sbin/ldconfig; \ | |
381 | %{nil} | |
382 | ||
383 | %ldconfig_postun() \ | |
429d047e | 384 | /sbin/ldconfig; \ |
bbc02b2d | 385 | %{nil} |
aad1c8e4 | 386 | |
cd33aab7 AM |
387 | #----------------------------------------------------------------- |
388 | # post %install sequence: | |
389 | # - autodeps exceptions | |
390 | # - compress all man and info pages, | |
391 | # - strip all ELF executables and ELF shared objects if not %debug. | |
5b0f0ac9 | 392 | # - compress kernel modules if any |
cd33aab7 AM |
393 | |
394 | ################################################################### | |
395 | # Requires/Provides automation | |
396 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
a4852742 | 397 | # |
fbbdca08 JB |
398 | %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} |
399 | %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} | |
400 | %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}} | |
401 | %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} | |
402 | %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}} | |
a4852742 JB |
403 | #%_noautocompressdoc %{nil} |
404 | # | |
5b0f0ac9 MM |
405 | %_missing_doc_files_terminate_build 1%{nil} |
406 | %_unpackaged_files_terminate_build %{nil} | |
4c7d3ba4 | 407 | # (X)emacs support |
42b7e5ac | 408 | %___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;}' |
4c7d3ba4 AF |
409 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) |
410 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
41a62699 | 411 | |
984f6de6 JK |
412 | %__php_provides %{nil} |
413 | %__php_requires %{nil} | |
414 | %__perl_provides %{nil} | |
415 | %__perl_requires %{nil} | |
63b0a9d7 | 416 | %__mono_provides %{nil} |
417 | %__mono_requires %{nil} | |
41a62699 AF |
418 | |
419 | # Perl specific macro definitions. | |
23c8318b ER |
420 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) |
421 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
422 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
942c693c | 423 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) |
23c8318b ER |
424 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) |
425 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
41a62699 | 426 | |
cb84f517 | 427 | # Ruby |
75368847 ER |
428 | %ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR) |
429 | %ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR) | |
430 | %ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR) | |
431 | %ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR) | |
432 | %ruby_sitelibdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR) | |
433 | %ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR) | |
5483bb35 ER |
434 | %ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version |
435 | %ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version | |
cb84f517 | 436 | |
942c693c | 437 | %php_pear_dir %{_datadir}/pear |
41a62699 | 438 | |
6b2157a6 ER |
439 | # directory where php includes are installed on system. |
440 | %__php_includedir /usr/include/php | |
f73da51b | 441 | # extract php/zend api versions |
09fac83f | 442 | %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR) |
6b2157a6 | 443 | %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR) |
ab8d73ee | 444 | %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR) |
6b2157a6 ER |
445 | %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR) |
446 | %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR) | |
ea702d15 | 447 | %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR}) |
6b2157a6 ER |
448 | |
449 | # helper macro | |
e255dfdc | 450 | %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}} |
6b2157a6 ER |
451 | |
452 | # macros for public use | |
453 | # for php extensions (php-pecl) | |
ab8d73ee | 454 | %requires_php_extension %{__php_api_requires modules_api php_api_version} \ |
e255dfdc ER |
455 | %{__php_api_requires -v %php_major_version debug php_debug} \ |
456 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
ab8d73ee | 457 | |
6b2157a6 ER |
458 | # for zend extensions |
459 | %requires_zend_extension %{__php_api_requires zend_module_api} \ | |
ab8d73ee | 460 | %{__php_api_requires zend_extension_api} \ |
e255dfdc ER |
461 | %{__php_api_requires -v %php_major_version debug php_debug} \ |
462 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
6b2157a6 | 463 | |
41a62699 AF |
464 | # Python specific macro definitions. |
465 | # python main version | |
31b569b6 | 466 | %py_ver %(python -c "import sys; print sys.version[:3]") |
41a62699 AF |
467 | |
468 | # directories | |
31b569b6 ER |
469 | %py_prefix %(python -c "import sys; print sys.prefix") |
470 | %py_libdir %{py_prefix}/%{_lib}/python%{py_ver} | |
a4f0b5e0 | 471 | %py_scriptdir %{py_prefix}/share/python%{py_ver} |
31b569b6 | 472 | %py_incdir /usr/include/python%{py_ver} |
a4f0b5e0 JK |
473 | %py_sitedir %{py_libdir}/site-packages |
474 | %py_sitescriptdir %{py_scriptdir}/site-packages | |
31b569b6 | 475 | %py_dyndir %{py_libdir}/lib-dynload |
41a62699 AF |
476 | |
477 | # pure python modules compilation | |
31b569b6 | 478 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
41a62699 | 479 | |
31b569b6 | 480 | %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
41a62699 AF |
481 | |
482 | # Software written in Python language require Python with main version | |
5177c7b1 | 483 | %pyrequires_eq() Requires: %1 |
41a62699 | 484 | |
ea4b2900 AF |
485 | # Hardlink binary identical .pyc and .pyo files |
486 | # (idea by glen <at> pld-linux <dot> org) | |
487 | %__spec_install_post_py_hardlink {\ | |
f67bd19e | 488 | %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \ |
ea4b2900 AF |
489 | [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \ |
490 | b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \ | |
491 | if cmp -s "$a" "$b"; then \ | |
492 | ln -f "$a" "$b"; \ | |
493 | fi; \ | |
494 | done \ | |
f67bd19e | 495 | }; __spec_install_post_py_hardlink } } |
ea4b2900 | 496 | |
16f6f416 | 497 | # remove python sources, so that check-files won't complain |
ea4b2900 AF |
498 | # (idea by glen <at> pld-linux <dot> org) |
499 | %py_postclean() \ | |
e4e8948b | 500 | for d in %{py_sitescriptdir} %{py_sitedir} %*; do \ |
9ba5542a | 501 | [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\ |
ea4b2900 AF |
502 | done \ |
503 | %{nil} | |
504 | ||
67ed5b97 | 505 | # depmod macro |
506 | %depmod() { \ | |
fe30b3ea | 507 | umask 022; \ |
67ed5b97 | 508 | if [ -e /boot/System.map-%1 ]; then \ |
31b569b6 | 509 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ |
67ed5b97 | 510 | else \ |
31b569b6 ER |
511 | if [ -e /boot/System.map ]; then \ |
512 | /sbin/depmod -a -F /boot/System.map %1; \ | |
513 | else \ | |
514 | /sbin/depmod -a %1; \ | |
515 | fi \ | |
67ed5b97 | 516 | fi; \ |
517 | } | |
518 | ||
495892af | 519 | # XMMS specific macros |
31b569b6 ER |
520 | %xmms_prefix %(xmms-config --prefix 2>/dev/null) |
521 | %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null) | |
522 | %xmms_version %(xmms-config --version 2>/dev/null) | |
523 | %xmms_datadir %(xmms-config --data-dir 2>/dev/null) | |
524 | %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null) | |
525 | %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null) | |
526 | %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null) | |
527 | %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null) | |
528 | %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null) | |
529 | %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null) | |
495892af | 530 | |
bb128216 PS |
531 | %_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/') |
532 | ||
e3618ee9 | 533 | # user/group checking macros |
534 | # | |
535 | # Usage: | |
536 | # %userremove myuser | |
537 | # | |
538 | %userremove /usr/lib/rpm/user_group.sh user del | |
539 | %groupremove /usr/lib/rpm/user_group.sh group del | |
540 | # | |
541 | # Usage: | |
542 | # if %usertestrm myuser; then | |
543 | # /usr/sbin/userdel -r myuser | |
544 | # Note: | |
545 | # use these macros only if you need to call userdel/groupdel with | |
546 | # a non-standard option or take an extra action; otherwise use the | |
547 | # %userremove/%groupremove macros | |
548 | # | |
549 | %usertestrm /usr/lib/rpm/user_group.sh user testrm | |
550 | %grouptestrm /usr/lib/rpm/user_group.sh group testrm | |
13f70a2c JK |
551 | # user group membership management macros |
552 | # | |
553 | # Usage: | |
554 | # %addusertogroup myuser agroup | |
555 | # | |
556 | %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup | |
bfd9689c | 557 | |
558 | # banner support (useful in {pre,post}{,un} and triggers) | |
559 | # | |
560 | # Usage: | |
a980efc1 | 561 | # %banner name [-a] [-e] [-n] [-tn] <<EOF |
bfd9689c | 562 | # the banner text, the banner text |
a980efc1 ER |
563 | # the banner text, and following line |
564 | #EOF | |
565 | # You can use any form of here-document, <<'EOF' <<-EOT will do. | |
566 | # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. | |
567 | # | |
bfd9689c | 568 | # -a - append to the banner |
fb033326 | 569 | # -e - send to stderr instead of stdout |
1257c400 | 570 | # -n - no show banner (overrides -t) |
571 | # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 | |
a980efc1 | 572 | %banner(aent:) \ |
f1bbc6ff | 573 | RPM_SCRIPTVERBOSITY=5 \ |
574 | [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ | |
575 | if [ -x /usr/bin/banner.sh ]; then \ | |
a980efc1 | 576 | CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \ |
f1bbc6ff | 577 | else \ |
fb033326 | 578 | CMD="cat%{-e: >&2}" \ |
f1bbc6ff | 579 | fi \ |
f9cf2bf7 | 580 | eval $CMD %2%{?3: %3} \ |
bfd9689c | 581 | %nil |
1257c400 | 582 | |
29c5556c ER |
583 | # useradd/groupadd macros written by glen@pld-linux.org. |
584 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
585 | # | |
586 | # Usage: | |
587 | # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment] | |
588 | # [-g initial_group] [-G group[,...]] login | |
589 | # | |
590 | # -u uid. REQUIRED | |
591 | # -g gid/group. REQUIRED | |
592 | # -s defaults to /bin/false | |
593 | # -d defaults to /usr/share/empty | |
594 | # -c No default | |
595 | # -r is accepted but ignored (it's always set) | |
6eb25d5d | 596 | # -k skeleton dir. defaults to /usr/share/empty |
29c5556c ER |
597 | # rpm specific flags |
598 | # -P package name. defaults to %{name} | |
599 | # | |
29c5556c | 600 | %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \ |
0044d46f ER |
601 | %{!-u:%{error:useradd: Required argument -u missing}} \ |
602 | %{!-g:%{error:useradd: Required argument -g missing}} \ | |
603 | %{!?1:%{error:useradd: Required parameter login missing}} \ | |
29c5556c ER |
604 | if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \ |
605 | if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \ | |
606 | echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
607 | exit 1 \ | |
608 | fi \ | |
609 | else \ | |
610 | echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \ | |
611 | /usr/sbin/useradd \\\ | |
cc333c8b | 612 | %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\ |
29c5556c ER |
613 | -u %{-u*} \\\ |
614 | -r \\\ | |
615 | -d %{-d*}%{!-d:/usr/share/empty} \\\ | |
616 | -s %{-s*}%{!-s:/bin/false} \\\ | |
85e3e9a1 | 617 | %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\ |
29c5556c ER |
618 | -g %{-g*} \\\ |
619 | %{-M} \\\ | |
620 | %{-G:-G %{-G*}} \\\ | |
6750d9f5 ER |
621 | %{expand:%{%{#}}} 1>&2 || exit $? \ |
622 | [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd \ | |
29c5556c ER |
623 | fi; |
624 | ||
29c5556c ER |
625 | # Usage: |
626 | # %groupadd [-P package] [-g gid] group | |
627 | # | |
628 | # -g gid. REQUIRED | |
629 | # | |
630 | # Sample: | |
631 | # %groupadd -P %{name}-base -g %{gid} %{name} | |
632 | ||
633 | %groupadd(g:P:rfo) \ | |
0044d46f ER |
634 | %{!-g:%{error:groupadd: Required argument -g missing}} \ |
635 | %{!?1:%{error:groupadd: Required parameter group missing}} \ | |
29c5556c ER |
636 | if [ -n "`/usr/bin/getgid %{1}`" ]; then \ |
637 | if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \ | |
638 | echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
639 | exit 1 \ | |
640 | fi \ | |
641 | else \ | |
642 | echo "Adding group %{1} GID=%{-g*}." \ | |
6750d9f5 ER |
643 | /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \ |
644 | [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group \ | |
29c5556c | 645 | fi; |
053b8de1 ER |
646 | |
647 | # apache_config_{install/uninstall} macros written by glen@pld-linux.org. | |
648 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
649 | # | |
dd4e969a ER |
650 | # You should use webapp macros instead. these are here until single piece of them is gone from specs ;) |
651 | # | |
053b8de1 ER |
652 | # The config is installed/removed inside trigger, this means that you can any |
653 | # time install apache1 or apache package and the configuration file is updated. | |
654 | # if you don't need the config for various reason for specific apache, just | |
655 | # remove the symlink from apache config directory. the trigger will not put the | |
656 | # config again to that version of apache. In other words the config is linked | |
657 | # to apache config directory on first install of PACKAGE or apache. | |
658 | # | |
659 | # should be called in trigger body: | |
660 | # %triggerin -- apache1 >= 1.3.33-2 | |
661 | # %apache_config_install -v 1 | |
662 | # | |
663 | # Add package's apache config to apache config. | |
664 | # | |
665 | # Usage: | |
666 | # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99 | |
667 | # | |
668 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
669 | # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf. | |
670 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
22d9c327 | 671 | # -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers |
053b8de1 ER |
672 | # |
673 | # Internal macros. don't use ;). | |
674 | # expands apache config dir by apache version at build time. | |
675 | %__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) | |
676 | # expands apache service name by apache version at build time. | |
677 | %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi) | |
678 | ||
22d9c327 | 679 | %apache_config_install(fv:c:n:) \ |
053b8de1 ER |
680 | %{!-v:%{error:apache_config_install: Required argument -v missing}} \ |
681 | %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ | |
22d9c327 | 682 | if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\ |
053b8de1 ER |
683 | ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\ |
684 | fi\ | |
7e4c6837 | 685 | # reload apache if the config symlink is there\ |
1d90410b | 686 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\ |
71d37358 ER |
687 | # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \ |
688 | if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\ | |
7e4c6837 | 689 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\ |
053b8de1 ER |
690 | fi\ |
691 | fi\ | |
692 | %{nil} | |
693 | ||
694 | # Remove package's apache config from apache config. | |
695 | # | |
696 | # Usage: | |
697 | # %apache_config_uninstall -v {1|2} -n 99 | |
698 | # | |
699 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
700 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
701 | %apache_config_uninstall(v:n:) \ | |
702 | %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \ | |
703 | %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \ | |
9e0d77bc | 704 | # remove link if either of the packages are gone \ |
053b8de1 ER |
705 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ |
706 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \ | |
707 | rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \ | |
708 | if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \ | |
7e4c6837 | 709 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \ |
053b8de1 ER |
710 | fi \ |
711 | fi \ | |
712 | fi \ | |
713 | %{nil} | |
714 | ||
55a50f1a | 715 | # webapp macros |
ba42a822 ER |
716 | # |
717 | # The config is installed/removed inside trigger, this means that you can any | |
718 | # time install apache1/apache/lighttpd package and the configuration file is | |
719 | # updated. if you don't need the config for various reason for specific | |
720 | # webserver, just remove the symlink from config directory using webapp | |
721 | # program. the trigger will not recreate the symlink on upgrades. In other | |
722 | # words the config is linked to webserver config directory on first install of | |
723 | # PACKAGE or WEBSERVER. | |
724 | # | |
55a50f1a ER |
725 | # Add package's webserver config to webserver webapps dir. |
726 | # Usage: | |
217f2cb2 | 727 | # %webapp_register WEBSERVER WEBAPP |
ba42a822 ER |
728 | # |
729 | %webapp_register() \ | |
730 | %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ | |
731 | if [ "$1" = "1" ] && [ "$2" = "1" ]; then\ | |
732 | /usr/sbin/webapp register %1 %2\ | |
733 | fi\ | |
973c1dc7 | 734 | # reload webserver if the config symlink is there and skip reload if webserver is upgraded\ |
57ff17b4 | 735 | if [ -L /etc/%1/webapps.d/%2.conf ] && [ "$2" -lt "2" ]; then\ |
5f0b2e29 | 736 | %{expand:%service -q %%1 reload}\ |
ba42a822 ER |
737 | fi\ |
738 | %{nil} | |
739 | ||
740 | # Remove package's config from webserver webapps dir. | |
ba42a822 | 741 | # Usage: |
b9588fe6 ER |
742 | # %webapp_register [-f] WEBSERVER WEBAPP |
743 | %webapp_unregister(f) \ | |
ba42a822 ER |
744 | %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \ |
745 | # remove link if either of the packages are gone \ | |
b9588fe6 | 746 | if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%2.conf ]; then \ |
217f2cb2 | 747 | /usr/sbin/webapp unregister %1 %2\ |
5f0b2e29 | 748 | %{expand:%service -q %%1 reload}\ |
ba42a822 ER |
749 | fi \ |
750 | %{nil} | |
751 | ||
745c4676 ER |
752 | # see browser-plugins.spec / template-browser-plugin.spec |
753 | # written by glen@pld-linux.org. | |
f6565dd0 | 754 | %nsplugin_install(d:f) { \ |
745c4676 | 755 | # create link if it's first install of either of the packages \ |
f6565dd0 | 756 | if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \ |
745c4676 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 | ||
3e680cb6 | 766 | %nsplugin_uninstall(d:) { \ |
745c4676 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 | } | |
8edf8498 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: | |
524e081b | 788 | # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"] |
8edf8498 | 789 | # |
dd4e969a | 790 | # -q be silent when service isn't started (for scriplets restaring other package's services) |
8edf8498 | 791 | # |
e42cbd35 | 792 | %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };} |