]> git.pld-linux.org Git - packages/rpm.git/blame - rpm.macros
- uh... fixed for 4.0.2
[packages/rpm.git] / rpm.macros
CommitLineData
a8bf9720
AF
1# PLD rpm macros
2
3%_defaultdocdir %{_usr}/share/doc
4%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@
5%_fixgroup true
6%_topdir %(echo $HOME)/rpm
7%_exec_prefix %{_prefix}
8%_bindir %{_exec_prefix}/bin
9%_sbindir %{_exec_prefix}/sbin
10%_libexecdir %{_exec_prefix}/lib
11%_datadir %{_prefix}/share
12%_sharedstatedir %{_prefix}/com
13%_lib lib
14%_libdir %{_exec_prefix}/%{_lib}
15%_includedir %{_prefix}/include
16%_oldincludedir /usr/include
17%_sysconfdir /etc
18%_localstatedir /var
19%_infodir /usr/share/info
20%_mandir %{_prefix}/share/man
cd33aab7
AM
21#-----------------------------------------------------------------
22# CFLAGS and LDFLAGS used to build
23
24%debugcflags -O0 -g
25%rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}
26%rpmldflags %{!?debug:-s}
27
a544555d 28# kernel compiler
c8709bd0
JB
29%kgcc kgcc
30%kgcc_package egcs
a544555d 31
cd33aab7 32#-----------------------------------------------------------------
9f0287b5 33%configure2_13 { \
cd33aab7
AM
34 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
35 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
36 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
37 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
38 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
700ee83b
AM
39 %{?__cc:CC=%{__cc} ; export CC ; } \
40 %{?__cxx:CXX=%{__cxx} ; export CXX ; } \
cd33aab7 41 ./configure \
fa74a11c 42 --host=%{_target_platform} \
cd33aab7
AM
43 --prefix=%{_prefix} \
44 --exec-prefix=%{_exec_prefix} \
45 --bindir=%{_bindir} \
46 --sbindir=%{_sbindir} \
47 --sysconfdir=%{_sysconfdir} \
48 --datadir=%{_datadir} \
49 --includedir=%{_includedir} \
50 --libdir=%{_libdir} \
51 --libexecdir=%{_libexecdir} \
52 --localstatedir=%{_localstatedir} \
53 --sharedstatedir=%{_sharedstatedir} \
54 --mandir=%{_mandir} \
55 --infodir=%{_infodir} \
56}
57
85f82bec 58#----------------------------------------------------------------
9f0287b5 59%configure {./configure \
85f82bec
AF
60 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
61 CFLAGS="${CFLAGS:-%rpmcflags}" \
62 CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
63 FFLAGS="${FFLAGS:-%rpmcflags}" \
9f0287b5
AF
64 %{?__cc:CC=%{__cc}} \
65 %{?__cxx:CXX=%{__cxx}} \
85f82bec
AF
66 --build=%{_target_platform} \
67 --prefix=%{_prefix} \
68 --exec-prefix=%{_exec_prefix} \
69 --bindir=%{_bindir} \
70 --sbindir=%{_sbindir} \
71 --sysconfdir=%{_sysconfdir} \
72 --datadir=%{_datadir} \
73 --includedir=%{_includedir} \
74 --libdir=%{_libdir} \
75 --libexecdir=%{_libexecdir} \
76 --localstatedir=%{_localstatedir} \
77 --sharedstatedir=%{_sharedstatedir} \
78 --mandir=%{_mandir} \
79 --infodir=%{_infodir} \
80}
81
cd33aab7
AM
82# Location of autoconf macros
83%_aclocaldir %(aclocal --print-ac-dir)
84
32720a50
AM
85# Location of omf files
86%_omf_dest_dir %(scrollkeeper-config --omfdir)
87
c5eece2c 88# Location of pkgconfig files
895ccc5b 89%_pkgconfigdir /usr/lib/pkgconfig
c5eece2c 90
cd33aab7
AM
91# Location of top applink dir
92%_applnkdir /usr/X11R6/share/applnk
93
94# Location pixmaps for applnk/desktop files
95%_pixmapsdir /usr/X11R6/share/pixmaps
96
c5eece2c
JB
97# Location of fonts directories
98%_fontsdir /usr/share/fonts
99
cd33aab7
AM
100# Current date
101%date %(LC_ALL="C" date +"%a %b %d %Y")
102
103# tmp directory
104%tmpdir %(echo "${TMPDIR:-/tmp}")
105
106# Example files, programs, scripts...
107%_examplesdir /usr/src/examples
108
bd63739a 109# The directory holding Linux kernel sources
110%_kernelsrcdir /usr/src/linux
111
cd33aab7 112# If non-empty "debug" macro defined, add "dbg" suffix to release number
8dea1306 113%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
cd33aab7 114
0cdbc762 115# requires name = version-release
8dea1306 116%requires_releq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}-%%{RELEASE}' %1| grep -v "is not")
117%requires_kernel_releq() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
118%requires_releq_kernel_up() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-up = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
119%requires_releq_kernel_smp() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-smp = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
120
121# kernel version-release handling
122%__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
123%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not")
124%_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
125%_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
fd4d8ee0 126
cd33aab7
AM
127#-----------------------------------------------------------------
128# find and gzip all files in %{_mandir} and %{infodir}
129#
130# Requires: xargs, find
131#
132#%no_install_post_compress_docs 1
133%__spec_install_post_compress_docs { \
134echo "Compress man and info pages."; \
135%{!?no_install_post_compress_docs: \
136 %{?verbose:set -x;} \
137 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
138 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
139 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
140 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
141 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
142 fi; \
143 done; \
144} }
145
146#-----------------------------------------------------------------
147# Strip executable binaries and shared object files
148#
149# Requires: find, awk, strip, cut, xargs
150#
151#%no_install_post_strip 1
152%__spec_install_post_strip {%{!?debug: \
153%{!?no_install_post_strip: \
154 %{?verbose:set -x;} \
155 echo "Strip executable binaries and shared object files."; \
156 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
157 elfexelist=`echo $filelist | xargs -r file | \
158 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
159 elfsharedlist=`echo $filelist | xargs -r file | \
160 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
161 if [ -n "$elfexelist" ]; then \
162 strip --remove-section=.note --remove-section=.comment $elfexelist; \
163 fi; \
164 if [ -n "$elfsharedlist" ]; then \
165 strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
166 fi; } \
167} }
168
169%_source_payload w9.gzdio
170%_binary_payload w9.bzdio
171
172#-----------------------------------------------------------------
173# post %install sequence:
174# - autodeps exceptions
175# - compress all man and info pages,
176# - strip all ELF executables and ELF shared objects if not %debug.
177
178###################################################################
179# Requires/Provides automation
180# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
f10da3d9
JK
181%__spec_prep_pre \
182_autoreqprov=n \
183%{?_noautoreqfiles:_autoreqprov=y}\
184%{?_noautoreq:_autoreqprov=y}\
185%{?_noautoreqdep:_autoreqprov=y}\
186%{?_noautoprovfiles:_autoreqprov=y}\
187%{?_noautoprov:_autoreqprov=y}\
5701c444 188%{?_noautocompressdoc:_autoreqprov=y}\
f10da3d9
JK
189if [ "$_autoreqprov" = "y" ] ; then \
190 if [ -f %{_builddir}/__rpm_lock ] ; then \
191 echo "Some package using \%_noauto* macros is already being built" >&2 \
192 echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
193 exit 1 \
194 else \
195 rm -f %{_builddir}/__rpm_*\
196 touch %{_builddir}/__rpm_lock \
197 fi \
198fi \
5701c444 199%{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
cd33aab7
AM
200%{nil}
201
81bcf939 202%__os_install_post \
cd33aab7
AM
203%{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
204%{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
205%{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
206%{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
207%{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
208%{__spec_install_post_strip}\
209%{__spec_install_post_compress_docs}\
210%{__arch_install_post}\
cd33aab7
AM
211%{nil}
212
213%__spec_clean_pre %{___build_pre}\
f10da3d9
JK
214_autoreqprov=n \
215%{?_noautoreqfiles:_autoreqprov=y}\
216%{?_noautoreq:_autoreqprov=y}\
217%{?_noautoreqdep:_autoreqprov=y}\
218%{?_noautoprovfiles:_autoreqprov=y}\
219%{?_noautoprov:_autoreqprov=y}\
220%{?_noautoreqfiles:_autoreqprov=y}\
5701c444 221%{?_noautocompressdoc:_autoreqprov=y}\
f10da3d9
JK
222if [ "$_autoreqprov" = "y" ] ; then \
223 rm -f %{_builddir}/__rpm_* \
224fi \
cd33aab7
AM
225%{nil}
226
227
228#%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*"
229#%_noautoreq %{nil}
230#%_noautoreqdep %{nil}
231#%_noautoprovfiles %{nil}
232#%_noautoprov %{nil}
This page took 0.121502 seconds and 4 git commands to generate.