5 %x8664 x86_64 amd64 ia32e
11 # Build system path macros.
13 %__autoconf autoconf %{?debug:-Wall}
14 %__automake automake -a -c -f --foreign
15 %__autopoint autopoint --force
18 if ! gettextize --version | grep -q '0\.10\.' ; then \
19 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
20 gettextize --copy --force --no-changelog; \
22 gettextize --copy --force --no-changelog --intl; \
24 if [ ! -f po/Makevars ]; then \
25 cp -f po/Makevars{.template,}; \
28 gettextize --copy --force; \
32 %__glib_gettextize glib-gettextize --copy --force
33 %__gnome_doc_common gnome-doc-common --copy
34 %__gtkdocize gtkdocize --copy
35 %__intltoolize intltoolize --copy --force
36 %__libtoolize libtoolize --copy --force
38 # The number of cvs changelog entries kept when building package.
39 %_buildchangelogtruncate 20
41 %dependencytracking %{nil}
43 # Relations between package names that cause dependency loops
44 # with legacy packages that cannot be fixed. Relations are
47 # where package p has a Requires: on something that package q Provides:
49 # XXX Note: that there cannot be any whitespace within the string "p>q",
50 # and that both p and q are package names (i.e. no version/release).
51 %_dependency_whiteout %{nil}
53 #-----------------------------------------------------------------
55 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
56 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
57 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
58 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
59 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
60 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
61 %{?__cc:CC="%{__cc}" ; export CC ; } \
62 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
63 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
64 --host=%{_target_platform} \
66 --exec-prefix=%{_exec_prefix} \
68 --sbindir=%{_sbindir} \
69 --sysconfdir=%{_sysconfdir} \
70 --datadir=%{_datadir} \
71 --includedir=%{_includedir} \
73 --libexecdir=%{_libexecdir} \
74 --localstatedir=%{_localstatedir} \
75 --sharedstatedir=%{_sharedstatedir} \
77 --infodir=%{_infodir} \
78 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
79 %{dependencytracking} \
85 CFLAGS="%{rpmcflags}" \
86 CXXFLAGS="%{rpmcxxflags}" \
90 #----------------------------------------------------------------
91 %global configure_cache 0
92 %configure_cache_file %{buildroot}.configure.cache
94 %configure {./configure \
95 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
96 CFLAGS="${CFLAGS:-%rpmcflags}" \
97 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
98 FFLAGS="${FFLAGS:-%rpmcflags}" \
99 CPPFLAGS="${CPPFLAGS:-}" \
100 %{?__cc:CC="%{__cc}"} \
101 %{?__cxx:CXX="%{__cxx}"} \
102 --host=%{_target_platform} \
103 --build=%{_target_platform} \
104 --prefix=%{_prefix} \
105 --exec-prefix=%{_exec_prefix} \
106 --bindir=%{_bindir} \
107 --sbindir=%{_sbindir} \
108 --sysconfdir=%{_sysconfdir} \
109 --datadir=%{_datadir} \
110 --includedir=%{_includedir} \
111 --libdir=%{_libdir} \
112 --libexecdir=%{_libexecdir} \
113 --localstatedir=%{_localstatedir} \
114 --sharedstatedir=%{_sharedstatedir} \
115 --mandir=%{_mandir} \
116 --infodir=%{_infodir} \
117 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
118 %{dependencytracking} \
119 %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \
122 # ------------------------------------------------------------------------
123 # Overloading of some basic macros
140 %if 0%{?_enable_debug_packages}\
141 %{?buildsubdir:%{debug_package}}\
150 # Location of autoconf macros
151 %_aclocaldir %(aclocal --print-ac-dir)
153 # Location of omf files
154 %_omf_dest_dir %(scrollkeeper-config --omfdir)
156 # Location of pkgconfig files
157 %_pkgconfigdir /usr/%{_lib}/pkgconfig
159 # Location of desktop files
160 %_desktopdir /usr/share/applications
161 %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
163 # Location of pixmaps for applnk/desktop files
164 %_pixmapsdir /usr/share/pixmaps
166 # Location of themable icons for applnk/desktop files
167 %_iconsdir /usr/share/icons
169 # Location of fonts directories
170 %_fontsdir /usr/share/fonts
172 # Location of Gtk and associated libraries documentation
173 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
175 # Location of KDE documentation
176 %_kdedocdir %{_defaultdocdir}/kde/HTML
179 %__unsermake /usr/share/unsermake/unsermake
182 %date %(LC_ALL="C" date +"%a %b %d %Y")
185 %tmpdir %(echo "${TMPDIR:-/tmp}")
187 # Example files, programs, scripts...
188 %_examplesdir /usr/src/examples
190 # Alternative kernel type/version
191 %alt_kernel %{nil}%{?_alt_kernel:-%{?_alt_kernel}}
193 # The directory holding Linux kernel sources
194 %_kernelsrcdir /usr/src/linux%{alt_kernel}
196 # If non-empty "debug" macro defined, add "dbg" suffix to release number
197 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
199 # Requires name = version-release
200 %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")
202 %releq_kernel_up() %((LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
203 %releq_kernel_smp() %((LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
204 %requires_releq_kernel_up(s:) Requires%{-s:(%{-s*})}: %releq_kernel_up
205 %requires_releq_kernel_smp(s:) Requires%{-s:(%{-s*})}: %releq_kernel_smp
207 %requires_eq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
208 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
210 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
212 # kernel version-release handling
213 %__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))
214 %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not")
215 %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not")
216 %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
217 %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
220 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
221 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
222 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
223 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
224 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
225 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
226 %docbook_sgmlcat_fix() { for l in \
228 ' -- default decl --' \
229 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
230 ' -- hacks for opensp --' \
231 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
232 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
234 ; do echo $l; done >> %1 \
237 #-----------------------------------------------------------------
238 # find and gzip all files in %{_mandir} and %{infodir}
240 # Requires: xargs, find
242 #%no_install_post_compress_docs 1
243 %__spec_install_post_compress_docs { \
244 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
245 echo "Compress man and info pages."; \
246 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
247 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
248 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
249 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
250 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
253 }; __spec_install_post_compress_docs } }
255 #-----------------------------------------------------------------
256 # Strip executable binaries and shared object files
258 # Requires: find, awk, strip, cut, xargs
260 #%no_install_post_strip 1
261 %__spec_install_post_strip {%{!?debug: \
262 %{!?no_install_post_strip:__spec_install_post_strip() { \
263 if [ -d "$RPM_BUILD_ROOT" ]; then \
264 echo "Strip executable binaries, archives and shared object files."; \
265 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
266 elfexelist=`echo $filelist | xargs -r file | \
267 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
268 elfsharedlist=`echo $filelist | xargs -r file | \
269 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
270 elfarchiveslist=`echo $filelist | xargs -r file | \
271 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
272 if [ -n "$elfexelist" ]; then \
273 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
275 if [ -n "$elfsharedlist" ]; then \
276 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
278 if [ -n "$elfarchiveslist" ]; then \
279 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
281 fi; }; __spec_install_post_strip } } }
283 #-----------------------------------------------------------------
284 # remove all RPATH from executable binaries and shared object files
286 # Requires: find, awk, cut, xargs, chrpath, uname
288 #%no_install_post_chrpath 1
289 %__spec_install_post_chrpath {%{!?debug: \
290 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
291 if [ -d "$RPM_BUILD_ROOT" ]; then \
292 echo "Remove RPATH from executable binaries and shared object files."; \
293 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
294 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
295 while read file ; do \
298 for dir in `chrpath -l "$file" | \
299 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
301 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
302 echo "remove-rpath: $dir in $file"; \
305 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
306 else rpath="$rpath:$dir" ; fi ; \
310 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
311 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
313 fi; }; __spec_install_post_chrpath } } }
315 #-----------------------------------------------------------------
316 # Find and gzip all kernel modules
320 #%no_install_post_compress_modules 1
321 %__spec_install_post_compress_modules { \
322 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
323 if [ -d "$RPM_BUILD_ROOT" ]; then \
324 echo "Compress kernel modules if any."; \
325 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
326 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
327 xargs -r %{__gzip} -9nf; \
328 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
329 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
332 }; __spec_install_post_compress_modules } }
334 # Remove common Perl files we don't package
335 %__spec_install_post_perl_clean {\
336 %{!?no_install_post_perl_clean: \
337 %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
340 #-----------------------------------------------------------------
341 # Update GConf2 schemas
345 %gconf_schema_install() \
347 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 \
350 %gconf_schema_uninstall() \
351 if [ $1 = 0 ]; then \
353 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
357 #-----------------------------------------------------------------
358 # Update desktop MIME database
359 # requires: desktop-file-utils
361 %update_desktop_database_post() {{ \
363 /usr/bin/update-desktop-database; \
366 %update_desktop_database_postun() {{ \
367 if [ $1 = 0 ]; then \
369 /usr/bin/update-desktop-database; \
373 #-----------------------------------------------------------------
374 # Update scrollkeeper database
375 # requires: scrollkeeper
377 %scrollkeeper_update_post() \
378 /usr/bin/scrollkeeper-update -q; \
381 %scrollkeeper_update_postun() \
382 if [ $1 = 0 ]; then \
383 /usr/bin/scrollkeeper-update -q; \
387 #-----------------------------------------------------------------
388 # post %install sequence:
389 # - autodeps exceptions
390 # - compress all man and info pages,
391 # - strip all ELF executables and ELF shared objects if not %debug.
392 # - compress kernel modules if any
394 ###################################################################
395 # Requires/Provides automation
396 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
398 %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
399 %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
400 %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
401 %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
402 %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
403 #%_noautocompressdoc %{nil}
405 %_missing_doc_files_terminate_build 1%{nil}
406 %_unpackaged_files_terminate_build %{nil}
408 %___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}'
409 %_emacs_lispdir %(emacs %___emacs_lispdir_helper)
410 %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
412 %__php_provides %{nil}
413 %__php_requires %{nil}
414 %__perl_provides %{nil}
415 %__perl_requires %{nil}
416 %__mono_provides %{nil}
417 %__mono_requires %{nil}
419 # Perl specific macro definitions.
420 %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
421 %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
422 %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
423 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
424 %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
425 %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
428 %ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
429 %ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
430 %ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
431 %ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
432 %ruby_sitelibdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
433 %ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)
434 %ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version
435 %ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version
437 %php_pear_dir %{_datadir}/pear
439 # directory where php includes are installed on system.
440 %__php_includedir /usr/include/php
441 # extract php/zend api versions
442 %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
443 %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
444 %php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{__php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
445 %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
446 %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
447 %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
448 %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
451 %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
453 # macros for public use
454 # for php extensions (php-pecl)
455 %requires_php_extension %{__php_api_requires modules_api php_api_version} \
456 %{__php_api_requires -v %php_major_version debug php_debug} \
457 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
459 # for zend extensions
460 %requires_zend_extension %{__php_api_requires zend_module_api} \
461 %{__php_api_requires zend_extension_api} \
462 %{__php_api_requires -v %php_major_version debug php_debug} \
463 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
465 # for php pdo modules (php-pecl-PDO_*)
466 %requires_php_pdo_module %{__php_api_requires PDO_API php_pdo_api_version}
468 # Python specific macro definitions.
469 # python main version
470 %py_ver %(python -c "import sys; print sys.version[:3]")
473 %py_prefix %(python -c "import sys; print sys.prefix")
474 %py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
475 %py_scriptdir %{py_prefix}/share/python%{py_ver}
476 %py_incdir /usr/include/python%{py_ver}
477 %py_sitedir %{py_libdir}/site-packages
478 %py_sitescriptdir %{py_scriptdir}/site-packages
479 %py_dyndir %{py_libdir}/lib-dynload
481 # pure python modules compilation
482 %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
484 %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
486 # Software written in Python language require Python with main version
487 %pyrequires_eq() Requires: %1
489 # Hardlink binary identical .pyc and .pyo files
490 # (idea by glen <at> pld-linux <dot> org)
491 %__spec_install_post_py_hardlink {\
492 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
493 [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
494 b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
495 if cmp -s "$a" "$b"; then \
499 }; __spec_install_post_py_hardlink } }
501 # remove python sources, so that check-files won't complain
502 # (idea by glen <at> pld-linux <dot> org)
504 for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
505 [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
512 if [ -e /boot/System.map-%1 ]; then \
513 /sbin/depmod -a -F /boot/System.map-%1 %1; \
515 if [ -e /boot/System.map ]; then \
516 /sbin/depmod -a -F /boot/System.map %1; \
518 /sbin/depmod -a %1; \
523 # XMMS specific macros
524 %xmms_prefix %(xmms-config --prefix 2>/dev/null)
525 %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null)
526 %xmms_version %(xmms-config --version 2>/dev/null)
527 %xmms_datadir %(xmms-config --data-dir 2>/dev/null)
528 %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null)
529 %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null)
530 %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null)
531 %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null)
532 %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null)
533 %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null)
535 %_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/')
537 # user/group checking macros
542 %userremove /usr/lib/rpm/user_group.sh user del
543 %groupremove /usr/lib/rpm/user_group.sh group del
546 # if %usertestrm myuser; then
547 # /usr/sbin/userdel -r myuser
549 # use these macros only if you need to call userdel/groupdel with
550 # a non-standard option or take an extra action; otherwise use the
551 # %userremove/%groupremove macros
553 %usertestrm /usr/lib/rpm/user_group.sh user testrm
554 %grouptestrm /usr/lib/rpm/user_group.sh group testrm
555 # user group membership management macros
558 # %addusertogroup myuser agroup
560 %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
562 # banner support (useful in {pre,post}{,un} and triggers)
565 # %banner name [-a] [-e] [-n] [-tn] <<EOF
566 # the banner text, the banner text
567 # the banner text, and following line
569 # You can use any form of here-document, <<'EOF' <<-EOT will do.
570 # NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
572 # -a - append to the banner
573 # -e - send to stderr instead of stdout
574 # -n - no show banner (overrides -t)
575 # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
577 RPM_SCRIPTVERBOSITY=5 \
578 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
579 if [ -x /usr/bin/banner.sh ]; then \
580 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
582 CMD="cat%{-e: >&2}" \
584 eval $CMD %2%{?3: %3} \
587 # useradd/groupadd macros written by glen@pld-linux.org.
588 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
591 # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
592 # [-g initial_group] [-G group[,...]] login
595 # -g gid/group. REQUIRED
596 # -s defaults to /bin/false
597 # -d defaults to /usr/share/empty
599 # -r is accepted but ignored (it's always set)
600 # -k skeleton dir. defaults to /usr/share/empty
602 # -P package name. defaults to %{name}
604 %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
605 %{!-u:%{error:useradd: Required argument -u missing}} \
606 %{!-g:%{error:useradd: Required argument -g missing}} \
607 %{!?1:%{error:useradd: Required parameter login missing}} \
608 if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
609 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
610 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
614 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
615 /usr/sbin/useradd \\\
616 %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\
619 -d %{-d*}%{!-d:/usr/share/empty} \\\
620 -s %{-s*}%{!-s:/bin/false} \\\
621 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
625 %{expand:%{%{#}}} 1>&2 || exit $? \
626 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd \
630 # %groupadd [-P package] [-g gid] group
635 # %groupadd -P %{name}-base -g %{gid} %{name}
638 %{!-g:%{error:groupadd: Required argument -g missing}} \
639 %{!?1:%{error:groupadd: Required parameter group missing}} \
640 if [ -n "`/usr/bin/getgid %{1}`" ]; then \
641 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
642 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
646 echo "Adding group %{1} GID=%{-g*}." \
647 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
648 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group \
651 # apache_config_{install/uninstall} macros written by glen@pld-linux.org.
652 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
654 # You should use webapp macros instead. these are here until single piece of them is gone from specs ;)
656 # The config is installed/removed inside trigger, this means that you can any
657 # time install apache1 or apache package and the configuration file is updated.
658 # if you don't need the config for various reason for specific apache, just
659 # remove the symlink from apache config directory. the trigger will not put the
660 # config again to that version of apache. In other words the config is linked
661 # to apache config directory on first install of PACKAGE or apache.
663 # should be called in trigger body:
664 # %triggerin -- apache1 >= 1.3.33-2
665 # %apache_config_install -v 1
667 # Add package's apache config to apache config.
670 # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
672 # -v REQUIRED: specify apache version. can be 1 or 2.
673 # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
674 # -n OPTIONAL: specify config "slot". defaults to 99
675 # -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers
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)
683 %apache_config_install(fv: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 [ -n "%{-f:1}" ] || ([ "$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\
689 # reload apache if the config symlink is there\
690 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\
691 # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \
692 if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\
693 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\
698 # Remove package's apache config from apache config.
701 # %apache_config_uninstall -v {1|2} -n 99
703 # -v REQUIRED: specify apache version. can be 1 or 2.
704 # -n OPTIONAL: specify config "slot". defaults to 99
705 %apache_config_uninstall(v:n:) \
706 %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \
707 %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
708 # remove link if either of the packages are gone \
709 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
710 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \
711 rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \
712 if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \
713 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \
721 # The config is installed/removed inside trigger, this means that you can any
722 # time install apache1/apache/lighttpd package and the configuration file is
723 # updated. if you don't need the config for various reason for specific
724 # webserver, just remove the symlink from config directory using webapp
725 # program. the trigger will not recreate the symlink on upgrades. In other
726 # words the config is linked to webserver config directory on first install of
727 # PACKAGE or WEBSERVER.
729 # Add package's webserver config to webserver webapps dir.
731 # %webapp_register WEBSERVER WEBAPP
734 %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
735 if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
736 /usr/sbin/webapp register %1 %2\
738 # reload webserver if the config symlink is there and skip reload if webserver is upgraded\
739 if [ -L /etc/%1/webapps.d/%2.conf ] && [ "$2" -lt "2" ]; then\
740 %{expand:%service -q %%1 reload}\
744 # Remove package's config from webserver webapps dir.
746 # %webapp_register [-f] WEBSERVER WEBAPP
747 %webapp_unregister(f) \
748 %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
749 # remove link if either of the packages are gone \
750 if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%2.conf ]; then \
751 /usr/sbin/webapp unregister %1 %2\
752 %{expand:%service -q %%1 reload}\
756 # see browser-plugins.spec / template-browser-plugin.spec
757 # written by glen@pld-linux.org.
758 %nsplugin_install(d:f) { \
759 # create link if it's first install of either of the packages \
760 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \
763 for file in %{*}; do \
764 echo echo Installing $file to %{-d*}; \
765 echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \
767 ) | ( %banner -t 5 -e %{name}-in ); fi; \
770 %nsplugin_uninstall(d:) { \
771 # remove link if either of the packages are gone \
772 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
775 for file in %{*}; do \
776 echo echo Removing $file from %{-d*}; \
777 echo "rm -f %{-d*}/$file;"; \
779 ) | ( %banner -t 5 -e %{name}-un ); fi; \
784 # calls usual service restart on package %post, but skips the restart if
785 # administrator has disabled automatic service restarts in either global
786 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
788 # written by glen@pld-linux.org.
789 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
792 # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
794 # -q be silent when service isn't started (for scriplets restaring other package's services)
796 %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
799 # java macros. based on jpackage macros.java
800 %_jvmdir %{_libdir}/jvm
801 %_jvmjardir %{_libdir}/jvm-exports
802 %_jvmprivdir %{_libdir}/jvm-private
803 %_jvmlibdir %{_libdir}/jvm
804 %_jvmdatadir %{_datadir}/jvm
805 %_jvmsysconfdir %{_sysconfdir}/jvm
806 # FIXME: are these used?
807 %_jvmcommonlibdir %{_libdir}/jvm-common
808 %_jvmcommondatadir %{_datadir}/jvm-common
809 %_jvmcommonsysconfdir %{_sysconfdir}/jvm-common
810 %_jnidir %{_libdir}/java
811 %java_home %(unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
813 %ant JAVA_HOME=%{java_home} ant
814 %jar %{java_home}/bin/jar
815 %java %(unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)
816 %javac %{java_home}/bin/javac
817 %javadoc %{java_home}/bin/javadoc
819 %add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir} %{_bindir}/jvmjar -l
822 install -d $RPM_BUILD_ROOT%{_bindir}\
823 cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \
827 # JPackage Project <http://www.jpackage.org/>\
829 # Source functions library\
830 . %{_javadir}-utils/java-functions\
832 # Source system prefs\
833 if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\
834 . %{_sysconfdir}/java/%{name}.conf\
838 if [ -f $HOME/.%{name}rc ]; then\
846 BASE_JARS="%(echo %4 | tr ':' ' ')"\
850 set_classpath $BASE_JARS\
851 set_flags $BASE_FLAGS\
852 set_options $BASE_OPTIONS\
858 # pear install macros written by glen@pld-linux.org.
859 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
862 # %%pear_package_setup [-a #] [-n FMT]
864 # -a # - unpack SOURCE# instead of SOURCE0
865 # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
866 # -z - unpack pear package and let pear use package.xml (not tarball) for install. use this for buggy packages.
867 # -f - force pear install. use with care.
869 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
870 # destination hierarchy. you should copy the tree to buildroot after
871 # patching/reorganizing with %%pear_package_install.
873 # additionally BUILDROOT is stripped from files and files are converted to UNIX
876 # the pear install process output is recorded to install.log, you should put it
877 # to %%doc for latter debug or just information.
879 # additionally additional-packages.txt is produced if it was detected that the
880 # package has optional dependencies. the file format is suitable of displaying
881 # in %%post of a package. you should put this file to %%doc. noautocompressdoc is
882 # automatically added for this file.
884 %pear_package_setup(a:n:zf) \
885 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
886 D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
887 %{-z:tar zxf %{S:%{-a*}%{!-a:0}}; P=%{_pearname}-%{version}/package.xml; [ -f $P ] || P=package.xml} \
890 -d php_dir=%{php_pear_dir} \\\
891 -d bin_dir=%{_bindir} \\\
892 -d data_dir=%{php_pear_dir}/data \\\
893 -d test_dir=%{php_pear_dir}/tests \\\
895 --installroot=${D} \\\
899 %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$P} | tee install.log \
900 # make post message of optional packages \
901 grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
902 if [ -s optional-packages.txt ]; then \
903 awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
905 rm -f optional-packages.txt \
907 rm ./%{php_pear_dir}/.{lock,filemap} \
909 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
910 # bug in PEAR --installroot. \
911 # http://pear.php.net/bugs/bug.php?id=5448 \
912 grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \
913 %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \
914 %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \
917 # copies exctracted PEAR package structure to buildroot.
918 # also copies PEAR registry file.
919 # please use this macro, for future extensions being possible.
920 %pear_package_install() \
921 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
922 find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
923 # help the developer out a little: \
924 if [ -f _noautoreq ]; then \
925 echo "AutoReqdep detected:" \
926 echo "_noautoreq $(cat _noautoreq)" \