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}
55 #-----------------------------------------------------------------
57 # (re)definition of %{rpm*flags} with %filterout_* support
60 # Flags specified in %filterout_* are removed from %rpm*flags, exactly:
61 # %rpmcflags = %optflags - %filterout - %filterout_c - %filterout_ld
62 # %rpmcxxflags = %optflags - %filterout - %filterout_cxx - %filterout_ld
63 # %rpmldflags = %optldflags - %filterout_ld
65 # Regular expressions are supported, but to avoid some character be treated
66 # as regular expression it must be escaped twice.
71 if (I[i] ~ "^" F[f] "$") A=1; \
73 if (!A) printf(I[i] FS); \
76 %rpmcflags %(awk 'BEGIN {
77 split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
78 split("%{?filterout} %{?filterout_c} %{?filterout_ld}",F);
82 %rpmcxxflags %(awk 'BEGIN {
83 split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
84 split("%{?filterout} %{?filterout_cxx} %{?filterout_ld}",F);
88 %rpmldflags %(awk 'BEGIN {
89 split("%{?optldflags}",I);
90 split("%{?filterout_ld}",F)
94 # rpmldflags with stripped -Wl, -- in the form flags have to be passed to 'ld'
95 # but, don't use it, better use gcc as linker
96 %ld_rpmldflags %(awk 'BEGIN {
97 split("%{rpmldflags}",F);
108 #-----------------------------------------------------------------
110 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
111 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
112 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
113 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
114 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
115 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
116 %{?__cc:CC="%{__cc}" ; export CC ; } \
117 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
118 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
119 --host=%{_target_platform} \
120 --prefix=%{_prefix} \
121 --exec-prefix=%{_exec_prefix} \
122 --bindir=%{_bindir} \
123 --sbindir=%{_sbindir} \
124 --sysconfdir=%{_sysconfdir} \
125 --datadir=%{_datadir} \
126 --includedir=%{_includedir} \
127 --libdir=%{_libdir} \
128 --libexecdir=%{_libexecdir} \
129 --localstatedir=%{_localstatedir} \
130 --sharedstatedir=%{_sharedstatedir} \
131 --mandir=%{_mandir} \
132 --infodir=%{_infodir} \
133 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
134 %{dependencytracking} \
140 CFLAGS="%{rpmcflags}" \
141 CXXFLAGS="%{rpmcxxflags}" \
146 # override __waf to add -j1 in your ~/.rpmmacros
152 CFLAGS="%{rpmcflags}" \
153 CXXFLAGS="%{rpmcxxflags}" \
157 #----------------------------------------------------------------
158 %global configure_cache 0
159 %configure_cache_file %{buildroot}.configure.cache
161 %configure {./configure \
162 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
163 CFLAGS="${CFLAGS:-%rpmcflags}" \
164 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
165 FFLAGS="${FFLAGS:-%rpmcflags}" \
166 CPPFLAGS="${CPPFLAGS:-}" \
167 %{?__cc:CC="%{__cc}"} \
168 %{?__cxx:CXX="%{__cxx}"} \
169 --host=%{_target_platform} \
170 --build=%{_target_platform} \
171 --prefix=%{_prefix} \
172 --exec-prefix=%{_exec_prefix} \
173 --bindir=%{_bindir} \
174 --sbindir=%{_sbindir} \
175 --sysconfdir=%{_sysconfdir} \
176 --datadir=%{_datadir} \
177 --includedir=%{_includedir} \
178 --libdir=%{_libdir} \
179 --libexecdir=%{_libexecdir} \
180 --localstatedir=%{_localstatedir} \
181 --sharedstatedir=%{_sharedstatedir} \
182 --mandir=%{_mandir} \
183 --infodir=%{_infodir} \
184 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
185 %{dependencytracking} \
186 %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \
189 # ------------------------------------------------------------------------
190 # Overloading of some basic macros
207 %if 0%{?_enable_debug_packages}\
208 %{?buildsubdir:%{debug_package}}\
217 # Location of autoconf macros
218 %_aclocaldir %(aclocal --print-ac-dir)
220 # Location of omf files
221 %_omf_dest_dir %(scrollkeeper-config --omfdir)
223 # Location of pkgconfig files
224 %_pkgconfigdir /usr/%{_lib}/pkgconfig
226 # Location of desktop files
227 %_desktopdir /usr/share/applications
228 %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
230 # Location of pixmaps for applnk/desktop files
231 %_pixmapsdir /usr/share/pixmaps
233 # Location of themable icons for applnk/desktop files
234 %_iconsdir /usr/share/icons
236 # Location of fonts directories
237 %_fontsdir /usr/share/fonts
239 # Location of Gtk and associated libraries documentation
240 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
242 # Location of KDE documentation
243 %_kdedocdir %{_defaultdocdir}/kde/HTML
246 %__unsermake /usr/share/unsermake/unsermake
249 %date %(LC_ALL="C" date +"%a %b %d %Y")
252 %tmpdir %(echo "${TMPDIR:-/tmp}")
254 # Example files, programs, scripts...
255 %_examplesdir /usr/src/examples
257 # Alternative kernel type/version
258 %_alt_kernel %{nil}%{?alt_kernel:-%{?alt_kernel}}
260 # The directory holding Linux kernel sources
261 %_kernelsrcdir /usr/src/linux%{_alt_kernel}
263 # If non-empty "debug" macro defined, add "dbg" suffix to release number
264 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
266 # Requires name = version-release
267 %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")
269 %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)")
270 %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)")
271 %requires_releq_kernel_up(s:) Requires%{-s:(%{-s*})}: %releq_kernel_up
272 %requires_releq_kernel_smp(s:) Requires%{-s:(%{-s*})}: %releq_kernel_smp
274 %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")
275 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
277 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
279 # kernel version-release handling
280 %__kernel_ver %( VER_H=%{_kernelsrcdir}/include/linux/utsrelease.h; [ -f $VER_H ] || VER_H=%{_kernelsrcdir}/include/linux/version.h; [ -f $VER_H ] && (grep UTS_RELEASE $VER_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))
281 %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not")
282 %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not")
283 %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
284 %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
287 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
288 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
289 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
290 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
291 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
292 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
293 %docbook_sgmlcat_fix() { for l in \
295 ' -- default decl --' \
296 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
297 ' -- hacks for opensp --' \
298 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
299 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
301 ; do echo $l; done >> %1 \
304 # minimum file size needed for compressed documents.
305 # just smaller files than this get larger when compressed.
307 # - 0 byte file compressed was 25 bytes .gz
308 # - 39 byte file was compressed as 57
309 # - with test/test.spec@man 158 byte file was compressed also 158
310 %_min_compress_bytes 159
312 #-----------------------------------------------------------------
313 # find and gzip all files in %{_mandir} and %{infodir}
315 # Requires: xargs, find
317 #%no_install_post_compress_docs 1
318 %__spec_install_post_compress_docs { \
319 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
320 echo "Compress man and info pages."; \
321 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
322 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
323 find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \
324 find "$RPM_BUILD_ROOT$i" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \
325 find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
328 }; __spec_install_post_compress_docs } }
330 #-----------------------------------------------------------------
331 # Strip executable binaries and shared object files
333 # Requires: find, awk, strip, cut, xargs
335 #%no_install_post_strip 1
336 %__spec_install_post_strip {%{!?debug: \
337 %{!?no_install_post_strip:__spec_install_post_strip() { \
338 if [ -d "$RPM_BUILD_ROOT" ]; then \
339 echo "Strip executable binaries, archives and shared object files."; \
340 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
341 elfexelist=`echo $filelist | xargs -r file | \
342 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
343 elfsharedlist=`echo $filelist | xargs -r file | \
344 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
345 elfarchiveslist=`echo $filelist | xargs -r file | \
346 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
347 if [ -n "$elfexelist" ]; then \
348 chmod u+w $elfexelist; \
349 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
351 if [ -n "$elfsharedlist" ]; then \
352 chmod u+w $elfsharedlist; \
353 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
355 if [ -n "$elfarchiveslist" ]; then \
356 chmod u+w $elfarchiveslist; \
357 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
359 fi; }; __spec_install_post_strip } } }
361 #-----------------------------------------------------------------
362 # remove all RPATH from executable binaries and shared object files
364 # Requires: find, awk, cut, xargs, chrpath, uname
366 #%no_install_post_chrpath 1
367 %__spec_install_post_chrpath {%{!?debug: \
368 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
369 if [ -d "$RPM_BUILD_ROOT" ]; then \
370 echo "Remove RPATH from executable binaries and shared object files."; \
371 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
372 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
373 while read file ; do \
376 for dir in `chrpath -l "$file" | \
377 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
379 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
380 echo "remove-rpath: $dir in $file"; \
383 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
384 else rpath="$rpath:$dir" ; fi ; \
388 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
389 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
391 fi; }; __spec_install_post_chrpath } } }
393 #-----------------------------------------------------------------
394 # Find and gzip all kernel modules
398 #%no_install_post_compress_modules 1
399 %__spec_install_post_compress_modules { \
400 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
401 if [ -d "$RPM_BUILD_ROOT" ]; then \
402 echo "Compress kernel modules if any."; \
403 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
404 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
405 xargs -r %{__gzip} -9nf; \
406 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
407 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
410 }; __spec_install_post_compress_modules } }
412 # Remove common Perl files we don't package
413 %__spec_install_post_perl_clean {\
414 %{!?no_install_post_perl_clean: \
415 %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
418 #-----------------------------------------------------------------
419 # Update GConf2 schemas
423 %gconf_schema_install() \
425 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 \
428 %gconf_schema_uninstall() \
429 if [ $1 = 0 ]; then \
431 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
435 #-----------------------------------------------------------------
436 # Update desktop MIME database
437 # requires: desktop-file-utils
439 %update_desktop_database_post() {{ \
441 /usr/bin/update-desktop-database -q; \
444 %update_desktop_database_postun() {{ \
445 if [ $1 = 0 ]; then \
447 /usr/bin/update-desktop-database -q; \
451 #-----------------------------------------------------------------
452 # Update shared MIME info database
453 # requires: shared-mime-info
455 %update_mime_database() {{ \
457 /usr/bin/update-mime-database %{_datadir}/mime; \
460 #-----------------------------------------------------------------
464 %update_icon_cache() {{ \
466 /usr/bin/gtk-update-icon-cache -qf %{_datadir}/icons/%1; \
469 #-----------------------------------------------------------------
470 # Update scrollkeeper database
471 # requires: scrollkeeper
473 %scrollkeeper_update_post() \
474 /usr/bin/scrollkeeper-update -q; \
477 %scrollkeeper_update_postun() \
478 if [ $1 = 0 ]; then \
479 /usr/bin/scrollkeeper-update -q; \
483 #-----------------------------------------------------------------
484 # post %install sequence:
485 # - autodeps exceptions
486 # - compress all man and info pages,
487 # - strip all ELF executables and ELF shared objects if not %debug.
488 # - compress kernel modules if any
490 ###################################################################
491 # Requires/Provides automation
492 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
494 %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
495 %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
496 %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
497 %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
498 %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
499 #%_noautocompressdoc %{nil}
501 %_missing_doc_files_terminate_build 1%{nil}
502 %_unpackaged_files_terminate_build %{nil}
504 %___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;}'
505 %_emacs_lispdir %(emacs %___emacs_lispdir_helper)
506 %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
508 %__php_provides %{nil}
509 %__php_requires %{nil}
510 %__perl_provides %{nil}
511 %__perl_requires %{nil}
512 %__mono_provides %{nil}
513 %__mono_requires %{nil}
515 # Perl specific macro definitions.
516 %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
517 %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
518 %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
519 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
520 %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
521 %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
524 %ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
525 %ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
526 %ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
527 %ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
528 %ruby_sitelibdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
529 %ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)
530 %ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version
531 %ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version
533 %php_pear_dir /usr/share/pear
535 # directory where php includes are installed on system.
536 %__php_includedir /usr/include/php
537 # extract php/zend api versions
538 %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
539 %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
540 %php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{__php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
541 %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
542 %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
543 %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
544 %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
547 %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
549 # macros for public use
550 # for php extensions (php-pecl)
551 %requires_php_extension %{__php_api_requires modules_api php_api_version} \
552 %{__php_api_requires zend_module_api} \
553 %{__php_api_requires -v %php_major_version debug php_debug} \
554 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
556 # for zend extensions
557 %requires_zend_extension %{__php_api_requires zend_module_api} \
558 %{__php_api_requires zend_extension_api} \
559 %{__php_api_requires -v %php_major_version debug php_debug} \
560 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
562 # for php pdo modules (php-pecl-PDO_*)
563 %requires_php_pdo_module %{__php_api_requires PDO_API php_pdo_api_version}
565 # Python specific macro definitions.
566 # python main version
567 %py_ver %(python -c "import sys; print sys.version[:3]")
570 %py_prefix %(python -c "import sys; print sys.prefix")
571 %py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
572 %py_scriptdir %{py_prefix}/share/python%{py_ver}
573 %py_incdir /usr/include/python%{py_ver}
574 %py_sitedir %{py_libdir}/site-packages
575 %py_sitescriptdir %{py_scriptdir}/site-packages
576 %py_dyndir %{py_libdir}/lib-dynload
578 # pure python modules compilation
579 %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
581 %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
583 # Software written in Python language require Python with main version
584 %pyrequires_eq() Requires: %1
586 # Hardlink binary identical .pyc and .pyo files
587 # (idea by glen <at> pld-linux <dot> org)
588 %__spec_install_post_py_hardlink {\
589 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
590 [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
591 b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
592 if cmp -s "$a" "$b"; then \
596 }; __spec_install_post_py_hardlink } }
598 # remove python sources, so that check-files won't complain
599 # (idea by glen <at> pld-linux <dot> org)
601 for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
602 [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
609 if [ -e /boot/System.map-%1 ]; then \
610 /sbin/depmod -a -F /boot/System.map-%1 %1; \
612 if [ -e /boot/System.map ]; then \
613 /sbin/depmod -a -F /boot/System.map %1; \
615 /sbin/depmod -a %1; \
620 # XMMS specific macros
621 %xmms_prefix %(xmms-config --prefix 2>/dev/null)
622 %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null)
623 %xmms_version %(xmms-config --version 2>/dev/null)
624 %xmms_datadir %(xmms-config --data-dir 2>/dev/null)
625 %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null)
626 %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null)
627 %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null)
628 %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null)
629 %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null)
630 %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null)
632 %_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/')
634 # user/group checking macros
639 %userremove /usr/lib/rpm/user_group.sh user del
640 %groupremove /usr/lib/rpm/user_group.sh group del
643 # if %usertestrm myuser; then
644 # /usr/sbin/userdel -r myuser
646 # use these macros only if you need to call userdel/groupdel with
647 # a non-standard option or take an extra action; otherwise use the
648 # %userremove/%groupremove macros
650 %usertestrm /usr/lib/rpm/user_group.sh user testrm
651 %grouptestrm /usr/lib/rpm/user_group.sh group testrm
652 # user group membership management macros
655 # %addusertogroup myuser agroup
657 %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
659 # banner support (useful in {pre,post}{,un} and triggers)
662 # %banner name [-a] [-e] [-n] [-tn] <<EOF
663 # the banner text, the banner text
664 # the banner text, and following line
666 # You can use any form of here-document, <<'EOF' <<-EOT will do.
667 # NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
669 # -a - append to the banner
670 # -e - send to stderr instead of stdout
671 # -n - no show banner (overrides -t)
672 # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
674 RPM_SCRIPTVERBOSITY=5 \
675 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
676 if [ -x /usr/bin/banner.sh ]; then \
677 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
679 CMD="cat%{-e: >&2}" \
681 eval $CMD %2%{?3: %3} \
684 # useradd/groupadd macros
685 # Author: Elan Ruusamäe <glen@pld-linux.org>
688 # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
689 # [-g initial_group] [-G group[,...]] login
692 # -g gid/group. REQUIRED
693 # -s defaults to /bin/false
694 # -d defaults to /usr/share/empty
696 # -r is accepted but ignored (it's always set)
697 # -k skeleton dir. defaults to /usr/share/empty
699 # -P package name. defaults to %{name}
701 %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
702 %{!-u:%{error:useradd: Required argument -u missing}} \
703 %{!-g:%{error:useradd: Required argument -g missing}} \
704 %{!?1:%{error:useradd: Required parameter login missing}} \
705 if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
706 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
707 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
711 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
712 /usr/sbin/useradd \\\
713 %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\
716 -d %{-d*}%{!-d:/usr/share/empty} \\\
717 -s %{-s*}%{!-s:/bin/false} \\\
718 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
722 %{expand:%{%{#}}} 1>&2 || exit $? \
723 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : \
727 # %groupadd [-P package] [-g gid] group
732 # %groupadd -P %{name}-base -g %{gid} %{name}
735 %{!-g:%{error:groupadd: Required argument -g missing}} \
736 %{!?1:%{error:groupadd: Required parameter group missing}} \
737 if [ -n "`/usr/bin/getgid %{1}`" ]; then \
738 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
739 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
743 echo "Adding group %{1} GID=%{-g*}." \
744 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
745 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : \
748 # apache_config_{install/uninstall} macros *DEPRECATED*
749 # Author: Elan Ruusamäe <glen@pld-linux.org>
751 # You should use webapp macros instead. these are here until single piece of
752 # them is gone from specs ;)
754 # The config is installed/removed inside trigger, this means that you can any
755 # time install apache1 or apache package and the configuration file is updated.
756 # if you don't need the config for various reason for specific apache, just
757 # remove the symlink from apache config directory. the trigger will not put the
758 # config again to that version of apache. In other words the config is linked
759 # to apache config directory on first install of PACKAGE or apache.
761 # should be called in trigger body:
762 # %triggerin -- apache1 >= 1.3.33-2
763 # %apache_config_install -v 1
765 # Add package's apache config to apache config.
768 # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
770 # -v REQUIRED: specify apache version. can be 1 or 2.
771 # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
772 # -n OPTIONAL: specify config "slot". defaults to 99
773 # -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers
775 # Internal macros. don't use ;).
776 # expands apache config dir by apache version at build time.
777 %__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)
778 # expands apache service name by apache version at build time.
779 %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi)
781 %apache_config_install(fv:c:n:) \
782 %{!-v:%{error:apache_config_install: Required argument -v missing}} \
783 %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
784 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\
785 ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\
787 # reload apache if the config symlink is there\
788 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\
789 # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \
790 if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\
791 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\
796 # Remove package's apache config from apache config.
799 # %apache_config_uninstall -v {1|2} -n 99
801 # -v REQUIRED: specify apache version. can be 1 or 2.
802 # -n OPTIONAL: specify config "slot". defaults to 99
803 %apache_config_uninstall(v:n:) \
804 %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \
805 %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
806 # remove link if either of the packages are gone \
807 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
808 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \
809 rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \
810 if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \
811 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \
818 # Author: Elan Ruusamäe <glen@pld-linux.org>
820 # The config is installed/removed inside trigger, this means that you can any
821 # time install apache1/apache/lighttpd package and the configuration file is
822 # updated. if you don't need the config for various reason for specific
823 # webserver, just remove the symlink from config directory using webapp
824 # program. the trigger will not recreate the symlink on upgrades. In other
825 # words the config is linked to webserver config directory on first install of
826 # PACKAGE or WEBSERVER.
828 # Add package's webserver config to webserver webapps dir.
830 # %webapp_register WEBSERVER WEBAPP
833 %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
834 if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
835 /usr/sbin/webapp register %1 %2\
837 # reload webserver if the config symlink is there and skip reload if webserver is upgraded\
838 if [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ] && [ "$2" -lt "2" ]; then\
839 %{expand:%service -q %%1 reload}\
843 # Remove package's config from webserver webapps dir.
845 # %webapp_register [-f] WEBSERVER WEBAPP
846 %webapp_unregister(f) \
847 %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
848 # remove link if either of the packages are gone \
849 if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ]; then \
850 /usr/sbin/webapp unregister %1 %2\
851 %{expand:%service -q %%1 reload}\
855 # see browser-plugins.spec / template-browser-plugin.spec
856 # Author: Elan Ruusamäe <glen@pld-linux.org>
857 %nsplugin_install(d:f) { \
858 # create link if it's first install of either of the packages \
859 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \
862 for file in %{*}; do \
863 echo echo Installing $file to %{-d*}; \
864 echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \
866 ) | ( %banner -t 5 -e %{name}-in ); fi; \
869 %nsplugin_uninstall(d:) { \
870 # remove link if either of the packages are gone \
871 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
874 for file in %{*}; do \
875 echo echo Removing $file from %{-d*}; \
876 echo "rm -f %{-d*}/$file;"; \
878 ) | ( %banner -t 5 -e %{name}-un ); fi; \
882 # Author: Elan Ruusamäe <glen@pld-linux.org>
884 # calls usual service restart on package %post, but skips the restart if
885 # administrator has disabled automatic service restarts in either global
886 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
889 # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
891 # -q be silent when service isn't started (for scriplets restaring other package's services)
893 %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
896 # java macros. based on jpackage macros.java
897 %_jvmdir %{_libdir}/jvm
898 %_jvmjardir %{_libdir}/jvm-exports
899 %_jvmprivdir %{_libdir}/jvm-private
900 %_jvmlibdir %{_libdir}/jvm
901 %_jvmdatadir %{_datadir}/jvm
902 %_jvmsysconfdir %{_sysconfdir}/jvm
903 # FIXME: are these used?
904 %_jvmcommonlibdir %{_libdir}/jvm-common
905 %_jvmcommondatadir %{_datadir}/jvm-common
906 %_jvmcommonsysconfdir %{_sysconfdir}/jvm-common
907 %_jnidir %{_libdir}/java
908 %java_home %(unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
910 %ant JAVA_HOME=%{java_home} ant
911 %jar %{java_home}/bin/jar
912 %java %(unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)
913 %javac %{java_home}/bin/javac
914 %javadoc %{java_home}/bin/javadoc
916 %add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir} %{_bindir}/jvmjar -l
919 install -d $RPM_BUILD_ROOT%{_bindir}\
920 cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \
924 # JPackage Project <http://www.jpackage.org/>\
926 # Source functions library\
927 . %{_javadir}-utils/java-functions\
929 # Source system prefs\
930 if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\
931 . %{_sysconfdir}/java/%{name}.conf\
935 if [ -f $HOME/.%{name}rc ]; then\
943 BASE_JARS="%(echo %4 | tr ':' ' ')"\
947 set_classpath $BASE_JARS\
948 set_flags $BASE_FLAGS\
949 set_options $BASE_OPTIONS\
955 # PEAR install macros
956 # Author: Elan Ruusamäe <glen@pld-linux.org>
959 # %%pear_package_setup [-a #] [-n FMT]
961 # -a # - also unpack SOURCE#. for PEAR bootstrapping
962 # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
963 # -z - unpack pear package and let pear use package.xml (not tarball) for install. for PEAR bootstrapping
965 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
966 # destination hierarchy. you should copy the tree to buildroot after
967 # patching/reorganizing with %%pear_package_install.
969 # additionally BUILDROOT is stripped from files and files are converted to UNIX
972 # the pear install process output is recorded to install.log, you should put it
973 # to %%doc for later debug or just for information.
975 # additionally additional-packages.txt is produced if it was detected that the
976 # package has optional dependencies. the file format is suitable of displaying
977 # in %%post of a package. you should put this file to %%doc. noautocompressdoc is
978 # automatically added for this file.
981 # records install.log and transforms PEAR names to PLD Linux rpm package names.
982 %__pear_install_log \
984 # make post message of optional packages \
985 grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
986 if [ -s optional-packages.txt ]; then \
987 awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
989 rm -f optional-packages.txt \
993 # command invoking pear cli
994 %__pear /usr/bin/pear
997 # using this macro will append optional-packages.txt to the nocompressdoc list
998 # as it's displayed to user after package install. and adding additional gzip
999 # dep is just waste ;)
1000 %pear_package_setup(a:n:z) \
1001 %define srcdir %{-n*}%{!-n:%{_pearname}-%{version}} \
1002 %define builddir %{_builddir}/%{srcdir} \
1003 %setup -q -c -T -n %{srcdir} \
1004 %{-z:tar zxf %{S:0}; %{-a:tar zxf %{S:%{-a*}}}} \
1005 %{-z:_P=package2.xml; [ -f $_P ] || _P=package.xml; _N=%{srcdir}; mv $_P $_N; cd $_N} \
1008 -d doc_dir=/docs \\\
1009 -d php_dir=%{php_pear_dir} \\\
1010 -d bin_dir=%{_bindir} \\\
1011 -d data_dir=%{php_pear_dir}/data \\\
1012 -d test_dir=%{php_pear_dir}/tests \\\
1014 --packagingroot=%{builddir} \\\
1018 %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$_P} > .install.log || { c=$?; cat .install.log; exit $c; } \
1020 cat %{-z:$_N/}.install.log | %__pear_install_log \
1023 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
1024 %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \
1025 %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \
1028 # copies exctracted PEAR package structure to buildroot.
1029 # also copies PEAR registry file.
1030 # please use this macro, for future extensions being possible.
1031 %pear_package_install() \
1032 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
1033 find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
1034 # help the developer out a little: \
1035 if [ -f _noautoreq ]; then \
1036 echo "AutoReqdep detected:" \
1037 echo "_noautoreq $(cat _noautoreq)" \
1042 # Register OpenLDAP schema.
1043 # Author: Elan Ruusamäe <glen@pld-linux.org>
1046 # %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
1048 # -d specify dependant schemas, separated by comma
1050 %openldap_schema_register(d:) \
1051 for schema in %*; do \
1052 if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
1054 /^include.*local.schema/{ \
1055 iinclude\\t $schema\
1057 " /etc/openldap/slapd.conf \
1060 # enable dependant schemas \
1061 if [ "%{-d*}" ]; then \
1063 /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 's/,/\\\\|/g')\\)\\.schema/{ \
1065 }' /etc/openldap/slapd.conf \
1069 # Unregister OpenLDAP schema.
1070 # Author: Elan Ruusamäe <glen@pld-linux.org>
1073 # %%openldap_schema_unregister %{schemadir}/horde.schema
1075 %openldap_schema_unregister() \
1076 for schema in %*; do \
1077 if grep -q "$schema" /etc/openldap/slapd.conf; then \
1079 /^include.*$(echo "$schema" | %{__sed} -e 's,/,\\\\/,g')/d \
1080 # for symmetry it would be nice if we disable enabled schemas in post, \
1081 # but we really can not do that, it would break something else. \
1082 " /etc/openldap/slapd.conf \
1087 %env_update [ ! -x /sbin/env-update ] || /sbin/env-update -u || :
1090 # Build modules for kernels 2.6
1091 # Author: Przemyslaw Iskra <sparky@pld-linux.org>
1094 # %build_kernel_modules -m <modules> -C <directory>
1096 # remember that proper Makefile is still required
1098 # -m <modules> (required) -- comma-separated list of modules to save,
1099 # without .ko extension, may be placed in subdirectory
1100 # -C <directory> -- change to <directory> before doing anything
1101 # -p <arg>, -P <arg> -- arguments passeed to make scripts
1102 # -c -- do not execute make clean
1103 # <additional arguments> -- all additional arguments will be passed to
1106 # Additional patching supported via here document. Try:
1107 # %build_kernel_modules -m module <<'EOF'
1108 # your patch script here
1110 # Don't use it unless patching depends on config options.
1112 # Developer note: don't touch it unless you know how to handle '\'.
1113 # - \ in script expands to nothing
1114 # - \\\ in script expands to \
1115 # - \\\ inside definition expands to noting
1116 # - \\\\\\\ inside definition expands to \
1117 # - in last line \ has to touch arguments so arguments passing
1118 # in new lines (using \) will be supported
1120 %build_kernel_modules(p:P:m:C:c) \
1121 %{!?-m:%{error:%{0}: Required module name/list missing} exit 1} \
1123 %define Opts \\\\\\\
1124 %if "%{_target_base_arch}" != "%{_arch}" \\\
1125 %if "%{_arch}" == "x86_64" && "%{_target_base_arch}" == "i386" \\\
1126 CC="%{__cc}" CPP="%{__cpp}" ARCH=%{_target_base_arch} \\\
1128 ARCH=%{_target_base_arch} CROSS_COMPILE=%{_target_cpu}-pld-linux- \\\
1131 CC="%{__cc}" CPP="%{__cpp}" \\\
1133 %define MakeOpts HOSTCC="%{__cc}" SYSSRC=%{_kernelsrcdir} SYSOUT=$PWD/o \\\\\\\
1134 O=$PWD/o %{?with_verbose:V=1} %{Opts} \
1138 L="<"; [[ '%{*}' != *$L$L* ]] || PATCH_SH="set -x -e;$(cat)" \
1141 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do \
1142 [ -r "%{_kernelsrcdir}/config-$cfg" ] || exit 1 \
1145 install -d o/include/linux \
1146 ln -sf %{_kernelsrcdir}/config-$cfg o/.config \
1147 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers \
1148 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h \
1151 [ -z "$PATCH_SH" ] || echo "$PATCH_SH" | %__spec_build_shell \
1154 %if %{with dist_kernel} \
1155 %{__make} -j1 -C %{_kernelsrcdir} prepare scripts \\\
1159 install -d o/include/config \
1160 touch o/include/config/MARKER \
1161 ln -sf %{_kernelsrcdir}/scripts o/scripts \
1164 %{!?-c:%{__make} -C %{_kernelsrcdir} clean \\\
1165 RCS_FIND_IGNORE="-name '*.ko' -o" \\\
1166 M=$PWD %{MakeOpts}} \
1167 %{__make} -C %{_kernelsrcdir} modules \\\
1169 M=$PWD %{MakeOpts} \
1171 for MODULE in {%{-m*},}; do \
1172 [ -z "${MODULE}" ] || mv ${MODULE}{,-$cfg}.ko \
1181 # Install kernel modules built by %build_kernel_modules
1182 # Author: Przemyslaw Iskra <sparky@pld-linux.org>
1185 # %install_kernel_modules -m <modules> -d <directory>
1188 # -m <modules> (required) -- comma-separated list of modules to install,
1189 # without .ko extension, may be placed in subdirectory
1190 # -d <directory> (required) -- in what subdirectory modules should be
1191 # installed (eg. misc, kernel/drivers/net)
1192 # -s <suffix> -- suffix to use when installing modules, useful when module
1193 # with same name exists in kernel already
1194 # -n <file> -- name of modprobe config file to use (without .conf extension)
1195 # for definig aliases, only useful with -s
1197 %install_kernel_modules(m:d:s:n:) \
1198 %{!?-m:%{error:%{0}: Required module name (-m) missing}exit 1} \
1199 %{!?-d:%{error:%{0}: Required module directory missing}exit 1} \
1200 %{?-n:%{!?-s:%{error:%{0}: Modprobe .conf file requires module suffix}exit 1}} \
1202 %define KernelD $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver} \
1203 %define ModprobeD $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver} \
1205 install -d %{KernelD}{,smp}/%{-d*} \
1206 %{?-s:install -d %{ModprobeD}{,smp}} \
1208 for MODULE in {%{-m*},}; do \
1209 [ -n "${MODULE}" ] || continue \
1210 MNAME=${MODULE##*/} \
1211 install ${MODULE}-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \\\
1212 %{KernelD}/%{-d*}/${MNAME}%{-s:-%{-s*}}.ko \
1213 %{?-s:echo "alias ${MNAME} ${MNAME}-%{-s*}" \\\
1214 >> %{ModprobeD}/%{-n*}.conf} \
1215 %if %{with smp} && %{with dist_kernel} \
1216 install ${MODULE}-smp.ko \\\
1217 %{KernelD}smp/%{-d*}/${MNAME}%{-s:-%{-s*}}.ko \
1218 %{?-s:echo "alias ${MNAME} ${MNAME}-%{-s*}" \\\
1219 >> %{ModprobeD}smp/%{-n*}.conf} \
1224 # vim:ts=4 sw=4 noet syn=spec