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