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 %__gnome_doc_prepare gnome-doc-prepare --copy --force
35 %__gtkdocize gtkdocize --copy
36 %__intltoolize intltoolize --copy --force
37 %__libtoolize libtoolize --copy --force
39 # The number of cvs changelog entries kept when building package.
40 %_buildchangelogtruncate 20
42 %dependencytracking %{nil}
44 # Relations between package names that cause dependency loops
45 # with legacy packages that cannot be fixed. Relations are
48 # where package p has a Requires: on something that package q Provides:
50 # XXX Note: that there cannot be any whitespace within the string "p>q",
51 # and that both p and q are package names (i.e. no version/release).
52 %_dependency_whiteout %{nil}
54 #-----------------------------------------------------------------
56 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
57 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
58 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
59 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
60 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
61 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
62 %{?__cc:CC="%{__cc}" ; export CC ; } \
63 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
64 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
65 --host=%{_target_platform} \
67 --exec-prefix=%{_exec_prefix} \
69 --sbindir=%{_sbindir} \
70 --sysconfdir=%{_sysconfdir} \
71 --datadir=%{_datadir} \
72 --includedir=%{_includedir} \
74 --libexecdir=%{_libexecdir} \
75 --localstatedir=%{_localstatedir} \
76 --sharedstatedir=%{_sharedstatedir} \
78 --infodir=%{_infodir} \
79 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
80 %{dependencytracking} \
86 CFLAGS="%{rpmcflags}" \
87 CXXFLAGS="%{rpmcxxflags}" \
91 #----------------------------------------------------------------
92 %global configure_cache 0
93 %configure_cache_file %{buildroot}.configure.cache
95 %configure {./configure \
96 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
97 CFLAGS="${CFLAGS:-%rpmcflags}" \
98 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
99 FFLAGS="${FFLAGS:-%rpmcflags}" \
100 CPPFLAGS="${CPPFLAGS:-}" \
101 %{?__cc:CC="%{__cc}"} \
102 %{?__cxx:CXX="%{__cxx}"} \
103 --host=%{_target_platform} \
104 --build=%{_target_platform} \
105 --prefix=%{_prefix} \
106 --exec-prefix=%{_exec_prefix} \
107 --bindir=%{_bindir} \
108 --sbindir=%{_sbindir} \
109 --sysconfdir=%{_sysconfdir} \
110 --datadir=%{_datadir} \
111 --includedir=%{_includedir} \
112 --libdir=%{_libdir} \
113 --libexecdir=%{_libexecdir} \
114 --localstatedir=%{_localstatedir} \
115 --sharedstatedir=%{_sharedstatedir} \
116 --mandir=%{_mandir} \
117 --infodir=%{_infodir} \
118 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
119 %{dependencytracking} \
120 %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \
123 # ------------------------------------------------------------------------
124 # Overloading of some basic macros
141 %if 0%{?_enable_debug_packages}\
142 %{?buildsubdir:%{debug_package}}\
151 # Location of autoconf macros
152 %_aclocaldir %(aclocal --print-ac-dir)
154 # Location of omf files
155 %_omf_dest_dir %(scrollkeeper-config --omfdir)
157 # Location of pkgconfig files
158 %_pkgconfigdir /usr/%{_lib}/pkgconfig
160 # Location of desktop files
161 %_desktopdir /usr/share/applications
162 %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
164 # Location of pixmaps for applnk/desktop files
165 %_pixmapsdir /usr/share/pixmaps
167 # Location of themable icons for applnk/desktop files
168 %_iconsdir /usr/share/icons
170 # Location of fonts directories
171 %_fontsdir /usr/share/fonts
173 # Location of Gtk and associated libraries documentation
174 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
176 # Location of KDE documentation
177 %_kdedocdir %{_defaultdocdir}/kde/HTML
180 %__unsermake /usr/share/unsermake/unsermake
183 %date %(LC_ALL="C" date +"%a %b %d %Y")
186 %tmpdir %(echo "${TMPDIR:-/tmp}")
188 # Example files, programs, scripts...
189 %_examplesdir /usr/src/examples
191 # Alternative kernel type/version
192 %_alt_kernel %{nil}%{?alt_kernel:-%{?alt_kernel}}
194 # The directory holding Linux kernel sources
195 %_kernelsrcdir /usr/src/linux%{_alt_kernel}
197 # If non-empty "debug" macro defined, add "dbg" suffix to release number
198 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
200 # Requires name = version-release
201 %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")
203 %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)")
204 %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)")
205 %requires_releq_kernel_up(s:) Requires%{-s:(%{-s*})}: %releq_kernel_up
206 %requires_releq_kernel_smp(s:) Requires%{-s:(%{-s*})}: %releq_kernel_smp
208 %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")
209 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
211 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
213 # kernel version-release handling
214 %__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))
215 %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not")
216 %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not")
217 %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
218 %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
221 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
222 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
223 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
224 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
225 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
226 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
227 %docbook_sgmlcat_fix() { for l in \
229 ' -- default decl --' \
230 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
231 ' -- hacks for opensp --' \
232 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
233 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
235 ; do echo $l; done >> %1 \
238 # minimum file size needed for compressed documents.
239 # just smaller files than this get larger when compressed.
241 # - 0 byte file compressed was 25 bytes .gz
242 # - 39 byte file was compressed as 57
243 # - with test/test.spec@man 158 byte file was compressed also 158
244 %_min_compress_bytes 159
246 #-----------------------------------------------------------------
247 # find and gzip all files in %{_mandir} and %{infodir}
249 # Requires: xargs, find
251 #%no_install_post_compress_docs 1
252 %__spec_install_post_compress_docs { \
253 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
254 echo "Compress man and info pages."; \
255 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
256 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
257 find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \
258 find "$RPM_BUILD_ROOT$i" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \
259 find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
262 }; __spec_install_post_compress_docs } }
264 #-----------------------------------------------------------------
265 # Strip executable binaries and shared object files
267 # Requires: find, awk, strip, cut, xargs
269 #%no_install_post_strip 1
270 %__spec_install_post_strip {%{!?debug: \
271 %{!?no_install_post_strip:__spec_install_post_strip() { \
272 if [ -d "$RPM_BUILD_ROOT" ]; then \
273 echo "Strip executable binaries, archives and shared object files."; \
274 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
275 elfexelist=`echo $filelist | xargs -r file | \
276 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
277 elfsharedlist=`echo $filelist | xargs -r file | \
278 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
279 elfarchiveslist=`echo $filelist | xargs -r file | \
280 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
281 if [ -n "$elfexelist" ]; then \
282 chmod u+w $elfexelist; \
283 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
285 if [ -n "$elfsharedlist" ]; then \
286 chmod u+w $elfsharedlist; \
287 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
289 if [ -n "$elfarchiveslist" ]; then \
290 chmod u+w $elfarchiveslist; \
291 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
293 fi; }; __spec_install_post_strip } } }
295 #-----------------------------------------------------------------
296 # remove all RPATH from executable binaries and shared object files
298 # Requires: find, awk, cut, xargs, chrpath, uname
300 #%no_install_post_chrpath 1
301 %__spec_install_post_chrpath {%{!?debug: \
302 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
303 if [ -d "$RPM_BUILD_ROOT" ]; then \
304 echo "Remove RPATH from executable binaries and shared object files."; \
305 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
306 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
307 while read file ; do \
310 for dir in `chrpath -l "$file" | \
311 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
313 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
314 echo "remove-rpath: $dir in $file"; \
317 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
318 else rpath="$rpath:$dir" ; fi ; \
322 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
323 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
325 fi; }; __spec_install_post_chrpath } } }
327 #-----------------------------------------------------------------
328 # Find and gzip all kernel modules
332 #%no_install_post_compress_modules 1
333 %__spec_install_post_compress_modules { \
334 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
335 if [ -d "$RPM_BUILD_ROOT" ]; then \
336 echo "Compress kernel modules if any."; \
337 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
338 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
339 xargs -r %{__gzip} -9nf; \
340 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
341 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
344 }; __spec_install_post_compress_modules } }
346 # Remove common Perl files we don't package
347 %__spec_install_post_perl_clean {\
348 %{!?no_install_post_perl_clean: \
349 %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
352 #-----------------------------------------------------------------
353 # Update GConf2 schemas
357 %gconf_schema_install() \
359 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 \
362 %gconf_schema_uninstall() \
363 if [ $1 = 0 ]; then \
365 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
369 #-----------------------------------------------------------------
370 # Update desktop MIME database
371 # requires: desktop-file-utils
373 %update_desktop_database_post() {{ \
375 /usr/bin/update-desktop-database -q; \
378 %update_desktop_database_postun() {{ \
379 if [ $1 = 0 ]; then \
381 /usr/bin/update-desktop-database -q; \
385 #-----------------------------------------------------------------
386 # Update shared MIME info database
387 # requires: shared-mime-info
389 %update_mime_database() {{ \
391 /usr/bin/update-mime-database %{_datadir}/mime; \
394 #-----------------------------------------------------------------
398 %update_icon_cache() {{ \
400 /usr/bin/gtk-update-icon-cache -qf %{_datadir}/icons/%1; \
403 #-----------------------------------------------------------------
404 # Update scrollkeeper database
405 # requires: scrollkeeper
407 %scrollkeeper_update_post() \
408 /usr/bin/scrollkeeper-update -q; \
411 %scrollkeeper_update_postun() \
412 if [ $1 = 0 ]; then \
413 /usr/bin/scrollkeeper-update -q; \
417 #-----------------------------------------------------------------
418 # post %install sequence:
419 # - autodeps exceptions
420 # - compress all man and info pages,
421 # - strip all ELF executables and ELF shared objects if not %debug.
422 # - compress kernel modules if any
424 ###################################################################
425 # Requires/Provides automation
426 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
428 %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
429 %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
430 %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
431 %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
432 %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
433 #%_noautocompressdoc %{nil}
435 %_missing_doc_files_terminate_build 1%{nil}
436 %_unpackaged_files_terminate_build %{nil}
438 %___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;}'
439 %_emacs_lispdir %(emacs %___emacs_lispdir_helper)
440 %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
442 %__php_provides %{nil}
443 %__php_requires %{nil}
444 %__perl_provides %{nil}
445 %__perl_requires %{nil}
446 %__mono_provides %{nil}
447 %__mono_requires %{nil}
449 # Perl specific macro definitions.
450 %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
451 %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
452 %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
453 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
454 %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
455 %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
458 %ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
459 %ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
460 %ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
461 %ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
462 %ruby_sitelibdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
463 %ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)
464 %ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version
465 %ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version
467 %php_pear_dir %{_datadir}/pear
469 # directory where php includes are installed on system.
470 %__php_includedir /usr/include/php
471 # extract php/zend api versions
472 %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
473 %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
474 %php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{__php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
475 %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
476 %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
477 %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
478 %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
481 %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
483 # macros for public use
484 # for php extensions (php-pecl)
485 %requires_php_extension %{__php_api_requires modules_api php_api_version} \
486 %{__php_api_requires -v %php_major_version debug php_debug} \
487 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
489 # for zend extensions
490 %requires_zend_extension %{__php_api_requires zend_module_api} \
491 %{__php_api_requires zend_extension_api} \
492 %{__php_api_requires -v %php_major_version debug php_debug} \
493 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
495 # for php pdo modules (php-pecl-PDO_*)
496 %requires_php_pdo_module %{__php_api_requires PDO_API php_pdo_api_version}
498 # Python specific macro definitions.
499 # python main version
500 %py_ver %(python -c "import sys; print sys.version[:3]")
503 %py_prefix %(python -c "import sys; print sys.prefix")
504 %py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
505 %py_scriptdir %{py_prefix}/share/python%{py_ver}
506 %py_incdir /usr/include/python%{py_ver}
507 %py_sitedir %{py_libdir}/site-packages
508 %py_sitescriptdir %{py_scriptdir}/site-packages
509 %py_dyndir %{py_libdir}/lib-dynload
511 # pure python modules compilation
512 %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
514 %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
516 # Software written in Python language require Python with main version
517 %pyrequires_eq() Requires: %1
519 # Hardlink binary identical .pyc and .pyo files
520 # (idea by glen <at> pld-linux <dot> org)
521 %__spec_install_post_py_hardlink {\
522 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
523 [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
524 b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
525 if cmp -s "$a" "$b"; then \
529 }; __spec_install_post_py_hardlink } }
531 # remove python sources, so that check-files won't complain
532 # (idea by glen <at> pld-linux <dot> org)
534 for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
535 [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
542 if [ -e /boot/System.map-%1 ]; then \
543 /sbin/depmod -a -F /boot/System.map-%1 %1; \
545 if [ -e /boot/System.map ]; then \
546 /sbin/depmod -a -F /boot/System.map %1; \
548 /sbin/depmod -a %1; \
553 # XMMS specific macros
554 %xmms_prefix %(xmms-config --prefix 2>/dev/null)
555 %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null)
556 %xmms_version %(xmms-config --version 2>/dev/null)
557 %xmms_datadir %(xmms-config --data-dir 2>/dev/null)
558 %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null)
559 %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null)
560 %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null)
561 %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null)
562 %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null)
563 %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null)
565 %_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/')
567 # user/group checking macros
572 %userremove /usr/lib/rpm/user_group.sh user del
573 %groupremove /usr/lib/rpm/user_group.sh group del
576 # if %usertestrm myuser; then
577 # /usr/sbin/userdel -r myuser
579 # use these macros only if you need to call userdel/groupdel with
580 # a non-standard option or take an extra action; otherwise use the
581 # %userremove/%groupremove macros
583 %usertestrm /usr/lib/rpm/user_group.sh user testrm
584 %grouptestrm /usr/lib/rpm/user_group.sh group testrm
585 # user group membership management macros
588 # %addusertogroup myuser agroup
590 %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
592 # banner support (useful in {pre,post}{,un} and triggers)
595 # %banner name [-a] [-e] [-n] [-tn] <<EOF
596 # the banner text, the banner text
597 # the banner text, and following line
599 # You can use any form of here-document, <<'EOF' <<-EOT will do.
600 # NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
602 # -a - append to the banner
603 # -e - send to stderr instead of stdout
604 # -n - no show banner (overrides -t)
605 # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
607 RPM_SCRIPTVERBOSITY=5 \
608 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
609 if [ -x /usr/bin/banner.sh ]; then \
610 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
612 CMD="cat%{-e: >&2}" \
614 eval $CMD %2%{?3: %3} \
617 # useradd/groupadd macros written by glen@pld-linux.org.
618 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
621 # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
622 # [-g initial_group] [-G group[,...]] login
625 # -g gid/group. REQUIRED
626 # -s defaults to /bin/false
627 # -d defaults to /usr/share/empty
629 # -r is accepted but ignored (it's always set)
630 # -k skeleton dir. defaults to /usr/share/empty
632 # -P package name. defaults to %{name}
634 %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
635 %{!-u:%{error:useradd: Required argument -u missing}} \
636 %{!-g:%{error:useradd: Required argument -g missing}} \
637 %{!?1:%{error:useradd: Required parameter login missing}} \
638 if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
639 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
640 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
644 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
645 /usr/sbin/useradd \\\
646 %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\
649 -d %{-d*}%{!-d:/usr/share/empty} \\\
650 -s %{-s*}%{!-s:/bin/false} \\\
651 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
655 %{expand:%{%{#}}} 1>&2 || exit $? \
656 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd \
660 # %groupadd [-P package] [-g gid] group
665 # %groupadd -P %{name}-base -g %{gid} %{name}
668 %{!-g:%{error:groupadd: Required argument -g missing}} \
669 %{!?1:%{error:groupadd: Required parameter group missing}} \
670 if [ -n "`/usr/bin/getgid %{1}`" ]; then \
671 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
672 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
676 echo "Adding group %{1} GID=%{-g*}." \
677 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
678 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group \
681 # apache_config_{install/uninstall} macros written by glen@pld-linux.org.
682 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
684 # You should use webapp macros instead. these are here until single piece of them is gone from specs ;)
686 # The config is installed/removed inside trigger, this means that you can any
687 # time install apache1 or apache package and the configuration file is updated.
688 # if you don't need the config for various reason for specific apache, just
689 # remove the symlink from apache config directory. the trigger will not put the
690 # config again to that version of apache. In other words the config is linked
691 # to apache config directory on first install of PACKAGE or apache.
693 # should be called in trigger body:
694 # %triggerin -- apache1 >= 1.3.33-2
695 # %apache_config_install -v 1
697 # Add package's apache config to apache config.
700 # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
702 # -v REQUIRED: specify apache version. can be 1 or 2.
703 # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
704 # -n OPTIONAL: specify config "slot". defaults to 99
705 # -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers
707 # Internal macros. don't use ;).
708 # expands apache config dir by apache version at build time.
709 %__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)
710 # expands apache service name by apache version at build time.
711 %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi)
713 %apache_config_install(fv:c:n:) \
714 %{!-v:%{error:apache_config_install: Required argument -v missing}} \
715 %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
716 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\
717 ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\
719 # reload apache if the config symlink is there\
720 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\
721 # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \
722 if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\
723 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\
728 # Remove package's apache config from apache config.
731 # %apache_config_uninstall -v {1|2} -n 99
733 # -v REQUIRED: specify apache version. can be 1 or 2.
734 # -n OPTIONAL: specify config "slot". defaults to 99
735 %apache_config_uninstall(v:n:) \
736 %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \
737 %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
738 # remove link if either of the packages are gone \
739 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
740 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \
741 rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \
742 if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \
743 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \
751 # The config is installed/removed inside trigger, this means that you can any
752 # time install apache1/apache/lighttpd package and the configuration file is
753 # updated. if you don't need the config for various reason for specific
754 # webserver, just remove the symlink from config directory using webapp
755 # program. the trigger will not recreate the symlink on upgrades. In other
756 # words the config is linked to webserver config directory on first install of
757 # PACKAGE or WEBSERVER.
759 # Add package's webserver config to webserver webapps dir.
761 # %webapp_register WEBSERVER WEBAPP
764 %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
765 if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
766 /usr/sbin/webapp register %1 %2\
768 # reload webserver if the config symlink is there and skip reload if webserver is upgraded\
769 if [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ] && [ "$2" -lt "2" ]; then\
770 %{expand:%service -q %%1 reload}\
774 # Remove package's config from webserver webapps dir.
776 # %webapp_register [-f] WEBSERVER WEBAPP
777 %webapp_unregister(f) \
778 %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
779 # remove link if either of the packages are gone \
780 if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ]; then \
781 /usr/sbin/webapp unregister %1 %2\
782 %{expand:%service -q %%1 reload}\
786 # see browser-plugins.spec / template-browser-plugin.spec
787 # written by glen@pld-linux.org.
788 %nsplugin_install(d:f) { \
789 # create link if it's first install of either of the packages \
790 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \
793 for file in %{*}; do \
794 echo echo Installing $file to %{-d*}; \
795 echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \
797 ) | ( %banner -t 5 -e %{name}-in ); fi; \
800 %nsplugin_uninstall(d:) { \
801 # remove link if either of the packages are gone \
802 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
805 for file in %{*}; do \
806 echo echo Removing $file from %{-d*}; \
807 echo "rm -f %{-d*}/$file;"; \
809 ) | ( %banner -t 5 -e %{name}-un ); fi; \
814 # calls usual service restart on package %post, but skips the restart if
815 # administrator has disabled automatic service restarts in either global
816 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
818 # written by glen@pld-linux.org.
819 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
822 # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
824 # -q be silent when service isn't started (for scriplets restaring other package's services)
826 %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
829 # java macros. based on jpackage macros.java
830 %_jvmdir %{_libdir}/jvm
831 %_jvmjardir %{_libdir}/jvm-exports
832 %_jvmprivdir %{_libdir}/jvm-private
833 %_jvmlibdir %{_libdir}/jvm
834 %_jvmdatadir %{_datadir}/jvm
835 %_jvmsysconfdir %{_sysconfdir}/jvm
836 # FIXME: are these used?
837 %_jvmcommonlibdir %{_libdir}/jvm-common
838 %_jvmcommondatadir %{_datadir}/jvm-common
839 %_jvmcommonsysconfdir %{_sysconfdir}/jvm-common
840 %_jnidir %{_libdir}/java
841 %java_home %(unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
843 %ant JAVA_HOME=%{java_home} ant
844 %jar %{java_home}/bin/jar
845 %java %(unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)
846 %javac %{java_home}/bin/javac
847 %javadoc %{java_home}/bin/javadoc
849 %add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir} %{_bindir}/jvmjar -l
852 install -d $RPM_BUILD_ROOT%{_bindir}\
853 cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \
857 # JPackage Project <http://www.jpackage.org/>\
859 # Source functions library\
860 . %{_javadir}-utils/java-functions\
862 # Source system prefs\
863 if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\
864 . %{_sysconfdir}/java/%{name}.conf\
868 if [ -f $HOME/.%{name}rc ]; then\
876 BASE_JARS="%(echo %4 | tr ':' ' ')"\
880 set_classpath $BASE_JARS\
881 set_flags $BASE_FLAGS\
882 set_options $BASE_OPTIONS\
888 # pear install macros written by glen@pld-linux.org.
889 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
892 # %%pear_package_setup [-a #] [-n FMT]
894 # -a # - unpack SOURCE# instead of SOURCE0
895 # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
896 # -z - unpack pear package and let pear use package.xml (not tarball) for install. use this for buggy packages.
897 # -f - force pear install. use with care.
899 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
900 # destination hierarchy. you should copy the tree to buildroot after
901 # patching/reorganizing with %%pear_package_install.
903 # additionally BUILDROOT is stripped from files and files are converted to UNIX
906 # the pear install process output is recorded to install.log, you should put it
907 # to %%doc for latter debug or just information.
909 # additionally additional-packages.txt is produced if it was detected that the
910 # package has optional dependencies. the file format is suitable of displaying
911 # in %%post of a package. you should put this file to %%doc. noautocompressdoc is
912 # automatically added for this file.
914 %pear_package_setup(a:n:zf) \
915 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
916 D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
917 %{-z:tar zxf %{S:%{-a*}%{!-a:0}}; P=%{_pearname}-%{version}/package.xml; [ -f $P ] || P=package.xml} \
920 -d php_dir=%{php_pear_dir} \\\
921 -d bin_dir=%{_bindir} \\\
922 -d data_dir=%{php_pear_dir}/data \\\
923 -d test_dir=%{php_pear_dir}/tests \\\
925 --installroot=${D} \\\
929 %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$P} | tee install.log \
930 # make post message of optional packages \
931 grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
932 if [ -s optional-packages.txt ]; then \
933 awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
935 rm -f optional-packages.txt \
937 rm ./%{php_pear_dir}/.{lock,filemap} \
939 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
940 # bug in PEAR --installroot. \
941 # http://pear.php.net/bugs/bug.php?id=5448 \
942 grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \
943 %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \
944 %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \
947 # copies exctracted PEAR package structure to buildroot.
948 # also copies PEAR registry file.
949 # please use this macro, for future extensions being possible.
950 %pear_package_install() \
951 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
952 find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
953 # help the developer out a little: \
954 if [ -f _noautoreq ]; then \
955 echo "AutoReqdep detected:" \
956 echo "_noautoreq $(cat _noautoreq)" \
961 # Register OpenLDAP schema.
962 # Author: Elan Ruusamäe <glen@pld-linux.org>
965 # %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
967 # -d specify dependant schemas, separated by comma
969 %openldap_schema_register(d:) \
970 for schema in %*; do \
971 if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
973 /^include.*local.schema/{ \
976 " /etc/openldap/slapd.conf \
979 # enable dependant schemas \
980 if [ "%{-d*}" ]; then \
982 /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 's/,/\\\\|/g')\\)\\.schema/{ \
984 }' /etc/openldap/slapd.conf \
988 # Unregister OpenLDAP schema.
989 # Author: Elan Ruusamäe <glen@pld-linux.org>
992 # %%openldap_schema_unregister %{schemadir}/horde.schema
994 %openldap_schema_unregister() \
995 for schema in %*; do \
996 if grep -q "$schema" /etc/openldap/slapd.conf; then \
998 /^include.*$(echo "$schema" | %{__sed} -e 's,/,\\\\/,g')/d \
999 # for symmetry it would be nice if we disable enabled schemas in post, \
1000 # but we really can not do that, it would break something else. \
1001 " /etc/openldap/slapd.conf \
1006 # vim:ts=4 sw=4 noet