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