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