]>
Commit | Line | Data |
---|---|---|
1 | # PLD rpm macros | |
2 | ||
3 | %epoch 0 | |
4 | %x8664 x86_64 amd64 ia32e | |
5 | ||
6 | # kernel compiler | |
7 | %kgcc gcc | |
8 | %kgcc_package gcc | |
9 | ||
10 | %_source_payload w9.gzdio | |
11 | %_binary_payload w9.bzdio | |
12 | ||
13 | # Build system path macros. | |
14 | # | |
15 | %__autoconf autoconf %{?debug:-Wall} | |
16 | %__automake automake -a -c -f --foreign | |
17 | %__autopoint autopoint --force | |
18 | ||
19 | %__gettextize { \ | |
20 | if ! gettextize --version | grep -q '0\.10\.' ; then \ | |
21 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ | |
22 | gettextize --copy --force --no-changelog; \ | |
23 | else \ | |
24 | gettextize --copy --force --no-changelog --intl; \ | |
25 | fi; \ | |
26 | if [ ! -f po/Makevars ]; then \ | |
27 | cp -f po/Makevars{.template,}; \ | |
28 | fi; \ | |
29 | else \ | |
30 | gettextize --copy --force; \ | |
31 | fi; \ | |
32 | } | |
33 | ||
34 | %__glib_gettextize glib-gettextize --copy --force | |
35 | %__gnome_doc_common gnome-doc-common --copy | |
36 | %__gtkdocize gtkdocize --copy | |
37 | %__intltoolize intltoolize --copy --force | |
38 | %__libtoolize libtoolize --copy --force | |
39 | ||
40 | %dependencytracking %{nil} | |
41 | ||
42 | # Relations between package names that cause dependency loops | |
43 | # with legacy packages that cannot be fixed. Relations are | |
44 | # specified as | |
45 | # p>q | |
46 | # where package p has a Requires: on something that package q Provides: | |
47 | # | |
48 | # XXX Note: that there cannot be any whitespace within the string "p>q", | |
49 | # and that both p and q are package names (i.e. no version/release). | |
50 | %_dependency_whiteout %{nil} | |
51 | ||
52 | #----------------------------------------------------------------- | |
53 | %configure2_13 { \ | |
54 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ | |
55 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
56 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
57 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ | |
58 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ | |
59 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ | |
60 | %{?__cc:CC="%{__cc}" ; export CC ; } \ | |
61 | %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ | |
62 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ | |
63 | --host=%{_target_platform} \ | |
64 | --prefix=%{_prefix} \ | |
65 | --exec-prefix=%{_exec_prefix} \ | |
66 | --bindir=%{_bindir} \ | |
67 | --sbindir=%{_sbindir} \ | |
68 | --sysconfdir=%{_sysconfdir} \ | |
69 | --datadir=%{_datadir} \ | |
70 | --includedir=%{_includedir} \ | |
71 | --libdir=%{_libdir} \ | |
72 | --libexecdir=%{_libexecdir} \ | |
73 | --localstatedir=%{_localstatedir} \ | |
74 | --sharedstatedir=%{_sharedstatedir} \ | |
75 | --mandir=%{_mandir} \ | |
76 | --infodir=%{_infodir} \ | |
77 | --x-libraries=/usr/X11R6/%{_lib} \ | |
78 | %{dependencytracking} \ | |
79 | } | |
80 | ||
81 | #---------------------------------------------------------------- | |
82 | %global configure_cache 0 | |
83 | %configure_cache_file %{buildroot}.configure.cache | |
84 | ||
85 | %configure {./configure \ | |
86 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ | |
87 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
88 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ | |
89 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
90 | CPPFLAGS="${CPPFLAGS:-}" \ | |
91 | %{?__cc:CC="%{__cc}"} \ | |
92 | %{?__cxx:CXX="%{__cxx}"} \ | |
93 | --host=%{_target_platform} \ | |
94 | --build=%{_target_platform} \ | |
95 | --prefix=%{_prefix} \ | |
96 | --exec-prefix=%{_exec_prefix} \ | |
97 | --bindir=%{_bindir} \ | |
98 | --sbindir=%{_sbindir} \ | |
99 | --sysconfdir=%{_sysconfdir} \ | |
100 | --datadir=%{_datadir} \ | |
101 | --includedir=%{_includedir} \ | |
102 | --libdir=%{_libdir} \ | |
103 | --libexecdir=%{_libexecdir} \ | |
104 | --localstatedir=%{_localstatedir} \ | |
105 | --sharedstatedir=%{_sharedstatedir} \ | |
106 | --mandir=%{_mandir} \ | |
107 | --infodir=%{_infodir} \ | |
108 | --x-libraries=/usr/X11R6/%{_lib} \ | |
109 | %{dependencytracking} \ | |
110 | %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \ | |
111 | } | |
112 | ||
113 | # ------------------------------------------------------------------------ | |
114 | # Overloading of some basic macros | |
115 | %prep \ | |
116 | %%prep\ | |
117 | LANG=C\ | |
118 | export LANG\ | |
119 | unset DISPLAY ||:\ | |
120 | unset LINGUAS ||:\ | |
121 | %{nil} | |
122 | ||
123 | %build %%build\ | |
124 | LANG=C\ | |
125 | export LANG\ | |
126 | unset DISPLAY ||:\ | |
127 | unset LINGUAS ||:\ | |
128 | %{nil} | |
129 | ||
130 | %install \ | |
131 | %if 0%{?_enable_debug_packages}\ | |
132 | %{?buildsubdir:%{debug_package}}\ | |
133 | %endif\ | |
134 | %%install\ | |
135 | LANG=C\ | |
136 | export LANG\ | |
137 | unset DISPLAY ||:\ | |
138 | unset LINGUAS ||:\ | |
139 | %{nil} | |
140 | ||
141 | # Location of autoconf macros | |
142 | %_aclocaldir %(aclocal --print-ac-dir) | |
143 | ||
144 | # Location of omf files | |
145 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
146 | ||
147 | # Location of pkgconfig files | |
148 | %_pkgconfigdir /usr/%{_lib}/pkgconfig | |
149 | ||
150 | # Location of desktop files | |
151 | %_desktopdir /usr/share/applications | |
152 | %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead | |
153 | ||
154 | # Location of pixmaps for applnk/desktop files | |
155 | %_pixmapsdir /usr/share/pixmaps | |
156 | ||
157 | # Location of themable icons for applnk/desktop files | |
158 | %_iconsdir /usr/share/icons | |
159 | ||
160 | # Location of fonts directories | |
161 | %_fontsdir /usr/share/fonts | |
162 | ||
163 | # Location of Gtk and associated libraries documentation | |
164 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html | |
165 | ||
166 | # Location of KDE documentation | |
167 | %_kdedocdir %{_defaultdocdir}/kde/HTML | |
168 | ||
169 | # unsermake script | |
170 | %__unsermake /usr/share/unsermake/unsermake | |
171 | ||
172 | # Current date | |
173 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
174 | ||
175 | # tmp directory | |
176 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
177 | ||
178 | # Example files, programs, scripts... | |
179 | %_examplesdir /usr/src/examples | |
180 | ||
181 | # The directory holding Linux kernel sources | |
182 | %_kernelsrcdir /usr/src/linux | |
183 | ||
184 | # If non-empty "debug" macro defined, add "dbg" suffix to release number | |
185 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm | |
186 | ||
187 | # Requires name = version-release | |
188 | %requires_releq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not") | |
189 | ||
190 | %releq_kernel_up() %(LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
191 | %releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
192 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
193 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)") | |
194 | ||
195 | %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not") | |
196 | ||
197 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR) | |
198 | ||
199 | # kernel version-release handling | |
200 | %__kernel_ver %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | head -n 1 | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } /^EXTRAVERSION/ { ever = $0; gsub(/EXTRAVERSION.*=/, NIL, ever); gsub(/ /, NIL, ever); } END { printf("%d.%d.%d%s", ver, plev, slev, ever); }' %{_kernelsrcdir}/Makefile 2> /dev/null)) | |
201 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not") | |
202 | %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not") | |
203 | %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})} | |
204 | %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g') | |
205 | ||
206 | # sgml macros | |
207 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ; | |
208 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ; | |
209 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
210 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ; | |
211 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ; | |
212 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ; | |
213 | %docbook_sgmlcat_fix() { for l in \ | |
214 | '' \ | |
215 | ' -- default decl --' \ | |
216 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
217 | ' -- hacks for opensp --' \ | |
218 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
219 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
220 | '' \ | |
221 | ; do echo $l; done >> %1 \ | |
222 | } | |
223 | ||
224 | #----------------------------------------------------------------- | |
225 | # find and gzip all files in %{_mandir} and %{infodir} | |
226 | # | |
227 | # Requires: xargs, find | |
228 | # | |
229 | #%no_install_post_compress_docs 1 | |
230 | %__spec_install_post_compress_docs { \ | |
231 | %{!?no_install_post_compress_docs: \ | |
232 | echo "Compress man and info pages."; \ | |
233 | %{?verbose:set -x;} \ | |
234 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
235 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
236 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
237 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
238 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
239 | fi; \ | |
240 | done; \ | |
241 | } } | |
242 | ||
243 | #----------------------------------------------------------------- | |
244 | # Strip executable binaries and shared object files | |
245 | # | |
246 | # Requires: find, awk, strip, cut, xargs | |
247 | # | |
248 | #%no_install_post_strip 1 | |
249 | %__spec_install_post_strip {%{!?debug: \ | |
250 | %{!?no_install_post_strip: \ | |
251 | %{?verbose:set -x;} \ | |
252 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
253 | echo "Strip executable binaries, archives and shared object files."; \ | |
254 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \ | |
255 | elfexelist=`echo $filelist | xargs -r file | \ | |
256 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
257 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
258 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
259 | elfarchiveslist=`echo $filelist | xargs -r file | \ | |
260 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
261 | if [ -n "$elfexelist" ]; then \ | |
262 | %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \ | |
263 | fi; \ | |
264 | if [ -n "$elfsharedlist" ]; then \ | |
265 | %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ | |
266 | fi; \ | |
267 | if [ -n "$elfarchiveslist" ]; then \ | |
268 | %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ | |
269 | fi; \ | |
270 | fi; } \ | |
271 | } } | |
272 | ||
273 | #----------------------------------------------------------------- | |
274 | # remove all RPATH from executable binaries and shared object files | |
275 | # | |
276 | # Requires: find, awk, cut, xargs, chrpath, uname | |
277 | # | |
278 | #%no_install_post_chrpath 1 | |
279 | %__spec_install_post_chrpath {%{!?debug: \ | |
280 | %{!?no_install_post_chrpath: \ | |
281 | %{?verbose:set -x;} \ | |
282 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
283 | echo "Remove RPATH from executable binaries and shared object files."; \ | |
284 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ | |
285 | awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ | |
286 | while read file ; do \ | |
287 | rpath= ; \ | |
288 | chmod u+w "$file"; \ | |
289 | for dir in `chrpath -l "$file" | \ | |
290 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ | |
291 | case $dir in \ | |
292 | /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \ | |
293 | echo "remove-rpath: $dir in $file"; \ | |
294 | ;; \ | |
295 | * ) \ | |
296 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
297 | else rpath="$rpath:$dir" ; fi ; \ | |
298 | ;; \ | |
299 | esac ; \ | |
300 | done ; \ | |
301 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
302 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
303 | done; \ | |
304 | fi; } \ | |
305 | } } | |
306 | ||
307 | #----------------------------------------------------------------- | |
308 | # Find and gzip all kernel modules | |
309 | # | |
310 | # Requires: find | |
311 | # | |
312 | #%no_install_post_compress_modules 1 | |
313 | %__spec_install_post_compress_modules { \ | |
314 | %{!?no_install_post_compress_modules: \ | |
315 | %{?verbose:set -x;} \ | |
316 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
317 | echo "Compress kernel modules if any."; \ | |
318 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ | |
319 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \ | |
320 | xargs -r %{__gzip} -9nf; \ | |
321 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \ | |
322 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
323 | fi; \ | |
324 | fi; \ | |
325 | } } | |
326 | ||
327 | #----------------------------------------------------------------- | |
328 | # Update GConf2 schemas | |
329 | # | |
330 | # Requires: GConf2 | |
331 | # | |
332 | %gconf_schema_install() \ | |
333 | umask 022; \ | |
334 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null \ | |
335 | %{nil} | |
336 | ||
337 | %gconf_schema_uninstall() \ | |
338 | if [ $1 = 0 ]; then \ | |
339 | umask 022; \ | |
340 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \ | |
341 | fi \ | |
342 | %{nil} | |
343 | ||
344 | #----------------------------------------------------------------- | |
345 | # Update desktop MIME database | |
346 | # requires: desktop-file-utils | |
347 | # | |
348 | %update_desktop_database_post() {{ \ | |
349 | umask 022; \ | |
350 | /usr/bin/update-desktop-database; \ | |
351 | }} | |
352 | ||
353 | %update_desktop_database_postun() {{ \ | |
354 | if [ $1 = 0 ]; then \ | |
355 | umask 022; \ | |
356 | /usr/bin/update-desktop-database; \ | |
357 | fi \ | |
358 | }} | |
359 | ||
360 | #----------------------------------------------------------------- | |
361 | # Update scrollkeeper database | |
362 | # requires: scrollkeeper | |
363 | # | |
364 | %scrollkeeper_update_post() \ | |
365 | /usr/bin/scrollkeeper-update -q; \ | |
366 | %{nil} | |
367 | ||
368 | %scrollkeeper_update_postun() \ | |
369 | if [ $1 = 0 ]; then \ | |
370 | /usr/bin/scrollkeeper-update -q; \ | |
371 | fi \ | |
372 | %{nil} | |
373 | ||
374 | #----------------------------------------------------------------- | |
375 | # Run ldconfig after installing/deinstalling libraries | |
376 | # | |
377 | %ldconfig_post() \ | |
378 | /sbin/ldconfig; \ | |
379 | %{nil} | |
380 | ||
381 | %ldconfig_postun() \ | |
382 | /sbin/ldconfig; \ | |
383 | %{nil} | |
384 | ||
385 | #----------------------------------------------------------------- | |
386 | # post %install sequence: | |
387 | # - autodeps exceptions | |
388 | # - compress all man and info pages, | |
389 | # - strip all ELF executables and ELF shared objects if not %debug. | |
390 | # - compress kernel modules if any | |
391 | ||
392 | ################################################################### | |
393 | # Requires/Provides automation | |
394 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
395 | # | |
396 | %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} | |
397 | %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} | |
398 | %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}} | |
399 | %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} | |
400 | %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}} | |
401 | #%_noautocompressdoc %{nil} | |
402 | # | |
403 | %_missing_doc_files_terminate_build 1%{nil} | |
404 | %_unpackaged_files_terminate_build %{nil} | |
405 | # (X)emacs support | |
406 | %___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}' | |
407 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) | |
408 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
409 | ||
410 | %__php_provides %{nil} | |
411 | %__php_requires %{nil} | |
412 | %__perl_provides %{nil} | |
413 | %__perl_requires %{nil} | |
414 | %__mono_provides %{nil} | |
415 | %__mono_requires %{nil} | |
416 | ||
417 | # Perl specific macro definitions. | |
418 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) | |
419 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
420 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
421 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) | |
422 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) | |
423 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
424 | ||
425 | # Ruby | |
426 | %ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]') | |
427 | %ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]') | |
428 | %ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_vers | |
429 | ion"], "system")') | |
430 | %ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]') | |
431 | %ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]') | |
432 | ||
433 | %php_pear_dir %{_datadir}/pear | |
434 | ||
435 | # directory where php includes are installed on system. | |
436 | %__php_includedir /usr/include/php | |
437 | # extract php/zend api versions | |
438 | %php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR) | |
439 | %php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR) | |
440 | %php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR) | |
441 | %zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR) | |
442 | %zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR) | |
443 | %zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR}) | |
444 | ||
445 | # helper macro | |
446 | %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}} | |
447 | ||
448 | # macros for public use | |
449 | # for php extensions (php-pecl) | |
450 | %requires_php_extension %{__php_api_requires modules_api php_api_version} \ | |
451 | %{__php_api_requires -v %php_major_version debug php_debug} \ | |
452 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
453 | ||
454 | # for zend extensions | |
455 | %requires_zend_extension %{__php_api_requires zend_module_api} \ | |
456 | %{__php_api_requires zend_extension_api} \ | |
457 | %{__php_api_requires -v %php_major_version debug php_debug} \ | |
458 | %{__php_api_requires -v %php_major_version thread-safety zend_zts} | |
459 | ||
460 | # Python specific macro definitions. | |
461 | # python main version | |
462 | %py_ver %(python -c "import sys; print sys.version[:3]") | |
463 | ||
464 | # directories | |
465 | %py_prefix %(python -c "import sys; print sys.prefix") | |
466 | %py_libdir %{py_prefix}/%{_lib}/python%{py_ver} | |
467 | %py_scriptdir %{py_prefix}/share/python%{py_ver} | |
468 | %py_incdir /usr/include/python%{py_ver} | |
469 | %py_sitedir %{py_libdir}/site-packages | |
470 | %py_sitescriptdir %{py_scriptdir}/site-packages | |
471 | %py_dyndir %{py_libdir}/lib-dynload | |
472 | ||
473 | # pure python modules compilation | |
474 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" | |
475 | ||
476 | %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" | |
477 | ||
478 | # Software written in Python language require Python with main version | |
479 | %pyrequires_eq() Requires: %1 | |
480 | ||
481 | # Hardlink binary identical .pyc and .pyo files | |
482 | # (idea by glen <at> pld-linux <dot> org) | |
483 | %__spec_install_post_py_hardlink {\ | |
484 | %{!?no_install_post_py_hardlink: \ | |
485 | [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \ | |
486 | b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \ | |
487 | if cmp -s "$a" "$b"; then \ | |
488 | ln -f "$a" "$b"; \ | |
489 | fi; \ | |
490 | done \ | |
491 | } } | |
492 | ||
493 | # remove python sources, so that check-files won't complain | |
494 | # (idea by glen <at> pld-linux <dot> org) | |
495 | %py_postclean() \ | |
496 | for d in %{py_sitescriptdir} %{py_sitedir} %*; do \ | |
497 | [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\ | |
498 | done \ | |
499 | %{nil} | |
500 | ||
501 | # depmod macro | |
502 | %depmod() { \ | |
503 | umask 022; \ | |
504 | if [ -e /boot/System.map-%1 ]; then \ | |
505 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ | |
506 | else \ | |
507 | if [ -e /boot/System.map ]; then \ | |
508 | /sbin/depmod -a -F /boot/System.map %1; \ | |
509 | else \ | |
510 | /sbin/depmod -a %1; \ | |
511 | fi \ | |
512 | fi; \ | |
513 | } | |
514 | ||
515 | # XMMS specific macros | |
516 | %xmms_prefix %(xmms-config --prefix 2>/dev/null) | |
517 | %xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null) | |
518 | %xmms_version %(xmms-config --version 2>/dev/null) | |
519 | %xmms_datadir %(xmms-config --data-dir 2>/dev/null) | |
520 | %xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null) | |
521 | %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null) | |
522 | %xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null) | |
523 | %xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null) | |
524 | %xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null) | |
525 | %xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null) | |
526 | ||
527 | %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/') | |
528 | ||
529 | # user/group checking macros | |
530 | # | |
531 | # Usage: | |
532 | # %userremove myuser | |
533 | # | |
534 | %userremove /usr/lib/rpm/user_group.sh user del | |
535 | %groupremove /usr/lib/rpm/user_group.sh group del | |
536 | # | |
537 | # Usage: | |
538 | # if %usertestrm myuser; then | |
539 | # /usr/sbin/userdel -r myuser | |
540 | # Note: | |
541 | # use these macros only if you need to call userdel/groupdel with | |
542 | # a non-standard option or take an extra action; otherwise use the | |
543 | # %userremove/%groupremove macros | |
544 | # | |
545 | %usertestrm /usr/lib/rpm/user_group.sh user testrm | |
546 | %grouptestrm /usr/lib/rpm/user_group.sh group testrm | |
547 | # user group membership management macros | |
548 | # | |
549 | # Usage: | |
550 | # %addusertogroup myuser agroup | |
551 | # | |
552 | %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup | |
553 | ||
554 | # banner support (useful in {pre,post}{,un} and triggers) | |
555 | # | |
556 | # Usage: | |
557 | # %banner name [-a] [-e] [-n] [-tn] <<EOF | |
558 | # the banner text, the banner text | |
559 | # the banner text, and following line | |
560 | #EOF | |
561 | # You can use any form of here-document, <<'EOF' <<-EOT will do. | |
562 | # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. | |
563 | # | |
564 | # -a - append to the banner | |
565 | # -e - send to stderr instead of stdout | |
566 | # -n - no show banner (overrides -t) | |
567 | # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 | |
568 | %banner(aent:) \ | |
569 | RPM_SCRIPTVERBOSITY=5 \ | |
570 | [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ | |
571 | if [ -x /usr/bin/banner.sh ]; then \ | |
572 | CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \ | |
573 | else \ | |
574 | CMD="cat%{-e: >&2}" \ | |
575 | fi \ | |
576 | eval $CMD %2%{?3: %3} \ | |
577 | %nil | |
578 | ||
579 | # useradd/groupadd macros written by glen@pld-linux.org. | |
580 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
581 | # | |
582 | # Usage: | |
583 | # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment] | |
584 | # [-g initial_group] [-G group[,...]] login | |
585 | # | |
586 | # -u uid. REQUIRED | |
587 | # -g gid/group. REQUIRED | |
588 | # -s defaults to /bin/false | |
589 | # -d defaults to /usr/share/empty | |
590 | # -c No default | |
591 | # -r is accepted but ignored (it's always set) | |
592 | # -k skeleton dir. defaults to /usr/share/empty | |
593 | # rpm specific flags | |
594 | # -P package name. defaults to %{name} | |
595 | # | |
596 | %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \ | |
597 | %{!-u:%{error:useradd: Required argument -u missing}} \ | |
598 | %{!-g:%{error:useradd: Required argument -g missing}} \ | |
599 | %{!?1:%{error:useradd: Required parameter login missing}} \ | |
600 | if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \ | |
601 | if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \ | |
602 | echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
603 | exit 1 \ | |
604 | fi \ | |
605 | else \ | |
606 | echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \ | |
607 | /usr/sbin/useradd \\\ | |
608 | %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\ | |
609 | -u %{-u*} \\\ | |
610 | -r \\\ | |
611 | -d %{-d*}%{!-d:/usr/share/empty} \\\ | |
612 | -s %{-s*}%{!-s:/bin/false} \\\ | |
613 | %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\ | |
614 | -g %{-g*} \\\ | |
615 | %{-M} \\\ | |
616 | %{-G:-G %{-G*}} \\\ | |
617 | %{expand:%{%{#}}} 1>&2 \ | |
618 | fi; | |
619 | ||
620 | # Usage: | |
621 | # %groupadd [-P package] [-g gid] group | |
622 | # | |
623 | # -g gid. REQUIRED | |
624 | # | |
625 | # Sample: | |
626 | # %groupadd -P %{name}-base -g %{gid} %{name} | |
627 | ||
628 | %groupadd(g:P:rfo) \ | |
629 | %{!-g:%{error:groupadd: Required argument -g missing}} \ | |
630 | %{!?1:%{error:groupadd: Required parameter group missing}} \ | |
631 | if [ -n "`/usr/bin/getgid %{1}`" ]; then \ | |
632 | if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \ | |
633 | echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
634 | exit 1 \ | |
635 | fi \ | |
636 | else \ | |
637 | echo "Adding group %{1} GID=%{-g*}." \ | |
638 | /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 \ | |
639 | fi; | |
640 | ||
641 | # apache_config_{install/uninstall} macros written by glen@pld-linux.org. | |
642 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
643 | # | |
644 | # The config is installed/removed inside trigger, this means that you can any | |
645 | # time install apache1 or apache package and the configuration file is updated. | |
646 | # if you don't need the config for various reason for specific apache, just | |
647 | # remove the symlink from apache config directory. the trigger will not put the | |
648 | # config again to that version of apache. In other words the config is linked | |
649 | # to apache config directory on first install of PACKAGE or apache. | |
650 | # | |
651 | # should be called in trigger body: | |
652 | # %triggerin -- apache1 >= 1.3.33-2 | |
653 | # %apache_config_install -v 1 | |
654 | # | |
655 | # Add package's apache config to apache config. | |
656 | # | |
657 | # Usage: | |
658 | # %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99 | |
659 | # | |
660 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
661 | # -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf. | |
662 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
663 | # | |
664 | # Internal macros. don't use ;). | |
665 | # expands apache config dir by apache version at build time. | |
666 | %__apache_confdir() %(if [ %{1} = 1 ]; then echo /etc/apache/conf.d; elif [ %{1} = 2 ]; then echo /etc/httpd/httpd.conf; else echo >&2 Unknown apache version specified; fi) | |
667 | # expands apache service name by apache version at build time. | |
668 | %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi) | |
669 | ||
670 | %apache_config_install(v:c:n:) \ | |
671 | %{!-v:%{error:apache_config_install: Required argument -v missing}} \ | |
672 | %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ | |
673 | if [ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{__apache_confdir %{-v*}} ]; then\ | |
674 | ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\ | |
675 | fi\ | |
676 | # reload apache if the config symlink is there\ | |
677 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\ | |
678 | # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \ | |
679 | if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\ | |
680 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\ | |
681 | fi\ | |
682 | fi\ | |
683 | %{nil} | |
684 | ||
685 | # Remove package's apache config from apache config. | |
686 | # | |
687 | # Usage: | |
688 | # %apache_config_uninstall -v {1|2} -n 99 | |
689 | # | |
690 | # -v REQUIRED: specify apache version. can be 1 or 2. | |
691 | # -n OPTIONAL: specify config "slot". defaults to 99 | |
692 | %apache_config_uninstall(v:n:) \ | |
693 | %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \ | |
694 | %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \ | |
695 | # remove link if either of the packages are gone \ | |
696 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ | |
697 | if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \ | |
698 | rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \ | |
699 | if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \ | |
700 | /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \ | |
701 | fi \ | |
702 | fi \ | |
703 | fi \ | |
704 | %{nil} | |
705 | ||
706 | # see browser-plugins.spec / template-browser-plugin.spec | |
707 | # written by glen@pld-linux.org. | |
708 | %nsplugin_install(d:f) { \ | |
709 | # create link if it's first install of either of the packages \ | |
710 | if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \ | |
711 | ( \ | |
712 | %( \ | |
713 | for file in %{*}; do \ | |
714 | echo echo Installing $file to %{-d*}; \ | |
715 | echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \ | |
716 | done ) \ | |
717 | ) | ( %banner -t 5 -e %{name}-in ); fi; \ | |
718 | } | |
719 | ||
720 | %nsplugin_uninstall(d:) { \ | |
721 | # remove link if either of the packages are gone \ | |
722 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ | |
723 | ( \ | |
724 | %( \ | |
725 | for file in %{*}; do \ | |
726 | echo echo Removing $file from %{-d*}; \ | |
727 | echo "rm -f %{-d*}/$file;"; \ | |
728 | done ) \ | |
729 | ) | ( %banner -t 5 -e %{name}-un ); fi; \ | |
730 | } | |
731 | ||
732 | # service macro. | |
733 | # | |
734 | # calls usual service restart on package %post, but skips the restart if | |
735 | # administrator has disabled automatic service restarts in either global | |
736 | # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file. | |
737 | # | |
738 | # written by glen@pld-linux.org. | |
739 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
740 | # | |
741 | # Usage: | |
742 | # %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"] | |
743 | # | |
744 | # -q be silent when service isn't started (for postun scriplets) | |
745 | # | |
746 | %service(q) {{ \ | |
747 | # we use function, not to globber namespace with useless variables \ | |
748 | skip_auto_restart() { \ | |
749 | . /etc/sysconfig/rpm; # global setting \ | |
750 | [ -f /etc/sysconfig/%1 ] && . /etc/sysconfig/%1; # per service setting \ | |
751 | echo ${RPM_SKIP_AUTO_RESTART:-no}; \ | |
752 | }; \ | |
753 | if [ -f /var/lock/subsys/%1 ]; then \ | |
754 | if [ $(skip_auto_restart) = no ]; then \ | |
755 | /etc/rc.d/init.d/%1 %2 1>&2; \ | |
756 | %{!-q:else} \ | |
757 | %{!-q:echo 'Run "/etc/rc.d/init.d/%1 %2" to %2 %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \ | |
758 | fi \ | |
759 | %{!-q:else} \ | |
760 | %{!-q:echo 'Run "/etc/rc.d/init.d/%1 start" to start %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \ | |
761 | fi }; } | |
762 |