]> git.pld-linux.org Git - packages/rpm.git/blame - rpm.macros
- Release 0.3 to easy upgrade from snapshot
[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 11%_topdir %(echo $HOME)/rpm
cd33aab7
AM
12#-----------------------------------------------------------------
13# CFLAGS and LDFLAGS used to build
14
5b0f0ac9 15%debugcflags -O0 -g -Wall
cd33aab7
AM
16%rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}
17%rpmldflags %{!?debug:-s}
18
a544555d 19# kernel compiler
cabacfeb 20%kgcc gcc
21%kgcc_package gcc
a544555d 22
5f9f9bd7 23# Build system path macros.
24#
25%__libtoolize libtoolize --copy --force
aad1c8e4 26%__gettextize { \
4da2b97a 27 if ! gettextize --version | grep -q '0\.10\.' ; then \
4cd84746
JB
28 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
29 gettextize --copy --force --no-changelog; \
93bce43f 30 else \
4cd84746
JB
31 gettextize --copy --force --no-changelog --intl; \
32 fi; \
33 if [ ! -f po/Makevars ]; then \
34 cp -f po/Makevars{.template,}; \
35 fi; \
36 else \
37 gettextize --copy --force; \
aad1c8e4 38 fi; \
4cd84746
JB
39}
40%__autopoint autopoint --force
fa4547da 41%__automake automake -a -c -f --foreign
4413e4a3 42%__autoconf autoconf %{?debug:-Wall}
5f9f9bd7 43
cd33aab7 44#-----------------------------------------------------------------
9f0287b5 45%configure2_13 { \
cd33aab7
AM
46 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
47 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
48 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
49 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
50 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
c55f2219 51 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
700ee83b
AM
52 %{?__cc:CC=%{__cc} ; export CC ; } \
53 %{?__cxx:CXX=%{__cxx} ; export CXX ; } \
5b0f0ac9 54 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
fa74a11c 55 --host=%{_target_platform} \
cd33aab7
AM
56 --prefix=%{_prefix} \
57 --exec-prefix=%{_exec_prefix} \
58 --bindir=%{_bindir} \
59 --sbindir=%{_sbindir} \
60 --sysconfdir=%{_sysconfdir} \
61 --datadir=%{_datadir} \
62 --includedir=%{_includedir} \
63 --libdir=%{_libdir} \
64 --libexecdir=%{_libexecdir} \
65 --localstatedir=%{_localstatedir} \
66 --sharedstatedir=%{_sharedstatedir} \
67 --mandir=%{_mandir} \
68 --infodir=%{_infodir} \
69}
70
85f82bec 71#----------------------------------------------------------------
b8cf6778 72%configure {./configure \
85f82bec
AF
73 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
74 CFLAGS="${CFLAGS:-%rpmcflags}" \
75 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
76 FFLAGS="${FFLAGS:-%rpmcflags}" \
418d9760 77 CPPFLAGS="${CPPFLAGS:-}" \
9f0287b5
AF
78 %{?__cc:CC=%{__cc}} \
79 %{?__cxx:CXX=%{__cxx}} \
85f82bec
AF
80 --build=%{_target_platform} \
81 --prefix=%{_prefix} \
82 --exec-prefix=%{_exec_prefix} \
83 --bindir=%{_bindir} \
84 --sbindir=%{_sbindir} \
85 --sysconfdir=%{_sysconfdir} \
86 --datadir=%{_datadir} \
87 --includedir=%{_includedir} \
88 --libdir=%{_libdir} \
89 --libexecdir=%{_libexecdir} \
90 --localstatedir=%{_localstatedir} \
91 --sharedstatedir=%{_sharedstatedir} \
92 --mandir=%{_mandir} \
93 --infodir=%{_infodir} \
94}
95
cd33aab7
AM
96# Location of autoconf macros
97%_aclocaldir %(aclocal --print-ac-dir)
98
32720a50
AM
99# Location of omf files
100%_omf_dest_dir %(scrollkeeper-config --omfdir)
101
c5eece2c 102# Location of pkgconfig files
895ccc5b 103%_pkgconfigdir /usr/lib/pkgconfig
c5eece2c 104
cd33aab7 105# Location of top applink dir
de0caa47 106%_applnkdir /usr/X11R6/share/applnk
cd33aab7 107
c917274d 108# Location of desktop files
109%_desktopdir /usr/share/applications
110
cd33aab7 111# Location pixmaps for applnk/desktop files
3a9bb008 112%_pixmapsdir /usr/share/pixmaps
cd33aab7 113
c5eece2c
JB
114# Location of fonts directories
115%_fontsdir /usr/share/fonts
116
5cfcbc9e 117# Location of Gtk and associated libraries documentation
e9f33a26 118%_gtkdocdir %{_defaultdocdir}/gtk-doc/html
5cfcbc9e 119
cd33aab7
AM
120# Current date
121%date %(LC_ALL="C" date +"%a %b %d %Y")
122
123# tmp directory
124%tmpdir %(echo "${TMPDIR:-/tmp}")
125
126# Example files, programs, scripts...
127%_examplesdir /usr/src/examples
128
bd63739a 129# The directory holding Linux kernel sources
130%_kernelsrcdir /usr/src/linux
131
cd33aab7 132# If non-empty "debug" macro defined, add "dbg" suffix to release number
5b0f0ac9 133%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
cd33aab7 134
5b0f0ac9
MM
135# Requires name = version-release
136%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")
137%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)")
138%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 139
140# kernel version-release handling
141%__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
142%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not")
143%_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
144%_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
fd4d8ee0 145
c2c27a5a 146# sgml macros
147%xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog
148%xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog
149%xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
150%xmlcat_create() /usr/bin/xmlcatalog --noout --create %1
151%sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null
152%sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null
153%docbook_sgmlcat_fix() { for l in \
154'' \
155' -- default decl --' \
156'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
157' -- hacks for opensp --' \
158'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
159'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
160'' \
161; do echo $l; done >> %1 \
162}
163
cd33aab7
AM
164#-----------------------------------------------------------------
165# find and gzip all files in %{_mandir} and %{infodir}
166#
167# Requires: xargs, find
168#
169#%no_install_post_compress_docs 1
170%__spec_install_post_compress_docs { \
171echo "Compress man and info pages."; \
172%{!?no_install_post_compress_docs: \
173 %{?verbose:set -x;} \
174 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
175 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
176 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
177 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
178 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
179 fi; \
180 done; \
181} }
182
183#-----------------------------------------------------------------
184# Strip executable binaries and shared object files
185#
186# Requires: find, awk, strip, cut, xargs
187#
188#%no_install_post_strip 1
189%__spec_install_post_strip {%{!?debug: \
190%{!?no_install_post_strip: \
191 %{?verbose:set -x;} \
5b0f0ac9 192 echo "Strip executable binaries, archives and shared object files."; \
cd33aab7
AM
193 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
194 elfexelist=`echo $filelist | xargs -r file | \
195 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
196 elfsharedlist=`echo $filelist | xargs -r file | \
197 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
5b0f0ac9
MM
198 elfarchiveslist=`echo $filelist | xargs -r file | \
199 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
cd33aab7
AM
200 if [ -n "$elfexelist" ]; then \
201 strip --remove-section=.note --remove-section=.comment $elfexelist; \
202 fi; \
203 if [ -n "$elfsharedlist" ]; then \
204 strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
5b0f0ac9
MM
205 fi; \
206 if [ -n "$elfarchiveslist" ]; then \
207 strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
cd33aab7
AM
208 fi; } \
209} }
5b0f0ac9 210
22a54b3e 211#-----------------------------------------------------------------
93b46c00 212# Find and gzip all kernel modules
213#
214# Requires: find
215#
216#%no_install_post_compress_modules 1
217%__spec_install_post_compress_modules { \
93b46c00 218%{!?no_install_post_compress_modules: \
db88c593 219echo "Compress kernel modules if any."; \
93b46c00 220 %{?verbose:set -x;} \
390bdd1d 221 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
db88c593 222 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \
390bdd1d 223 xargs -r %{__gzip} -9nf; \
db88c593 224 find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \
92ebeb8d 225 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
390bdd1d 226 fi; \
93b46c00 227} }
cd33aab7
AM
228
229%_source_payload w9.gzdio
230%_binary_payload w9.bzdio
231
aad1c8e4 232#-----------------------------------------------------------------
233# Update all GConf2 schemas
234#
235# Requires: GConf2
236#
03ff3333 237%gconf_schema_install { umask 022; \
238 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \
239 /usr/bin/gconftool-2 --makefile-install-rule \
240 /etc/gconf/schemas/*.schemas > /dev/null \
82b097b9 241}
aad1c8e4 242
cd33aab7
AM
243#-----------------------------------------------------------------
244# post %install sequence:
245# - autodeps exceptions
246# - compress all man and info pages,
247# - strip all ELF executables and ELF shared objects if not %debug.
5b0f0ac9 248# - compress kernel modules if any
cd33aab7
AM
249
250###################################################################
251# Requires/Provides automation
252# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
f10da3d9
JK
253%__spec_prep_pre \
254_autoreqprov=n \
255%{?_noautoreqfiles:_autoreqprov=y}\
256%{?_noautoreq:_autoreqprov=y}\
257%{?_noautoreqdep:_autoreqprov=y}\
258%{?_noautoprovfiles:_autoreqprov=y}\
259%{?_noautoprov:_autoreqprov=y}\
5701c444 260%{?_noautocompressdoc:_autoreqprov=y}\
f10da3d9
JK
261if [ "$_autoreqprov" = "y" ] ; then \
262 if [ -f %{_builddir}/__rpm_lock ] ; then \
263 echo "Some package using \%_noauto* macros is already being built" >&2 \
264 echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
265 exit 1 \
266 else \
267 rm -f %{_builddir}/__rpm_*\
268 touch %{_builddir}/__rpm_lock \
269 fi \
270fi \
5701c444 271%{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
cd33aab7
AM
272%{nil}
273
cd33aab7
AM
274
275%__spec_clean_pre %{___build_pre}\
f10da3d9
JK
276_autoreqprov=n \
277%{?_noautoreqfiles:_autoreqprov=y}\
278%{?_noautoreq:_autoreqprov=y}\
279%{?_noautoreqdep:_autoreqprov=y}\
280%{?_noautoprovfiles:_autoreqprov=y}\
281%{?_noautoprov:_autoreqprov=y}\
282%{?_noautoreqfiles:_autoreqprov=y}\
5701c444 283%{?_noautocompressdoc:_autoreqprov=y}\
f10da3d9
JK
284if [ "$_autoreqprov" = "y" ] ; then \
285 rm -f %{_builddir}/__rpm_* \
286fi \
cd33aab7
AM
287%{nil}
288
289
290#%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*"
291#%_noautoreq %{nil}
292#%_noautoreqdep %{nil}
293#%_noautoprovfiles %{nil}
294#%_noautoprov %{nil}
5b0f0ac9
MM
295%_missing_doc_files_terminate_build 1%{nil}
296%_unpackaged_files_terminate_build %{nil}
4c7d3ba4 297# (X)emacs support
42b7e5ac 298%___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}'
4c7d3ba4
AF
299%_emacs_lispdir %(emacs %___emacs_lispdir_helper)
300%_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
41a62699
AF
301
302%__php_provides @RPMCONFIGDIR@/php.prov
303%__php_requires @RPMCONFIGDIR@/php.req
304
305# Perl specific macro definitions.
942c693c
AF
306%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
307%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
308%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
309%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
310%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
311%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
41a62699 312
942c693c 313%php_pear_dir %{_datadir}/pear
41a62699
AF
314
315# Python specific macro definitions.
316# python main version
942c693c 317%py_ver %(echo `python -c "import sys; print sys.version[:3]"`)
41a62699
AF
318
319# directories
942c693c
AF
320%py_prefix %(echo `python -c "import sys; print sys.prefix"`)
321%py_libdir %{py_prefix}/lib/python%{py_ver}
322%py_incdir /usr/include/python%{py_ver}
323%py_sitedir %{py_libdir}/site-packages
324%py_dyndir %{py_libdir}/lib-dynload
41a62699
AF
325
326# pure python modules compilation
942c693c 327%py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
41a62699 328
942c693c 329%py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
41a62699
AF
330
331# Software written in Python language require Python with main version
332# unchanged
942c693c 333%pyrequires_eq() Requires: %1 >= %py_ver %1 < %(echo `python -c "import sys; import string; ver=sys.version[:3].split('.'); ver[1]=str(int(ver[1])+1); print string.join(ver, '.')"`)
41a62699 334
This page took 0.109127 seconds and 4 git commands to generate.