]> git.pld-linux.org Git - packages/rpm.git/blame_incremental - rpm.macros
- fix static subpackage Requires
[packages/rpm.git] / rpm.macros
... / ...
CommitLineData
1# PLD rpm macros
2
3%__id @__ID@
4%__id_u %{__id} -u
5%__chown_Rhf @__CHOWN_RHF@
6%__chgrp_Rhf @__CHGRP_RHF@
7
8%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@
9%_fixgroup true
10%_fixperms %{__chmod} -Rf @FIXPERMS@
11%_topdir %(echo $HOME)/rpm
12%_exec_prefix %{_prefix}
13%_bindir %{_exec_prefix}/bin
14%_sbindir %{_exec_prefix}/sbin
15%_libexecdir %{_exec_prefix}/lib
16%_datadir %{_prefix}/share
17%_sharedstatedir /var/lib
18%_lib lib
19%_libdir %{_exec_prefix}/%{_lib}
20%_includedir %{_prefix}/include
21%_oldincludedir /usr/include
22%_sysconfdir /etc
23%_localstatedir /var
24%_infodir /usr/share/info
25%_mandir %{_prefix}/share/man
26%_defaultdocdir %{_usr}/share/doc
27#-----------------------------------------------------------------
28# CFLAGS and LDFLAGS used to build
29
30%debugcflags -O0 -g -Wall
31%rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}
32%rpmldflags %{!?debug:-s}
33
34# kernel compiler
35%kgcc gcc
36%kgcc_package gcc
37
38# Build system path macros.
39#
40%__libtoolize libtoolize --copy --force
41%__gettextize { \
42 if ! gettextize --version | grep -q '0\.10\.' ; then \
43 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
44 gettextize --copy --force --no-changelog; \
45 else \
46 gettextize --copy --force --no-changelog --intl; \
47 fi; \
48 if [ ! -f po/Makevars ]; then \
49 cp -f po/Makevars{.template,}; \
50 fi; \
51 else \
52 gettextize --copy --force; \
53 fi; \
54}
55%__autopoint autopoint --force
56%__automake automake -a -c -f --foreign
57%__autoconf autoconf %{?debug:-Wall}
58
59#-----------------------------------------------------------------
60%configure2_13 { \
61 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
62 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
63 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
64 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
65 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
66 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
67 %{?__cc:CC=%{__cc} ; export CC ; } \
68 %{?__cxx:CXX=%{__cxx} ; export CXX ; } \
69 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
70 --host=%{_target_platform} \
71 --prefix=%{_prefix} \
72 --exec-prefix=%{_exec_prefix} \
73 --bindir=%{_bindir} \
74 --sbindir=%{_sbindir} \
75 --sysconfdir=%{_sysconfdir} \
76 --datadir=%{_datadir} \
77 --includedir=%{_includedir} \
78 --libdir=%{_libdir} \
79 --libexecdir=%{_libexecdir} \
80 --localstatedir=%{_localstatedir} \
81 --sharedstatedir=%{_sharedstatedir} \
82 --mandir=%{_mandir} \
83 --infodir=%{_infodir} \
84}
85
86#----------------------------------------------------------------
87%configure {./configure \
88 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
89 CFLAGS="${CFLAGS:-%rpmcflags}" \
90 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
91 FFLAGS="${FFLAGS:-%rpmcflags}" \
92 CPPFLAGS="${CPPFLAGS:-}" \
93 %{?__cc:CC=%{__cc}} \
94 %{?__cxx:CXX=%{__cxx}} \
95 --build=%{_target_platform} \
96 --prefix=%{_prefix} \
97 --exec-prefix=%{_exec_prefix} \
98 --bindir=%{_bindir} \
99 --sbindir=%{_sbindir} \
100 --sysconfdir=%{_sysconfdir} \
101 --datadir=%{_datadir} \
102 --includedir=%{_includedir} \
103 --libdir=%{_libdir} \
104 --libexecdir=%{_libexecdir} \
105 --localstatedir=%{_localstatedir} \
106 --sharedstatedir=%{_sharedstatedir} \
107 --mandir=%{_mandir} \
108 --infodir=%{_infodir} \
109}
110
111# Location of autoconf macros
112%_aclocaldir %(aclocal --print-ac-dir)
113
114# Location of omf files
115%_omf_dest_dir %(scrollkeeper-config --omfdir)
116
117# Location of pkgconfig files
118%_pkgconfigdir /usr/lib/pkgconfig
119
120# Location of top applink dir
121%_applnkdir /usr/X11R6/share/applnk
122
123# Location of desktop files
124%_desktopdir /usr/share/applications
125
126# Location pixmaps for applnk/desktop files
127%_pixmapsdir /usr/share/pixmaps
128
129# Location of fonts directories
130%_fontsdir /usr/share/fonts
131
132# Location of Gtk and associated libraries documentation
133%_gtkdocdir %{_defaultdocdir}/gtk-doc/html
134
135# Current date
136%date %(LC_ALL="C" date +"%a %b %d %Y")
137
138# tmp directory
139%tmpdir %(echo "${TMPDIR:-/tmp}")
140
141# Example files, programs, scripts...
142%_examplesdir /usr/src/examples
143
144# The directory holding Linux kernel sources
145%_kernelsrcdir /usr/src/linux
146
147# If non-empty "debug" macro defined, add "dbg" suffix to release number
148%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
149
150# Requires name = version-release
151%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")
152%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)")
153%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)")
154
155# kernel version-release handling
156%__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
157%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not")
158%_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
159%_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
160
161# sgml macros
162%xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog
163%xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog
164%xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
165%xmlcat_create() /usr/bin/xmlcatalog --noout --create %1
166%sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null
167%sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null
168%docbook_sgmlcat_fix() { for l in \
169'' \
170' -- default decl --' \
171'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
172' -- hacks for opensp --' \
173'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
174'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
175'' \
176; do echo $l; done >> %1 \
177}
178
179#-----------------------------------------------------------------
180# find and gzip all files in %{_mandir} and %{infodir}
181#
182# Requires: xargs, find
183#
184#%no_install_post_compress_docs 1
185%__spec_install_post_compress_docs { \
186echo "Compress man and info pages."; \
187%{!?no_install_post_compress_docs: \
188 %{?verbose:set -x;} \
189 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
190 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
191 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
192 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
193 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
194 fi; \
195 done; \
196} }
197
198#-----------------------------------------------------------------
199# Strip executable binaries and shared object files
200#
201# Requires: find, awk, strip, cut, xargs
202#
203#%no_install_post_strip 1
204%__spec_install_post_strip {%{!?debug: \
205%{!?no_install_post_strip: \
206 %{?verbose:set -x;} \
207 echo "Strip executable binaries, archives and shared object files."; \
208 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
209 elfexelist=`echo $filelist | xargs -r file | \
210 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
211 elfsharedlist=`echo $filelist | xargs -r file | \
212 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
213 elfarchiveslist=`echo $filelist | xargs -r file | \
214 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
215 if [ -n "$elfexelist" ]; then \
216 strip --remove-section=.note --remove-section=.comment $elfexelist; \
217 fi; \
218 if [ -n "$elfsharedlist" ]; then \
219 strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
220 fi; \
221 if [ -n "$elfarchiveslist" ]; then \
222 strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
223 fi; } \
224} }
225
226#-----------------------------------------------------------------
227# Find and gzip all kernel modules
228#
229# Requires: find
230#
231#%no_install_post_compress_modules 1
232%__spec_install_post_compress_modules { \
233%{!?no_install_post_compress_modules: \
234echo "Compress kernel modules if any."; \
235 %{?verbose:set -x;} \
236 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
237 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \
238 xargs -r %{__gzip} -9nf; \
239 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \
240 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
241 fi; \
242} }
243
244%_source_payload w9.gzdio
245%_binary_payload w9.bzdio
246
247#-----------------------------------------------------------------
248# Update all GConf2 schemas
249#
250# Requires: GConf2
251#
252%gconf_schema_install { umask 022; \
253 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \
254 /usr/bin/gconftool-2 --makefile-install-rule \
255 /etc/gconf/schemas/*.schemas > /dev/null \
256}
257
258#-----------------------------------------------------------------
259# post %install sequence:
260# - autodeps exceptions
261# - compress all man and info pages,
262# - strip all ELF executables and ELF shared objects if not %debug.
263# - compress kernel modules if any
264
265###################################################################
266# Requires/Provides automation
267# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
268%__spec_prep_pre \
269_autoreqprov=n \
270%{?_noautoreqfiles:_autoreqprov=y}\
271%{?_noautoreq:_autoreqprov=y}\
272%{?_noautoreqdep:_autoreqprov=y}\
273%{?_noautoprovfiles:_autoreqprov=y}\
274%{?_noautoprov:_autoreqprov=y}\
275%{?_noautocompressdoc:_autoreqprov=y}\
276if [ "$_autoreqprov" = "y" ] ; then \
277 if [ -f %{_builddir}/__rpm_lock ] ; then \
278 echo "Some package using \%_noauto* macros is already being built" >&2 \
279 echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
280 exit 1 \
281 else \
282 rm -f %{_builddir}/__rpm_*\
283 touch %{_builddir}/__rpm_lock \
284 fi \
285fi \
286%{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
287%{nil}
288
289%__os_install_post \
290%{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
291%{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
292%{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
293%{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
294%{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
295%{__spec_install_post_strip}\
296%{__spec_install_post_compress_docs}\
297%{__spec_install_post_compress_modules}\
298%{__arch_install_post}\
299%{nil}
300
301%__spec_clean_pre %{___build_pre}\
302_autoreqprov=n \
303%{?_noautoreqfiles:_autoreqprov=y}\
304%{?_noautoreq:_autoreqprov=y}\
305%{?_noautoreqdep:_autoreqprov=y}\
306%{?_noautoprovfiles:_autoreqprov=y}\
307%{?_noautoprov:_autoreqprov=y}\
308%{?_noautoreqfiles:_autoreqprov=y}\
309%{?_noautocompressdoc:_autoreqprov=y}\
310if [ "$_autoreqprov" = "y" ] ; then \
311 rm -f %{_builddir}/__rpm_* \
312fi \
313%{nil}
314
315
316#%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*"
317#%_noautoreq %{nil}
318#%_noautoreqdep %{nil}
319#%_noautoprovfiles %{nil}
320#%_noautoprov %{nil}
321%_missing_doc_files_terminate_build 1%{nil}
322%_unpackaged_files_terminate_build %{nil}
This page took 0.094747 seconds and 4 git commands to generate.