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