]>
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 | ||
26 | # kernel compiler | |
27 | %kgcc gcc | |
28 | %kgcc_package gcc | |
29 | ||
30 | # Build system path macros. | |
31 | # | |
32 | %__libtoolize libtoolize --copy --force | |
33 | %__gettextize { \ | |
34 | if ! gettextize --version | grep -q '0\.10\.' ; then \ | |
35 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ | |
36 | gettextize --copy --force --no-changelog; \ | |
37 | else \ | |
38 | gettextize --copy --force --no-changelog --intl; \ | |
39 | fi; \ | |
40 | if [ ! -f po/Makevars ]; then \ | |
41 | cp -f po/Makevars{.template,}; \ | |
42 | fi; \ | |
43 | else \ | |
44 | gettextize --copy --force; \ | |
45 | fi; \ | |
46 | } | |
47 | %__autopoint autopoint --force | |
48 | %__automake automake -a -c -f --foreign | |
49 | %__autoconf autoconf %{?debug:-Wall} | |
50 | ||
51 | %dependencytracking %{nil} | |
52 | #----------------------------------------------------------------- | |
53 | %configure2_13 { \ | |
54 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ | |
55 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
56 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
57 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ | |
58 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ | |
59 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ | |
60 | %{?__cc:CC="%{__cc}" ; export CC ; } \ | |
61 | %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ | |
62 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ | |
63 | --host=%{_target_platform} \ | |
64 | --prefix=%{_prefix} \ | |
65 | --exec-prefix=%{_exec_prefix} \ | |
66 | --bindir=%{_bindir} \ | |
67 | --sbindir=%{_sbindir} \ | |
68 | --sysconfdir=%{_sysconfdir} \ | |
69 | --datadir=%{_datadir} \ | |
70 | --includedir=%{_includedir} \ | |
71 | --libdir=%{_libdir} \ | |
72 | --libexecdir=%{_libexecdir} \ | |
73 | --localstatedir=%{_localstatedir} \ | |
74 | --sharedstatedir=%{_sharedstatedir} \ | |
75 | --mandir=%{_mandir} \ | |
76 | --infodir=%{_infodir} \ | |
77 | --x-libraries=/usr/X11R6/%{_lib} \ | |
78 | %{dependencytracking} \ | |
79 | } | |
80 | ||
81 | #---------------------------------------------------------------- | |
82 | %configure {./configure \ | |
83 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ | |
84 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
85 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ | |
86 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
87 | CPPFLAGS="${CPPFLAGS:-}" \ | |
88 | %{?__cc:CC="%{__cc}"} \ | |
89 | %{?__cxx:CXX="%{__cxx}"} \ | |
90 | --build=%{_target_platform} \ | |
91 | --prefix=%{_prefix} \ | |
92 | --exec-prefix=%{_exec_prefix} \ | |
93 | --bindir=%{_bindir} \ | |
94 | --sbindir=%{_sbindir} \ | |
95 | --sysconfdir=%{_sysconfdir} \ | |
96 | --datadir=%{_datadir} \ | |
97 | --includedir=%{_includedir} \ | |
98 | --libdir=%{_libdir} \ | |
99 | --libexecdir=%{_libexecdir} \ | |
100 | --localstatedir=%{_localstatedir} \ | |
101 | --sharedstatedir=%{_sharedstatedir} \ | |
102 | --mandir=%{_mandir} \ | |
103 | --infodir=%{_infodir} \ | |
104 | --x-libraries=/usr/X11R6/%{_lib} \ | |
105 | %{dependencytracking} \ | |
106 | } | |
107 | ||
108 | # ------------------------------------------------------------------------ | |
109 | # Overloading of some basic macros | |
110 | %prep \ | |
111 | %%prep\ | |
112 | LANG=C\ | |
113 | export LANG\ | |
114 | unset DISPLAY ||:\ | |
115 | unset LINGUAS ||:\ | |
116 | %{nil} | |
117 | ||
118 | %build %%build\ | |
119 | LANG=C\ | |
120 | export LANG\ | |
121 | unset DISPLAY ||:\ | |
122 | unset LINGUAS ||:\ | |
123 | %{nil} | |
124 | ||
125 | %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\ | |
126 | %%install\ | |
127 | LANG=C\ | |
128 | export LANG\ | |
129 | unset DISPLAY ||:\ | |
130 | unset LINGUAS ||:\ | |
131 | %{nil} | |
132 | ||
133 | # ------------------------------------------------------------------------ | |
134 | # Conditional build stuff. | |
135 | ||
136 | # Check if symbol is defined. | |
137 | # Example usage: %if %{defined with_foo} && %{undefined with_bar} ... | |
138 | %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}} | |
139 | %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}} | |
140 | ||
141 | # Shorthand for %{defined with_...} | |
142 | %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}} | |
143 | %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} | |
144 | ||
145 | # Handle conditional builds. %bcond_with is for case when feature is | |
146 | # default off and needs to be activated with --with ... command line | |
147 | # switch. %bcond_without is for the dual case. | |
148 | # | |
149 | # %bcond_with foo defines symbol with_foo if --with foo was specified on | |
150 | # command line. | |
151 | # %bcond_without foo defines symbol with_foo if --without foo was *not* | |
152 | # specified on command line. | |
153 | # | |
154 | # For example: | |
155 | # | |
156 | # %bcond_with extra_fonts | |
157 | # %bcond_without static | |
158 | # %if %{with extra_fonts} | |
159 | # ... | |
160 | # %endif | |
161 | # %ifdef %{with static} | |
162 | # ... | |
163 | # %endif | |
164 | # %{?with_static: ... } | |
165 | # %{!?with_static: ... } | |
166 | # %{?with_extra_fonts: ... } | |
167 | # %{!?with_extra_fonts: ... } | |
168 | # | |
169 | # The bottom line: never use without_foo, _with_foo nor _without_foo, only | |
170 | # with_foo. This way changing default set of bconds for given spec is just | |
171 | # a matter of changing single line in it and syntax is more readable. | |
172 | %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} | |
173 | %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} | |
174 | # ------------------------------------------------------------------------ | |
175 | ||
176 | # Location of autoconf macros | |
177 | %_aclocaldir %(aclocal --print-ac-dir) | |
178 | ||
179 | # Location of omf files | |
180 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
181 | ||
182 | # Location of pkgconfig files | |
183 | %_pkgconfigdir /usr/%{_lib}/pkgconfig | |
184 | ||
185 | # Location of desktop files | |
186 | %_desktopdir /usr/share/applications | |
187 | %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead | |
188 | ||
189 | # Location of pixmaps for applnk/desktop files | |
190 | %_pixmapsdir /usr/share/pixmaps | |
191 | ||
192 | # Location of themable icons for applnk/desktop files | |
193 | %_iconsdir /usr/share/icons | |
194 | ||
195 | # Location of fonts directories | |
196 | %_fontsdir /usr/share/fonts | |
197 | ||
198 | # Location of Gtk and associated libraries documentation | |
199 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html | |
200 | ||
201 | # Location of KDE documentation | |
202 | %_kdedocdir %{_defaultdocdir}/kde/HTML | |
203 | ||
204 | # unsermake script | |
205 | %__unsermake /usr/share/unsermake/unsermake | |
206 | ||
207 | # Current date | |
208 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
209 | ||
210 | # tmp directory | |
211 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
212 | ||
213 | # Example files, programs, scripts... | |
214 | %_examplesdir /usr/src/examples | |
215 | ||
216 | # The directory holding Linux kernel sources | |
217 | %_kernelsrcdir /usr/src/linux | |
218 | ||
219 | # If non-empty "debug" macro defined, add "dbg" suffix to release number | |
220 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm | |
221 | ||
222 | # Requires name = version-release | |
223 | %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") | |
224 | ||
225 | %releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)") | |
226 | %releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)") | |
227 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'PreReq: kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)") | |
228 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'PreReq: kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)") | |
229 | ||
230 | %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not") | |
231 | ||
232 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR) | |
233 | ||
234 | # kernel version-release handling | |
235 | %__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)) | |
236 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not") | |
237 | %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}-%{RELEASE}" | grep -v "is not") | |
238 | %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})} | |
239 | %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g') | |
240 | ||
241 | # sgml macros | |
242 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ; | |
243 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ; | |
244 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
245 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ; | |
246 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ; | |
247 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ; | |
248 | %docbook_sgmlcat_fix() { for l in \ | |
249 | '' \ | |
250 | ' -- default decl --' \ | |
251 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
252 | ' -- hacks for opensp --' \ | |
253 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
254 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
255 | '' \ | |
256 | ; do echo $l; done >> %1 \ | |
257 | } | |
258 | ||
259 | #----------------------------------------------------------------- | |
260 | # find and gzip all files in %{_mandir} and %{infodir} | |
261 | # | |
262 | # Requires: xargs, find | |
263 | # | |
264 | #%no_install_post_compress_docs 1 | |
265 | %__spec_install_post_compress_docs { \ | |
266 | %{!?no_install_post_compress_docs: \ | |
267 | echo "Compress man and info pages."; \ | |
268 | %{?verbose:set -x;} \ | |
269 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
270 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
271 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
272 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
273 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
274 | fi; \ | |
275 | done; \ | |
276 | } } | |
277 | ||
278 | #----------------------------------------------------------------- | |
279 | # Strip executable binaries and shared object files | |
280 | # | |
281 | # Requires: find, awk, strip, cut, xargs | |
282 | # | |
283 | #%no_install_post_strip 1 | |
284 | %__spec_install_post_strip {%{!?debug: \ | |
285 | %{!?no_install_post_strip: \ | |
286 | %{?verbose:set -x;} \ | |
287 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
288 | echo "Strip executable binaries, archives and shared object files."; \ | |
289 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \ | |
290 | elfexelist=`echo $filelist | xargs -r file | \ | |
291 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
292 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
293 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
294 | elfarchiveslist=`echo $filelist | xargs -r file | \ | |
295 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
296 | if [ -n "$elfexelist" ]; then \ | |
297 | %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \ | |
298 | fi; \ | |
299 | if [ -n "$elfsharedlist" ]; then \ | |
300 | %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ | |
301 | fi; \ | |
302 | if [ -n "$elfarchiveslist" ]; then \ | |
303 | %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ | |
304 | fi; \ | |
305 | fi; } \ | |
306 | } } | |
307 | #----------------------------------------------------------------- | |
308 | # remove all RPATH from executable binaries and shared object files | |
309 | # | |
310 | # Requires: find, awk, cut, xargs, chrpath, uname | |
311 | # | |
312 | #%no_install_post_chrpath 1 | |
313 | %__spec_install_post_chrpath {%{!?debug: \ | |
314 | %{!?no_install_post_chrpath: \ | |
315 | %{?verbose:set -x;} \ | |
316 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
317 | echo "Remove RPATH from executable binaries and shared object files."; \ | |
318 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ | |
319 | awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ | |
320 | while read file ; do \ | |
321 | rpath= ; \ | |
322 | chmod u+w "$file"; \ | |
323 | for dir in `chrpath -l "$file" | \ | |
324 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ | |
325 | case $dir in \ | |
326 | /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \ | |
327 | echo "remove-rpath: $dir in $file"; \ | |
328 | ;; \ | |
329 | * ) \ | |
330 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
331 | else rpath="$rpath:$dir" ; fi ; \ | |
332 | ;; \ | |
333 | esac ; \ | |
334 | done ; \ | |
335 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
336 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
337 | done; \ | |
338 | fi; } \ | |
339 | } } | |
340 | #----------------------------------------------------------------- | |
341 | # Find and gzip all kernel modules | |
342 | # | |
343 | # Requires: find | |
344 | # | |
345 | #%no_install_post_compress_modules 1 | |
346 | %__spec_install_post_compress_modules { \ | |
347 | %{!?no_install_post_compress_modules: \ | |
348 | %{?verbose:set -x;} \ | |
349 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
350 | echo "Compress kernel modules if any."; \ | |
351 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ | |
352 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \ | |
353 | xargs -r %{__gzip} -9nf; \ | |
354 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \ | |
355 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
356 | fi; \ | |
357 | fi; \ | |
358 | } } | |
359 | ||
360 | %_source_payload w9.gzdio | |
361 | %_binary_payload w9.bzdio | |
362 | ||
363 | #----------------------------------------------------------------- | |
364 | # Update GConf2 schemas | |
365 | # | |
366 | # Requires: GConf2 | |
367 | # | |
368 | %gconf_schema_install() \ | |
369 | umask 022; \ | |
370 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule %{?1}%{!?1:/etc/gconf/schemas/*.schemas} > /dev/null \ | |
371 | %{nil} | |
372 | ||
373 | %gconf_schema_uninstall() \ | |
374 | umask 022; \ | |
375 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule %{?1} > /dev/null \ | |
376 | %{nil} | |
377 | ||
378 | #----------------------------------------------------------------- | |
379 | # post %install sequence: | |
380 | # - autodeps exceptions | |
381 | # - compress all man and info pages, | |
382 | # - strip all ELF executables and ELF shared objects if not %debug. | |
383 | # - compress kernel modules if any | |
384 | ||
385 | ################################################################### | |
386 | # Requires/Provides automation | |
387 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
388 | # | |
389 | %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} | |
390 | %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} | |
391 | %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}} | |
392 | %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} | |
393 | %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}} | |
394 | #%_noautocompressdoc %{nil} | |
395 | # | |
396 | %_missing_doc_files_terminate_build 1%{nil} | |
397 | %_unpackaged_files_terminate_build %{nil} | |
398 | # (X)emacs support | |
399 | %___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;}' | |
400 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) | |
401 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
402 | ||
403 | %__php_provides %{nil} | |
404 | %__php_requires %{nil} | |
405 | %__perl_provides %{nil} | |
406 | %__perl_requires %{nil} | |
407 | ||
408 | # Perl specific macro definitions. | |
409 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) | |
410 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
411 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
412 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) | |
413 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) | |
414 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
415 | ||
416 | %php_pear_dir %{_datadir}/pear | |
417 | ||
418 | # Python specific macro definitions. | |
419 | # python main version | |
420 | %py_ver %(echo `python -c "import sys; print sys.version[:3]"`) | |
421 | ||
422 | # directories | |
423 | %py_prefix %(echo `python -c "import sys; print sys.prefix"`) | |
424 | %py_libdir %{py_prefix}/%{_lib}/python%{py_ver} | |
425 | %py_scriptdir %{py_prefix}/share/python%{py_ver} | |
426 | %py_incdir /usr/include/python%{py_ver} | |
427 | %py_sitedir %{py_libdir}/site-packages | |
428 | %py_sitescriptdir %{py_scriptdir}/site-packages | |
429 | %py_dyndir %{py_libdir}/lib-dynload | |
430 | ||
431 | # pure python modules compilation | |
432 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" | |
433 | ||
434 | %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" | |
435 | ||
436 | # Software written in Python language require Python with main version | |
437 | %pyrequires_eq() Requires: %1 | |
438 | ||
439 | ||
440 | # Hardlink binary identical .pyc and .pyo files | |
441 | # (idea by glen <at> pld-linux <dot> org) | |
442 | %__spec_install_post_py_hardlink {\ | |
443 | %{!?no_install_post_py_hardlink: \ | |
444 | [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \ | |
445 | b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \ | |
446 | if cmp -s "$a" "$b"; then \ | |
447 | ln -f "$a" "$b"; \ | |
448 | fi; \ | |
449 | done \ | |
450 | } } | |
451 | ||
452 | # remove python sources, so that check-files won't complain | |
453 | # (idea by glen <at> pld-linux <dot> org) | |
454 | %py_postclean() \ | |
455 | for d in %{py_sitescriptdir} %{py_sitedir}; do \ | |
456 | [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -exec rm {} \; ;\ | |
457 | done \ | |
458 | %{nil} | |
459 | ||
460 | # depmod macro | |
461 | %depmod() { \ | |
462 | umask 022; \ | |
463 | if [ -e /boot/System.map-%1 ]; then \ | |
464 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ | |
465 | else \ | |
466 | if [ -e /boot/System.map ]; then \ | |
467 | /sbin/depmod -a -F /boot/System.map %1; \ | |
468 | else \ | |
469 | /sbin/depmod -a %1; \ | |
470 | fi \ | |
471 | fi; \ | |
472 | } | |
473 | ||
474 | # XMMS specific macros | |
475 | %xmms_prefix %(xmms-config --prefix) | |
476 | %xmms_exec_prefix %(xmms-config --exec-prefix) | |
477 | %xmms_version %(xmms-config --version) | |
478 | %xmms_datadir %(xmms-config --data-dir) | |
479 | %xmms_plugindir %(xmms-config --plugin-dir) | |
480 | %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir) | |
481 | %xmms_input_plugindir %(xmms-config --input-plugin-dir) | |
482 | %xmms_output_plugindir %(xmms-config --output-plugin-dir) | |
483 | %xmms_effect_plugindir %(xmms-config --effect-plugin-dir) | |
484 | %xmms_general_plugindir %(xmms-config --general-plugin-dir) | |
485 | ||
486 | %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/') | |
487 | ||
488 | # user/group checking macros | |
489 | # | |
490 | # Usage: | |
491 | # %userremove myuser | |
492 | # | |
493 | %userremove /usr/lib/rpm/user_group.sh user del | |
494 | %groupremove /usr/lib/rpm/user_group.sh group del | |
495 | # | |
496 | # Usage: | |
497 | # if %usertestrm myuser; then | |
498 | # /usr/sbin/userdel -r myuser | |
499 | # Note: | |
500 | # use these macros only if you need to call userdel/groupdel with | |
501 | # a non-standard option or take an extra action; otherwise use the | |
502 | # %userremove/%groupremove macros | |
503 | # | |
504 | %usertestrm /usr/lib/rpm/user_group.sh user testrm | |
505 | %grouptestrm /usr/lib/rpm/user_group.sh group testrm | |
506 | # user group membership management macros | |
507 | # | |
508 | # Usage: | |
509 | # %addusertogroup myuser agroup | |
510 | # | |
511 | %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup | |
512 | ||
513 | # banner support (useful in {pre,post}{,un} and triggers) | |
514 | # | |
515 | # Usage: | |
516 | # %banner name [-a] [-e] [-n] [-tn] <<EOF | |
517 | # the banner text, the banner text | |
518 | # the banner text, and following line | |
519 | #EOF | |
520 | # You can use any form of here-document, <<'EOF' <<-EOT will do. | |
521 | # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. | |
522 | # | |
523 | # -a - append to the banner | |
524 | # -e - send to stderr instead of stdout | |
525 | # -n - no show banner (overrides -t) | |
526 | # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 | |
527 | %banner(aent:) \ | |
528 | RPM_SCRIPTVERBOSITY=5 \ | |
529 | [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ | |
530 | if [ -x /usr/bin/banner.sh ]; then \ | |
531 | CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \ | |
532 | else \ | |
533 | CMD="cat%{-e: >&2}" \ | |
534 | fi \ | |
535 | $CMD %2%{?3: %3} \ | |
536 | %nil | |
537 |