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