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