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