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