]>
Commit | Line | Data |
---|---|---|
d54662bf AF |
1 | # PLD rpm macros |
2 | ||
8f74418b MM |
3 | %__id @__ID@ |
4 | %__id_u %{__id} -u | |
5 | %__chown_Rhf @__CHOWN_RHF@ | |
6 | %__chgrp_Rhf @__CHGRP_RHF@ | |
7 | ||
d54662bf AF |
8 | %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@ |
9 | %_fixgroup true | |
8f74418b | 10 | %_fixperms %{__chmod} -Rf @FIXPERMS@ |
d54662bf AF |
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 | |
8f74418b | 17 | %_sharedstatedir /var/lib |
d54662bf AF |
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 | |
8f74418b | 26 | %_defaultdocdir %{_usr}/share/doc |
9c404149 AM |
27 | #----------------------------------------------------------------- |
28 | # CFLAGS and LDFLAGS used to build | |
29 | ||
8f74418b | 30 | %debugcflags -O0 -g -Wall |
9c404149 AM |
31 | %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags} |
32 | %rpmldflags %{!?debug:-s} | |
33 | ||
ba1fdedc | 34 | # kernel compiler |
8f74418b MM |
35 | %kgcc gcc2 |
36 | %kgcc_package gcc2 | |
ba1fdedc | 37 | |
33040789 | 38 | # Build system path macros. |
39 | # | |
40 | %__libtoolize libtoolize --copy --force | |
bcdab9c2 JB |
41 | %__gettextize gettextize --copy --force |
42 | %__automake automake -a -c -f --foreign | |
be3a1985 | 43 | %__autoconf autoconf %{?debug:-Wall} |
33040789 | 44 | |
9c404149 | 45 | #----------------------------------------------------------------- |
9f4ce098 | 46 | %configure2_13 { \ |
9c404149 AM |
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 ; \ | |
8ec1a12b | 52 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
ae5d93df AM |
53 | %{?__cc:CC=%{__cc} ; export CC ; } \ |
54 | %{?__cxx:CXX=%{__cxx} ; export CXX ; } \ | |
8f74418b | 55 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ |
2a7cfd3f | 56 | --host=%{_target_platform} \ |
9c404149 AM |
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 | ||
4a6b0d54 | 72 | #---------------------------------------------------------------- |
9f4ce098 | 73 | %configure {./configure \ |
4a6b0d54 AF |
74 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
75 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
76 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \ | |
77 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
a2bd5992 | 78 | CPPFLAGS="${CPPFLAGS:-}" \ |
9f4ce098 AF |
79 | %{?__cc:CC=%{__cc}} \ |
80 | %{?__cxx:CXX=%{__cxx}} \ | |
4a6b0d54 AF |
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 | ||
9c404149 AM |
97 | # Location of autoconf macros |
98 | %_aclocaldir %(aclocal --print-ac-dir) | |
99 | ||
e2804f99 AM |
100 | # Location of omf files |
101 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
102 | ||
e987a186 | 103 | # Location of pkgconfig files |
d7021551 | 104 | %_pkgconfigdir /usr/lib/pkgconfig |
e987a186 | 105 | |
9c404149 AM |
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 | ||
e987a186 JB |
112 | # Location of fonts directories |
113 | %_fontsdir /usr/share/fonts | |
114 | ||
9c404149 AM |
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 | ||
8377d27d | 124 | # The directory holding Linux kernel sources |
125 | %_kernelsrcdir /usr/src/linux | |
126 | ||
9c404149 | 127 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
8f74418b | 128 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
9c404149 | 129 | |
8f74418b MM |
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)") | |
b9d5d440 | 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) | |
87be1cf0 | 140 | |
e00dd7f6 | 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 | ||
9c404149 AM |
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;} \ | |
8f74418b | 187 | echo "Strip executable binaries, archives and shared object files."; \ |
9c404149 AM |
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`; \ | |
8f74418b MM |
193 | elfarchiveslist=`echo $filelist | xargs -r file | \ |
194 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
9c404149 AM |
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; \ | |
8f74418b MM |
200 | fi; \ |
201 | if [ -n "$elfarchiveslist" ]; then \ | |
202 | strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ | |
9c404149 AM |
203 | fi; } \ |
204 | } } | |
8f74418b | 205 | |
d72c185f | 206 | #----------------------------------------------------------------- |
ccb8ae8d | 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 { \ | |
ccb8ae8d | 213 | %{!?no_install_post_compress_modules: \ |
fc1ea397 | 214 | echo "Compress kernel modules if any."; \ |
ccb8ae8d | 215 | %{?verbose:set -x;} \ |
d618340e | 216 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ |
fc1ea397 | 217 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \ |
d618340e | 218 | xargs -r %{__gzip} -9nf; \ |
fc1ea397 JB |
219 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \ |
220 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done \ | |
d618340e | 221 | fi; \ |
ccb8ae8d | 222 | } } |
9c404149 AM |
223 | |
224 | %_source_payload w9.gzdio | |
225 | %_binary_payload w9.bzdio | |
226 | ||
227 | #----------------------------------------------------------------- | |
228 | # post %install sequence: | |
229 | # - autodeps exceptions | |
230 | # - compress all man and info pages, | |
231 | # - strip all ELF executables and ELF shared objects if not %debug. | |
8f74418b | 232 | # - compress kernel modules if any |
9c404149 AM |
233 | |
234 | ################################################################### | |
235 | # Requires/Provides automation | |
236 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
7126cc1b JK |
237 | %__spec_prep_pre \ |
238 | _autoreqprov=n \ | |
239 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
240 | %{?_noautoreq:_autoreqprov=y}\ | |
241 | %{?_noautoreqdep:_autoreqprov=y}\ | |
242 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
243 | %{?_noautoprov:_autoreqprov=y}\ | |
f07a68c3 | 244 | %{?_noautocompressdoc:_autoreqprov=y}\ |
7126cc1b JK |
245 | if [ "$_autoreqprov" = "y" ] ; then \ |
246 | if [ -f %{_builddir}/__rpm_lock ] ; then \ | |
247 | echo "Some package using \%_noauto* macros is already being built" >&2 \ | |
248 | echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \ | |
249 | exit 1 \ | |
250 | else \ | |
251 | rm -f %{_builddir}/__rpm_*\ | |
252 | touch %{_builddir}/__rpm_lock \ | |
253 | fi \ | |
254 | fi \ | |
f07a68c3 | 255 | %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\ |
9c404149 AM |
256 | %{nil} |
257 | ||
ef437f4b | 258 | %__os_install_post \ |
9c404149 AM |
259 | %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\ |
260 | %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\ | |
261 | %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\ | |
262 | %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\ | |
263 | %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\ | |
264 | %{__spec_install_post_strip}\ | |
265 | %{__spec_install_post_compress_docs}\ | |
ccb8ae8d | 266 | %{__spec_install_post_compress_modules}\ |
9c404149 | 267 | %{__arch_install_post}\ |
9c404149 AM |
268 | %{nil} |
269 | ||
270 | %__spec_clean_pre %{___build_pre}\ | |
7126cc1b JK |
271 | _autoreqprov=n \ |
272 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
273 | %{?_noautoreq:_autoreqprov=y}\ | |
274 | %{?_noautoreqdep:_autoreqprov=y}\ | |
275 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
276 | %{?_noautoprov:_autoreqprov=y}\ | |
277 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
f07a68c3 | 278 | %{?_noautocompressdoc:_autoreqprov=y}\ |
7126cc1b JK |
279 | if [ "$_autoreqprov" = "y" ] ; then \ |
280 | rm -f %{_builddir}/__rpm_* \ | |
281 | fi \ | |
9c404149 AM |
282 | %{nil} |
283 | ||
284 | ||
285 | #%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*" | |
286 | #%_noautoreq %{nil} | |
287 | #%_noautoreqdep %{nil} | |
288 | #%_noautoprovfiles %{nil} | |
289 | #%_noautoprov %{nil} | |
8f74418b MM |
290 | %_missing_doc_files_terminate_build 1%{nil} |
291 | %_unpackaged_files_terminate_build %{nil} |