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