]>
Commit | Line | Data |
---|---|---|
1 | # PLD rpm macros | |
2 | ||
3 | %__id @__ID@ | |
4 | %__id_u %{__id} -u | |
5 | %__chown_Rhf @__CHOWN_RHF@ | |
6 | %__chgrp_Rhf @__CHGRP_RHF@ | |
7 | ||
8 | %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@ | |
9 | %_fixgroup true | |
10 | %_fixperms %{__chmod} -Rf @FIXPERMS@ | |
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 | |
17 | %_sharedstatedir /var/lib | |
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 | |
26 | %_defaultdocdir %{_usr}/share/doc | |
27 | #----------------------------------------------------------------- | |
28 | # CFLAGS and LDFLAGS used to build | |
29 | ||
30 | %debugcflags -O0 -g -Wall | |
31 | %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags} | |
32 | %rpmldflags %{!?debug:-s} | |
33 | ||
34 | # kernel compiler | |
35 | %kgcc gcc2 | |
36 | %kgcc_package gcc2 | |
37 | ||
38 | # Build system path macros. | |
39 | # | |
40 | %__libtoolize libtoolize --copy --force | |
41 | %__gettextize gettextize --copy --force | |
42 | %__automake automake -a -c -f --foreign | |
43 | %__autoconf autoconf %{?debug:-Wall} | |
44 | ||
45 | #----------------------------------------------------------------- | |
46 | %configure2_13 { \ | |
47 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ | |
48 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
49 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
50 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \ | |
51 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ | |
52 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ | |
53 | %{?__cc:CC=%{__cc} ; export CC ; } \ | |
54 | %{?__cxx:CXX=%{__cxx} ; export CXX ; } \ | |
55 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ | |
56 | --host=%{_target_platform} \ | |
57 | --prefix=%{_prefix} \ | |
58 | --exec-prefix=%{_exec_prefix} \ | |
59 | --bindir=%{_bindir} \ | |
60 | --sbindir=%{_sbindir} \ | |
61 | --sysconfdir=%{_sysconfdir} \ | |
62 | --datadir=%{_datadir} \ | |
63 | --includedir=%{_includedir} \ | |
64 | --libdir=%{_libdir} \ | |
65 | --libexecdir=%{_libexecdir} \ | |
66 | --localstatedir=%{_localstatedir} \ | |
67 | --sharedstatedir=%{_sharedstatedir} \ | |
68 | --mandir=%{_mandir} \ | |
69 | --infodir=%{_infodir} \ | |
70 | } | |
71 | ||
72 | #---------------------------------------------------------------- | |
73 | %configure {./configure \ | |
74 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ | |
75 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
76 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \ | |
77 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
78 | CPPFLAGS="${CPPFLAGS:-}" \ | |
79 | %{?__cc:CC=%{__cc}} \ | |
80 | %{?__cxx:CXX=%{__cxx}} \ | |
81 | --build=%{_target_platform} \ | |
82 | --prefix=%{_prefix} \ | |
83 | --exec-prefix=%{_exec_prefix} \ | |
84 | --bindir=%{_bindir} \ | |
85 | --sbindir=%{_sbindir} \ | |
86 | --sysconfdir=%{_sysconfdir} \ | |
87 | --datadir=%{_datadir} \ | |
88 | --includedir=%{_includedir} \ | |
89 | --libdir=%{_libdir} \ | |
90 | --libexecdir=%{_libexecdir} \ | |
91 | --localstatedir=%{_localstatedir} \ | |
92 | --sharedstatedir=%{_sharedstatedir} \ | |
93 | --mandir=%{_mandir} \ | |
94 | --infodir=%{_infodir} \ | |
95 | } | |
96 | ||
97 | # Location of autoconf macros | |
98 | %_aclocaldir %(aclocal --print-ac-dir) | |
99 | ||
100 | # Location of omf files | |
101 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
102 | ||
103 | # Location of pkgconfig files | |
104 | %_pkgconfigdir /usr/lib/pkgconfig | |
105 | ||
106 | # Location of top applink dir | |
107 | %_applnkdir /usr/X11R6/share/applnk | |
108 | ||
109 | # Location pixmaps for applnk/desktop files | |
110 | %_pixmapsdir /usr/X11R6/share/pixmaps | |
111 | ||
112 | # Location of fonts directories | |
113 | %_fontsdir /usr/share/fonts | |
114 | ||
115 | # Current date | |
116 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
117 | ||
118 | # tmp directory | |
119 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
120 | ||
121 | # Example files, programs, scripts... | |
122 | %_examplesdir /usr/src/examples | |
123 | ||
124 | # The directory holding Linux kernel sources | |
125 | %_kernelsrcdir /usr/src/linux | |
126 | ||
127 | # If non-empty "debug" macro defined, add "dbg" suffix to release number | |
128 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm | |
129 | ||
130 | # Requires name = version-release | |
131 | %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") | |
132 | %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)") | |
133 | %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)") | |
134 | ||
135 | # kernel version-release handling | |
136 | %__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2) | |
137 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not") | |
138 | %_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}}) | |
139 | %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g) | |
140 | ||
141 | # sgml macros | |
142 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog | |
143 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog | |
144 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
145 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 | |
146 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null | |
147 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null | |
148 | %docbook_sgmlcat_fix() { for l in \ | |
149 | '' \ | |
150 | ' -- default decl --' \ | |
151 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
152 | ' -- hacks for opensp --' \ | |
153 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
154 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
155 | '' \ | |
156 | ; do echo $l; done >> %1 \ | |
157 | } | |
158 | ||
159 | #----------------------------------------------------------------- | |
160 | # find and gzip all files in %{_mandir} and %{infodir} | |
161 | # | |
162 | # Requires: xargs, find | |
163 | # | |
164 | #%no_install_post_compress_docs 1 | |
165 | %__spec_install_post_compress_docs { \ | |
166 | echo "Compress man and info pages."; \ | |
167 | %{!?no_install_post_compress_docs: \ | |
168 | %{?verbose:set -x;} \ | |
169 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
170 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
171 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
172 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
173 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
174 | fi; \ | |
175 | done; \ | |
176 | } } | |
177 | ||
178 | #----------------------------------------------------------------- | |
179 | # Strip executable binaries and shared object files | |
180 | # | |
181 | # Requires: find, awk, strip, cut, xargs | |
182 | # | |
183 | #%no_install_post_strip 1 | |
184 | %__spec_install_post_strip {%{!?debug: \ | |
185 | %{!?no_install_post_strip: \ | |
186 | %{?verbose:set -x;} \ | |
187 | echo "Strip executable binaries, archives and shared object files."; \ | |
188 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \ | |
189 | elfexelist=`echo $filelist | xargs -r file | \ | |
190 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
191 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
192 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
193 | elfarchiveslist=`echo $filelist | xargs -r file | \ | |
194 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
195 | if [ -n "$elfexelist" ]; then \ | |
196 | strip --remove-section=.note --remove-section=.comment $elfexelist; \ | |
197 | fi; \ | |
198 | if [ -n "$elfsharedlist" ]; then \ | |
199 | strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ | |
200 | fi; \ | |
201 | if [ -n "$elfarchiveslist" ]; then \ | |
202 | strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ | |
203 | fi; } \ | |
204 | } } | |
205 | ||
206 | #----------------------------------------------------------------- | |
207 | # Find and gzip all kernel modules | |
208 | # | |
209 | # Requires: find | |
210 | # | |
211 | #%no_install_post_compress_modules 1 | |
212 | %__spec_install_post_compress_modules { \ | |
213 | echo "Compress kernel modules if any."; \ | |
214 | %{!?no_install_post_compress_modules: \ | |
215 | %{?verbose:set -x;} \ | |
216 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ | |
217 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -print | \ | |
218 | xargs -r %{__gzip} -9nf; \ | |
219 | fi; \ | |
220 | } } | |
221 | ||
222 | %_source_payload w9.gzdio | |
223 | %_binary_payload w9.bzdio | |
224 | ||
225 | #----------------------------------------------------------------- | |
226 | # post %install sequence: | |
227 | # - autodeps exceptions | |
228 | # - compress all man and info pages, | |
229 | # - strip all ELF executables and ELF shared objects if not %debug. | |
230 | # - compress kernel modules if any | |
231 | ||
232 | ################################################################### | |
233 | # Requires/Provides automation | |
234 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
235 | %__spec_prep_pre \ | |
236 | _autoreqprov=n \ | |
237 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
238 | %{?_noautoreq:_autoreqprov=y}\ | |
239 | %{?_noautoreqdep:_autoreqprov=y}\ | |
240 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
241 | %{?_noautoprov:_autoreqprov=y}\ | |
242 | %{?_noautocompressdoc:_autoreqprov=y}\ | |
243 | if [ "$_autoreqprov" = "y" ] ; then \ | |
244 | if [ -f %{_builddir}/__rpm_lock ] ; then \ | |
245 | echo "Some package using \%_noauto* macros is already being built" >&2 \ | |
246 | echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \ | |
247 | exit 1 \ | |
248 | else \ | |
249 | rm -f %{_builddir}/__rpm_*\ | |
250 | touch %{_builddir}/__rpm_lock \ | |
251 | fi \ | |
252 | fi \ | |
253 | %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\ | |
254 | %{nil} | |
255 | ||
256 | %__os_install_post \ | |
257 | %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\ | |
258 | %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\ | |
259 | %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\ | |
260 | %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\ | |
261 | %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\ | |
262 | %{__spec_install_post_strip}\ | |
263 | %{__spec_install_post_compress_docs}\ | |
264 | %{__spec_install_post_compress_modules}\ | |
265 | %{__arch_install_post}\ | |
266 | %{nil} | |
267 | ||
268 | %__spec_clean_pre %{___build_pre}\ | |
269 | _autoreqprov=n \ | |
270 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
271 | %{?_noautoreq:_autoreqprov=y}\ | |
272 | %{?_noautoreqdep:_autoreqprov=y}\ | |
273 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
274 | %{?_noautoprov:_autoreqprov=y}\ | |
275 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
276 | %{?_noautocompressdoc:_autoreqprov=y}\ | |
277 | if [ "$_autoreqprov" = "y" ] ; then \ | |
278 | rm -f %{_builddir}/__rpm_* \ | |
279 | fi \ | |
280 | %{nil} | |
281 | ||
282 | ||
283 | #%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*" | |
284 | #%_noautoreq %{nil} | |
285 | #%_noautoreqdep %{nil} | |
286 | #%_noautoprovfiles %{nil} | |
287 | #%_noautoprov %{nil} | |
288 | %_missing_doc_files_terminate_build 1%{nil} | |
289 | %_unpackaged_files_terminate_build %{nil} |