3 %_defaultdocdir %{_usr}/share/doc
4 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@
6 %_topdir %(echo $HOME)/rpm
7 %_exec_prefix %{_prefix}
8 %_bindir %{_exec_prefix}/bin
9 %_sbindir %{_exec_prefix}/sbin
10 %_libexecdir %{_exec_prefix}/lib
11 %_datadir %{_prefix}/share
12 %_sharedstatedir %{_prefix}/com
14 %_libdir %{_exec_prefix}/%{_lib}
15 %_includedir %{_prefix}/include
16 %_oldincludedir /usr/include
19 %_infodir /usr/share/info
20 %_mandir %{_prefix}/share/man
21 #-----------------------------------------------------------------
22 # CFLAGS and LDFLAGS used to build
25 %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}
26 %rpmldflags %{!?debug:-s}
32 #-----------------------------------------------------------------
33 # Build system path macros.
35 %__libtoolize libtoolize --copy --force
37 if ! gettextize --version | grep -q '0\.10\.' ; then \
38 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
39 gettextize --copy --force --no-changelog; \
41 gettextize --copy --force --no-changelog --intl; \
43 if [ ! -f po/Makevars ]; then \
44 cp -f po/Makevars{.template,}; \
47 gettextize --copy --force; \
50 %__autopoint autopoint --force
51 %__automake automake -a -c -f --foreign
52 %__autoconf autoconf %{?debug:-Wall}
54 #-----------------------------------------------------------------
56 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
57 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
58 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
59 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; 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} \
81 #----------------------------------------------------------------
82 %configure {./configure \
83 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
84 CFLAGS="${CFLAGS:-%rpmcflags}" \
85 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
86 FFLAGS="${FFLAGS:-%rpmcflags}" \
87 CPPFLAGS="${CPPFLAGS:-}" \
89 %{?__cxx:CXX=%{__cxx}} \
90 --build=%{_target_platform} \
92 --exec-prefix=%{_exec_prefix} \
94 --sbindir=%{_sbindir} \
95 --sysconfdir=%{_sysconfdir} \
96 --datadir=%{_datadir} \
97 --includedir=%{_includedir} \
99 --libexecdir=%{_libexecdir} \
100 --localstatedir=%{_localstatedir} \
101 --sharedstatedir=%{_sharedstatedir} \
102 --mandir=%{_mandir} \
103 --infodir=%{_infodir} \
106 # Location of autoconf macros
107 %_aclocaldir %(aclocal --print-ac-dir)
109 # Location of omf files
110 %_omf_dest_dir %(scrollkeeper-config --omfdir)
112 # Location of pkgconfig files
113 %_pkgconfigdir /usr/lib/pkgconfig
115 # Location of top applink dir
116 %_applnkdir /usr/X11R6/share/applnk
118 # Location of desktop files
119 %_desktopdir /usr/X11R6/share/applications
121 # Location of pixmaps for applnk/desktop files
122 %_pixmapsdir /usr/X11R6/share/pixmaps
124 # Location of themable icons for applnk/desktop files
125 %_iconsdir /usr/X11R6/share/icons
127 # Location of fonts directories
128 %_fontsdir /usr/share/fonts
130 # Location of Gtk and associated libraries documentation
131 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
134 %date %(LC_ALL="C" date +"%a %b %d %Y")
137 %tmpdir %(echo "${TMPDIR:-/tmp}")
139 # Example files, programs, scripts...
140 %_examplesdir /usr/src/examples
142 # The directory holding Linux kernel sources
143 %_kernelsrcdir /usr/src/linux
145 # XMMS specific macros
146 %xmms_prefix %(echo `xmms-config --prefix`)
147 %xmms_exec_prefix %(echo `xmms-config --exec-prefix`)
148 %xmms_version %(echo `xmms-config --version`)
149 %xmms_datadir %(echo `xmms-config --data-dir`)
150 %xmms_plugindir %(echo `xmms-config --plugin-dir`)
151 %xmms_visualization_plugindir %(echo `xmms-config --visualization-plugin-dir`)
152 %xmms_input_plugindir %(echo `xmms-config --input-plugin-dir`)
153 %xmms_output_plugindir %(echo `xmms-config --output-plugin-dir`)
154 %xmms_effect_plugindir %(echo `xmms-config --effect-plugin-dir`)
155 %xmms_general_plugindir %(echo `xmms-config --general-plugin-dir`)
157 # If non-empty "debug" macro defined, add "dbg" suffix to release number
158 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
160 # requires name = version-release
161 %requires_releq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}-%%{RELEASE}' %1| grep -v "is not")
162 %requires_kernel_releq() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
163 %requires_releq_kernel_up() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-up = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
164 %requires_releq_kernel_smp() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-smp = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
165 %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")
167 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' `apr-config --includedir`/ap_mmn.h)
169 # kernel version-release handling
170 %__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
171 %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not")
172 %_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
173 %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
176 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog
177 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog
178 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
179 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1
180 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null
181 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null
182 %docbook_sgmlcat_fix() { for l in \
184 ' -- default decl --' \
185 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
186 ' -- hacks for opensp --' \
187 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
188 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
190 ; do echo $l; done >> %1 \
193 #-----------------------------------------------------------------
194 # Update all GConf2 schemas
198 %gconf_schema_install { umask 022; \
199 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \
200 /usr/bin/gconftool-2 --makefile-install-rule \
201 /etc/gconf/schemas/*.schemas > /dev/null \
204 #-----------------------------------------------------------------
205 # find and gzip all files in %{_mandir} and %{infodir}
207 # Requires: xargs, find
209 #%no_install_post_compress_docs 1
210 %__spec_install_post_compress_docs { \
211 echo "Compress man and info pages."; \
212 %{!?no_install_post_compress_docs: \
213 %{?verbose:set -x;} \
214 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
215 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
216 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
217 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
218 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
223 #-----------------------------------------------------------------
224 # Strip executable binaries and shared object files
226 # Requires: find, awk, strip, cut, xargs
228 #%no_install_post_strip 1
229 %__spec_install_post_strip {%{!?debug: \
230 %{!?no_install_post_strip: \
231 %{?verbose:set -x;} \
232 echo "Strip executable binaries and shared object files."; \
233 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
234 elfexelist=`echo $filelist | xargs -r file | \
235 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
236 elfsharedlist=`echo $filelist | xargs -r file | \
237 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
238 if [ -n "$elfexelist" ]; then \
239 strip --remove-section=.note --remove-section=.comment $elfexelist; \
241 if [ -n "$elfsharedlist" ]; then \
242 strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
245 #-----------------------------------------------------------------
246 # remove all RPATH from executable binaries and shared object files
248 # Requires: find, awk, cut, xargs, chrpath, uname
250 #%no_install_post_chrpath 1
251 %__spec_install_post_chrpath {%{!?debug: \
252 %{!?no_install_post_chrpath: \
253 %{?verbose:set -x;} \
254 echo "Remove RPATH from executable binaries and shared object files."; \
255 if [ "$(uname -m)" != alpha ] ; then \
256 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" | xargs -r file | \
257 awk '/ELF.*(executable|shared object)/ {print $1}' | cut -d: -f1 | \
258 while read file ; do \
261 for dir in `chrpath -l "$file" | \
262 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
264 /home/* | /tmp/* | /usr/lib | /lib | /usr/local/lib | /usr/X11R6/lib ) \
265 echo "remove-rpath: $dir in $file"; \
268 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
269 else rpath="$rpath:$dir" ; fi ; \
273 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
274 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
277 #-----------------------------------------------------------------
278 # Find and gzip all kernel modules
282 #%no_install_post_compress_modules 1
283 %__spec_install_post_compress_modules { \
284 %{!?no_install_post_compress_modules: \
285 echo "Compress kernel modules if any."; \
286 %{?verbose:set -x;} \
287 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
288 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \
289 xargs -r %{__gzip} -9nf; \
290 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \
291 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
295 %_source_payload w9.gzdio
296 %_binary_payload w9.bzdio
298 #-----------------------------------------------------------------
299 # post %install sequence:
300 # - autodeps exceptions
301 # - compress all man and info pages,
302 # - strip all ELF executables and ELF shared objects if not %debug.
304 ###################################################################
305 # Requires/Provides automation
306 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
309 %{?_noautoreqfiles:_autoreqprov=y}\
310 %{?_noautoreq:_autoreqprov=y}\
311 %{?_noautoreqdep:_autoreqprov=y}\
312 %{?_noautoprovfiles:_autoreqprov=y}\
313 %{?_noautoprov:_autoreqprov=y}\
314 %{?_noautocompressdoc:_autoreqprov=y}\
315 if [ "$_autoreqprov" = "y" ] ; then \
316 if [ -f %{_builddir}/__rpm_lock ] ; then \
317 echo "Some package using \%_noauto* macros is already being built" >&2 \
318 echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
321 rm -f %{_builddir}/__rpm_*\
322 touch %{_builddir}/__rpm_lock \
325 %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
330 %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
331 %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
332 %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
333 %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
334 %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
335 %{__spec_install_post_strip}\
336 %{__spec_install_post_chrpath}\
337 %{__spec_install_post_compress_docs}\
338 %{__spec_install_post_compress_modules}\
339 %{__arch_install_post}\
342 %__spec_clean_pre %{___build_pre}\
344 %{?_noautoreqfiles:_autoreqprov=y}\
345 %{?_noautoreq:_autoreqprov=y}\
346 %{?_noautoreqdep:_autoreqprov=y}\
347 %{?_noautoprovfiles:_autoreqprov=y}\
348 %{?_noautoprov:_autoreqprov=y}\
349 %{?_noautoreqfiles:_autoreqprov=y}\
350 %{?_noautocompressdoc:_autoreqprov=y}\
351 if [ "$_autoreqprov" = "y" ] ; then \
352 rm -f %{_builddir}/__rpm_* \
357 #%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*"
359 #%_noautoreqdep %{nil}
360 #%_noautoprovfiles %{nil}
365 if [ -e /boot/System.map-%1 ]; then \
366 /sbin/depmod -a -F /boot/System.map-%1 %1; \
368 if [ -e /boot/System.map ]; then \
369 /sbin/depmod -a -F /boot/System.map %1; \
371 /sbin/depmod -a %1; \
376 # ------------------------------------------------------------------------
377 # Conditional build stuff.
379 # Check if symbol is defined.
380 # Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
381 %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
382 %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
384 # Shorthand for %{defined with_...}
385 %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
386 %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
388 # Handle conditional builds. %bcond_with is for case when feature is
389 # default off and needs to be activated with --with ... command line
390 # switch. %bcond_without is for the dual case.
392 # %bcond_with foo defines symbol with_foo if --with foo was specified on
394 # %bcond_without foo defines symbol with_foo if --without foo was *not*
395 # specified on command line.
399 # %bcond_with extra_fonts
400 # %bcond_without static
401 # %ifdef with_extra_fonts
407 # %{?with_static: ... }
408 # %{!?with_static: ... }
409 # %{?with_extra_fonts: ... }
410 # %{!?with_extra_fonts: ... }
412 # The bottom line: never use without_foo, _with_foo nor _without_foo, only
413 # with_foo. This way changing default set of bconds for given spec is just
414 # a matter of changing single line in it and syntax is more readable.
415 %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
416 %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
417 # ------------------------------------------------------------------------