4 %_enable_debug_packages 1
8 %__chown_Rhf @__CHOWN_RHF@
9 %__chgrp_Rhf @__CHGRP_RHF@
11 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root:@ROOT_GROUP@
13 %_fixperms %{__chmod} -Rf @FIXPERMS@
14 %_topdir %(echo $HOME)/rpm
15 #-----------------------------------------------------------------
16 # CFLAGS and LDFLAGS used to build
18 %if %{_enable_debug_packages}%{!?_enable_debug_packages:0}
19 %debuginfocflags -ggdb
22 %debugcflags -O0 -g -Wall
23 %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags:%debuginfocflags}
30 # Build system path macros.
32 %__libtoolize libtoolize --copy --force
34 if ! gettextize --version | grep -q '0\.10\.' ; then \
35 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
36 gettextize --copy --force --no-changelog; \
38 gettextize --copy --force --no-changelog --intl; \
40 if [ ! -f po/Makevars ]; then \
41 cp -f po/Makevars{.template,}; \
44 gettextize --copy --force; \
47 %__autopoint autopoint --force
48 %__automake automake -a -c -f --foreign
49 %__autoconf autoconf %{?debug:-Wall}
51 #-----------------------------------------------------------------
53 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
54 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
55 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
56 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
57 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
58 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
59 %{?__cc:CC="%{__cc}" ; export CC ; } \
60 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
61 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
62 --host=%{_target_platform} \
64 --exec-prefix=%{_exec_prefix} \
66 --sbindir=%{_sbindir} \
67 --sysconfdir=%{_sysconfdir} \
68 --datadir=%{_datadir} \
69 --includedir=%{_includedir} \
71 --libexecdir=%{_libexecdir} \
72 --localstatedir=%{_localstatedir} \
73 --sharedstatedir=%{_sharedstatedir} \
75 --infodir=%{_infodir} \
76 --x-libraries=/usr/X11R6/%{_lib} \
79 #----------------------------------------------------------------
80 %configure {./configure \
81 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
82 CFLAGS="${CFLAGS:-%rpmcflags}" \
83 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
84 FFLAGS="${FFLAGS:-%rpmcflags}" \
85 CPPFLAGS="${CPPFLAGS:-}" \
86 %{?__cc:CC="%{__cc}"} \
87 %{?__cxx:CXX="%{__cxx}"} \
88 --build=%{_target_platform} \
90 --exec-prefix=%{_exec_prefix} \
92 --sbindir=%{_sbindir} \
93 --sysconfdir=%{_sysconfdir} \
94 --datadir=%{_datadir} \
95 --includedir=%{_includedir} \
97 --libexecdir=%{_libexecdir} \
98 --localstatedir=%{_localstatedir} \
99 --sharedstatedir=%{_sharedstatedir} \
100 --mandir=%{_mandir} \
101 --infodir=%{_infodir} \
102 --x-libraries=/usr/X11R6/%{_lib} \
105 # ------------------------------------------------------------------------
106 # Overloading of some basic macros
120 %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
127 # ------------------------------------------------------------------------
128 # Conditional build stuff.
130 # Check if symbol is defined.
131 # Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
132 %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
133 %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
135 # Shorthand for %{defined with_...}
136 %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
137 %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
139 # Handle conditional builds. %bcond_with is for case when feature is
140 # default off and needs to be activated with --with ... command line
141 # switch. %bcond_without is for the dual case.
143 # %bcond_with foo defines symbol with_foo if --with foo was specified on
145 # %bcond_without foo defines symbol with_foo if --without foo was *not*
146 # specified on command line.
150 # %bcond_with extra_fonts
151 # %bcond_without static
152 # %if %{with extra_fonts}
155 # %ifdef %{with static}
158 # %{?with_static: ... }
159 # %{!?with_static: ... }
160 # %{?with_extra_fonts: ... }
161 # %{!?with_extra_fonts: ... }
163 # The bottom line: never use without_foo, _with_foo nor _without_foo, only
164 # with_foo. This way changing default set of bconds for given spec is just
165 # a matter of changing single line in it and syntax is more readable.
166 %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
167 %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
168 # ------------------------------------------------------------------------
170 # Location of autoconf macros
171 %_aclocaldir %(aclocal --print-ac-dir)
173 # Location of omf files
174 %_omf_dest_dir %(scrollkeeper-config --omfdir)
176 # Location of pkgconfig files
177 %_pkgconfigdir /usr/%{_lib}/pkgconfig
179 # Location of top applink dir
180 %_applnkdir /usr/X11R6/share/applnk
182 # Location of desktop files
183 %_desktopdir /usr/share/applications
185 # Location of pixmaps for applnk/desktop files
186 %_pixmapsdir /usr/share/pixmaps
188 # Location of themable icons for applnk/desktop files
189 %_iconsdir /usr/share/icons
191 # Location of fonts directories
192 %_fontsdir /usr/share/fonts
194 # Location of Gtk and associated libraries documentation
195 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
197 # Location of KDE documentation
198 %_kdedocdir %{_defaultdocdir}/kde/HTML
201 %date %(LC_ALL="C" date +"%a %b %d %Y")
204 %tmpdir %(echo "${TMPDIR:-/tmp}")
206 # Example files, programs, scripts...
207 %_examplesdir /usr/src/examples
209 # The directory holding Linux kernel sources
210 %_kernelsrcdir /usr/src/linux
212 # If non-empty "debug" macro defined, add "dbg" suffix to release number
213 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
215 # Requires name = version-release
216 %requires_releq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
217 %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'Prereq: kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -vE "(is not|no such)")
218 %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'Prereq: kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -vE "(is not|no such)")
219 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
221 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
223 # kernel version-release handling
224 %__kernel_ver %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } END { printf("%d.%d.%d", ver, plev, slev); }' %{_kernelsrcdir}/Makefile 2> /dev/null))
225 %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not")
226 %_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
227 %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
230 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog
231 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog
232 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
233 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1
234 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null
235 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null
236 %docbook_sgmlcat_fix() { for l in \
238 ' -- default decl --' \
239 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
240 ' -- hacks for opensp --' \
241 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
242 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
244 ; do echo $l; done >> %1 \
247 #-----------------------------------------------------------------
248 # find and gzip all files in %{_mandir} and %{infodir}
250 # Requires: xargs, find
252 #%no_install_post_compress_docs 1
253 %__spec_install_post_compress_docs { \
254 %{!?no_install_post_compress_docs: \
255 echo "Compress man and info pages."; \
256 %{?verbose:set -x;} \
257 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
258 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
259 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
260 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
261 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
266 #-----------------------------------------------------------------
267 # Strip executable binaries and shared object files
269 # Requires: find, awk, strip, cut, xargs
271 #%no_install_post_strip 1
272 %__spec_install_post_strip {%{!?debug: \
273 %{!?no_install_post_strip: \
274 %{?verbose:set -x;} \
275 if [ -d "$RPM_BUILD_ROOT" ]; then \
276 echo "Strip executable binaries, archives and shared object files."; \
277 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
278 elfexelist=`echo $filelist | xargs -r file | \
279 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
280 elfsharedlist=`echo $filelist | xargs -r file | \
281 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
282 elfarchiveslist=`echo $filelist | xargs -r file | \
283 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
284 if [ -n "$elfexelist" ]; then \
285 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
287 if [ -n "$elfsharedlist" ]; then \
288 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
290 if [ -n "$elfarchiveslist" ]; then \
291 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
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: \
303 %{?verbose:set -x;} \
304 if [ -d "$RPM_BUILD_ROOT" ]; then \
305 echo "Remove RPATH from executable binaries and shared object files."; \
306 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
307 awk '/ELF.*(executable|shared object)/ {print $1}' | cut -d: -f1 | \
308 while read file ; do \
311 for dir in `chrpath -l "$file" | \
312 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
314 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
315 echo "remove-rpath: $dir in $file"; \
318 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
319 else rpath="$rpath:$dir" ; fi ; \
323 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
324 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
328 #-----------------------------------------------------------------
329 # Find and gzip all kernel modules
333 #%no_install_post_compress_modules 1
334 %__spec_install_post_compress_modules { \
335 %{!?no_install_post_compress_modules: \
336 %{?verbose:set -x;} \
337 if [ -d "$RPM_BUILD_ROOT" ]; then \
338 echo "Compress kernel modules if any."; \
339 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
340 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
341 xargs -r %{__gzip} -9nf; \
342 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
343 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
348 %_source_payload w9.gzdio
349 %_binary_payload w9.bzdio
351 #-----------------------------------------------------------------
352 # Update all GConf2 schemas
356 %gconf_schema_install { umask 022; \
357 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \
358 /usr/bin/gconftool-2 --makefile-install-rule \
359 /etc/gconf/schemas/*.schemas > /dev/null \
362 #-----------------------------------------------------------------
363 # post %install sequence:
364 # - autodeps exceptions
365 # - compress all man and info pages,
366 # - strip all ELF executables and ELF shared objects if not %debug.
367 # - compress kernel modules if any
369 ###################################################################
370 # Requires/Provides automation
371 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
373 %_noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)
374 %_noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)
375 %_noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)
376 %_noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)
377 %_noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)
378 #%_noautocompressdoc %{nil}
380 %_missing_doc_files_terminate_build 1%{nil}
381 %_unpackaged_files_terminate_build %{nil}
383 %___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;}'
384 %_emacs_lispdir %(emacs %___emacs_lispdir_helper)
385 %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
387 %__php_provides %{nil}
388 %__php_requires %{nil}
389 %__perl_provides %{nil}
390 %__perl_requires %{nil}
392 # Perl specific macro definitions.
393 %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
394 %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
395 %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
396 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
397 %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
398 %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
400 %php_pear_dir %{_datadir}/pear
402 # Python specific macro definitions.
403 # python main version
404 %py_ver %(echo `python -c "import sys; print sys.version[:3]"`)
407 %py_prefix %(echo `python -c "import sys; print sys.prefix"`)
408 %py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
409 %py_scriptdir %{py_prefix}/share/python%{py_ver}
410 %py_incdir /usr/include/python%{py_ver}
411 %py_sitedir %{py_libdir}/site-packages
412 %py_sitescriptdir %{py_scriptdir}/site-packages
413 %py_dyndir %{py_libdir}/lib-dynload
415 # pure python modules compilation
416 %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
418 %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
420 # Software written in Python language require Python with main version
422 %pyrequires_eq() Requires: %1 >= 1:%py_ver %1 < 1:%(echo `python -c "import sys; import string; ver=sys.version[:3].split('.'); ver[1]=str(int(ver[1])+1); print string.join(ver, '.')"`)
426 if [ -e /boot/System.map-%1 ]; then \
427 /sbin/depmod -a -F /boot/System.map-%1 %1; \
429 if [ -e /boot/System.map ]; then \
430 /sbin/depmod -a -F /boot/System.map %1; \
432 /sbin/depmod -a %1; \
437 # XMMS specific macros
438 %xmms_prefix %(xmms-config --prefix)
439 %xmms_exec_prefix %(xmms-config --exec-prefix)
440 %xmms_version %(xmms-config --version)
441 %xmms_datadir %(xmms-config --data-dir)
442 %xmms_plugindir %(xmms-config --plugin-dir)
443 %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir)
444 %xmms_input_plugindir %(xmms-config --input-plugin-dir)
445 %xmms_output_plugindir %(xmms-config --output-plugin-dir)
446 %xmms_effect_plugindir %(xmms-config --effect-plugin-dir)
447 %xmms_general_plugindir %(xmms-config --general-plugin-dir)
449 %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/')