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