]> git.pld-linux.org Git - packages/rpm.git/blame - rpm.macros
- -devel R: bzip2-devel,libelf-devel,zlib-devel
[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
5b0f0ac9
MM
35%kgcc gcc2
36%kgcc_package gcc2
a544555d 37
5f9f9bd7 38# Build system path macros.
39#
40%__libtoolize libtoolize --copy --force
fa4547da
JB
41%__gettextize gettextize --copy --force
42%__automake automake -a -c -f --foreign
4413e4a3 43%__autoconf autoconf %{?debug:-Wall}
5f9f9bd7 44
cd33aab7 45#-----------------------------------------------------------------
9f0287b5 46%configure2_13 { \
cd33aab7
AM
47 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
48 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
49 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
50 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
51 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
c55f2219 52 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
700ee83b
AM
53 %{?__cc:CC=%{__cc} ; export CC ; } \
54 %{?__cxx:CXX=%{__cxx} ; export CXX ; } \
5b0f0ac9 55 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
fa74a11c 56 --host=%{_target_platform} \
cd33aab7
AM
57 --prefix=%{_prefix} \
58 --exec-prefix=%{_exec_prefix} \
59 --bindir=%{_bindir} \
60 --sbindir=%{_sbindir} \
61 --sysconfdir=%{_sysconfdir} \
62 --datadir=%{_datadir} \
63 --includedir=%{_includedir} \
64 --libdir=%{_libdir} \
65 --libexecdir=%{_libexecdir} \
66 --localstatedir=%{_localstatedir} \
67 --sharedstatedir=%{_sharedstatedir} \
68 --mandir=%{_mandir} \
69 --infodir=%{_infodir} \
70}
71
85f82bec 72#----------------------------------------------------------------
9f0287b5 73%configure {./configure \
85f82bec
AF
74 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
75 CFLAGS="${CFLAGS:-%rpmcflags}" \
76 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
77 FFLAGS="${FFLAGS:-%rpmcflags}" \
418d9760 78 CPPFLAGS="${CPPFLAGS:-}" \
9f0287b5
AF
79 %{?__cc:CC=%{__cc}} \
80 %{?__cxx:CXX=%{__cxx}} \
85f82bec
AF
81 --build=%{_target_platform} \
82 --prefix=%{_prefix} \
83 --exec-prefix=%{_exec_prefix} \
84 --bindir=%{_bindir} \
85 --sbindir=%{_sbindir} \
86 --sysconfdir=%{_sysconfdir} \
87 --datadir=%{_datadir} \
88 --includedir=%{_includedir} \
89 --libdir=%{_libdir} \
90 --libexecdir=%{_libexecdir} \
91 --localstatedir=%{_localstatedir} \
92 --sharedstatedir=%{_sharedstatedir} \
93 --mandir=%{_mandir} \
94 --infodir=%{_infodir} \
95}
96
cd33aab7
AM
97# Location of autoconf macros
98%_aclocaldir %(aclocal --print-ac-dir)
99
32720a50
AM
100# Location of omf files
101%_omf_dest_dir %(scrollkeeper-config --omfdir)
102
c5eece2c 103# Location of pkgconfig files
895ccc5b 104%_pkgconfigdir /usr/lib/pkgconfig
c5eece2c 105
cd33aab7
AM
106# Location of top applink dir
107%_applnkdir /usr/X11R6/share/applnk
108
109# Location pixmaps for applnk/desktop files
110%_pixmapsdir /usr/X11R6/share/pixmaps
111
c5eece2c
JB
112# Location of fonts directories
113%_fontsdir /usr/share/fonts
114
cd33aab7
AM
115# Current date
116%date %(LC_ALL="C" date +"%a %b %d %Y")
117
118# tmp directory
119%tmpdir %(echo "${TMPDIR:-/tmp}")
120
121# Example files, programs, scripts...
122%_examplesdir /usr/src/examples
123
bd63739a 124# The directory holding Linux kernel sources
125%_kernelsrcdir /usr/src/linux
126
cd33aab7 127# If non-empty "debug" macro defined, add "dbg" suffix to release number
5b0f0ac9 128%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
cd33aab7 129
5b0f0ac9
MM
130# Requires name = version-release
131%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")
132%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)")
133%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 134
135# kernel version-release handling
136%__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
137%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not")
138%_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
139%_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
fd4d8ee0 140
c2c27a5a 141# sgml macros
142%xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog
143%xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog
144%xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
145%xmlcat_create() /usr/bin/xmlcatalog --noout --create %1
146%sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null
147%sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null
148%docbook_sgmlcat_fix() { for l in \
149'' \
150' -- default decl --' \
151'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
152' -- hacks for opensp --' \
153'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
154'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
155'' \
156; do echo $l; done >> %1 \
157}
158
cd33aab7
AM
159#-----------------------------------------------------------------
160# find and gzip all files in %{_mandir} and %{infodir}
161#
162# Requires: xargs, find
163#
164#%no_install_post_compress_docs 1
165%__spec_install_post_compress_docs { \
166echo "Compress man and info pages."; \
167%{!?no_install_post_compress_docs: \
168 %{?verbose:set -x;} \
169 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
170 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
171 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
172 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
173 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
174 fi; \
175 done; \
176} }
177
178#-----------------------------------------------------------------
179# Strip executable binaries and shared object files
180#
181# Requires: find, awk, strip, cut, xargs
182#
183#%no_install_post_strip 1
184%__spec_install_post_strip {%{!?debug: \
185%{!?no_install_post_strip: \
186 %{?verbose:set -x;} \
5b0f0ac9 187 echo "Strip executable binaries, archives and shared object files."; \
cd33aab7
AM
188 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
189 elfexelist=`echo $filelist | xargs -r file | \
190 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
191 elfsharedlist=`echo $filelist | xargs -r file | \
192 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
5b0f0ac9
MM
193 elfarchiveslist=`echo $filelist | xargs -r file | \
194 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
cd33aab7
AM
195 if [ -n "$elfexelist" ]; then \
196 strip --remove-section=.note --remove-section=.comment $elfexelist; \
197 fi; \
198 if [ -n "$elfsharedlist" ]; then \
199 strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
5b0f0ac9
MM
200 fi; \
201 if [ -n "$elfarchiveslist" ]; then \
202 strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
cd33aab7
AM
203 fi; } \
204} }
5b0f0ac9 205
22a54b3e 206#-----------------------------------------------------------------
93b46c00 207# Find and gzip all kernel modules
208#
209# Requires: find
210#
211#%no_install_post_compress_modules 1
212%__spec_install_post_compress_modules { \
93b46c00 213%{!?no_install_post_compress_modules: \
db88c593 214echo "Compress kernel modules if any."; \
93b46c00 215 %{?verbose:set -x;} \
390bdd1d 216 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
db88c593 217 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \
390bdd1d 218 xargs -r %{__gzip} -9nf; \
db88c593
JB
219 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \
220 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done \
390bdd1d 221 fi; \
93b46c00 222} }
cd33aab7
AM
223
224%_source_payload w9.gzdio
225%_binary_payload w9.bzdio
226
227#-----------------------------------------------------------------
228# post %install sequence:
229# - autodeps exceptions
230# - compress all man and info pages,
231# - strip all ELF executables and ELF shared objects if not %debug.
5b0f0ac9 232# - compress kernel modules if any
cd33aab7
AM
233
234###################################################################
235# Requires/Provides automation
236# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
f10da3d9
JK
237%__spec_prep_pre \
238_autoreqprov=n \
239%{?_noautoreqfiles:_autoreqprov=y}\
240%{?_noautoreq:_autoreqprov=y}\
241%{?_noautoreqdep:_autoreqprov=y}\
242%{?_noautoprovfiles:_autoreqprov=y}\
243%{?_noautoprov:_autoreqprov=y}\
5701c444 244%{?_noautocompressdoc:_autoreqprov=y}\
f10da3d9
JK
245if [ "$_autoreqprov" = "y" ] ; then \
246 if [ -f %{_builddir}/__rpm_lock ] ; then \
247 echo "Some package using \%_noauto* macros is already being built" >&2 \
248 echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
249 exit 1 \
250 else \
251 rm -f %{_builddir}/__rpm_*\
252 touch %{_builddir}/__rpm_lock \
253 fi \
254fi \
5701c444 255%{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
cd33aab7
AM
256%{nil}
257
81bcf939 258%__os_install_post \
cd33aab7
AM
259%{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
260%{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
261%{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
262%{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
263%{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
264%{__spec_install_post_strip}\
265%{__spec_install_post_compress_docs}\
93b46c00 266%{__spec_install_post_compress_modules}\
cd33aab7 267%{__arch_install_post}\
cd33aab7
AM
268%{nil}
269
270%__spec_clean_pre %{___build_pre}\
f10da3d9
JK
271_autoreqprov=n \
272%{?_noautoreqfiles:_autoreqprov=y}\
273%{?_noautoreq:_autoreqprov=y}\
274%{?_noautoreqdep:_autoreqprov=y}\
275%{?_noautoprovfiles:_autoreqprov=y}\
276%{?_noautoprov:_autoreqprov=y}\
277%{?_noautoreqfiles:_autoreqprov=y}\
5701c444 278%{?_noautocompressdoc:_autoreqprov=y}\
f10da3d9
JK
279if [ "$_autoreqprov" = "y" ] ; then \
280 rm -f %{_builddir}/__rpm_* \
281fi \
cd33aab7
AM
282%{nil}
283
284
285#%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*"
286#%_noautoreq %{nil}
287#%_noautoreqdep %{nil}
288#%_noautoprovfiles %{nil}
289#%_noautoprov %{nil}
5b0f0ac9
MM
290%_missing_doc_files_terminate_build 1%{nil}
291%_unpackaged_files_terminate_build %{nil}
This page took 0.249457 seconds and 4 git commands to generate.