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