]> git.pld-linux.org Git - packages/rpm.git/blob - rpm.macros
- fix webapps module restart
[packages/rpm.git] / rpm.macros
1 # $Revision$, $Date$
2 # PLD rpm macros
3
4 %epoch          0
5 %x8664          x86_64 amd64 ia32e
6
7 # kernel compiler
8 %kgcc           %{__cc}
9 %kgcc_package   gcc
10
11 # Build system path macros.
12 #
13 %__autoconf             autoconf %{?debug:-Wall}
14 %__automake             automake -a -c -f --foreign
15 %__autopoint            autopoint --force
16
17 %__gettextize { \
18 if ! gettextize --version | grep -q '0\.10\.' ; then \
19         if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
20                 gettextize --copy --force --no-changelog; \
21         else \
22                 gettextize --copy --force --no-changelog --intl; \
23         fi; \
24         if [ ! -f po/Makevars ]; then \
25                 cp -f po/Makevars{.template,}; \
26         fi; \
27 else \
28         gettextize --copy --force; \
29 fi; \
30 }
31
32 %__glib_gettextize      glib-gettextize --copy --force
33 %__gnome_doc_common     gnome-doc-common --copy
34 %__gtkdocize            gtkdocize --copy
35 %__intltoolize          intltoolize --copy --force
36 %__libtoolize           libtoolize --copy --force
37
38 #       The number of cvs changelog entries kept when building package.
39 %_buildchangelogtruncate 20
40
41 %dependencytracking     %{nil}
42
43 #       Relations between package names that cause dependency loops
44 #       with legacy packages that cannot be fixed. Relations are
45 #       specified as
46 #               p>q
47 #       where package p has a Requires: on something that package q Provides:
48 #
49 # XXX   Note: that there cannot be any whitespace within the string "p>q",
50 #       and that both p and q are package names (i.e. no version/release).
51 %_dependency_whiteout   %{nil}
52
53 #-----------------------------------------------------------------
54 %configure2_13 { \
55  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
56  LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
57  CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
58  CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
59  FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
60  CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
61  %{?__cc:CC="%{__cc}" ; export CC ; } \
62  %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
63  %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
64         --host=%{_target_platform} \
65         --prefix=%{_prefix} \
66         --exec-prefix=%{_exec_prefix} \
67         --bindir=%{_bindir} \
68         --sbindir=%{_sbindir} \
69         --sysconfdir=%{_sysconfdir} \
70         --datadir=%{_datadir} \
71         --includedir=%{_includedir} \
72         --libdir=%{_libdir} \
73         --libexecdir=%{_libexecdir} \
74         --localstatedir=%{_localstatedir} \
75         --sharedstatedir=%{_sharedstatedir} \
76         --mandir=%{_mandir} \
77         --infodir=%{_infodir} \
78         --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
79         %{dependencytracking} \
80 }
81
82 %cmake { \
83 CC="%{__cc}" \
84 CXX="%{__cxx}" \
85 CFLAGS="%{rpmcflags}" \
86 CXXFLAGS="%{rpmcxxflags}" \
87 cmake \
88 }
89
90 #----------------------------------------------------------------
91 %global configure_cache 0
92 %configure_cache_file   %{buildroot}.configure.cache
93
94 %configure {./configure \
95         LDFLAGS="${LDFLAGS:-%rpmldflags}" \
96         CFLAGS="${CFLAGS:-%rpmcflags}" \
97         CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
98         FFLAGS="${FFLAGS:-%rpmcflags}" \
99         CPPFLAGS="${CPPFLAGS:-}" \
100         %{?__cc:CC="%{__cc}"} \
101         %{?__cxx:CXX="%{__cxx}"} \
102         --host=%{_target_platform} \
103         --build=%{_target_platform} \
104         --prefix=%{_prefix} \
105         --exec-prefix=%{_exec_prefix} \
106         --bindir=%{_bindir} \
107         --sbindir=%{_sbindir} \
108         --sysconfdir=%{_sysconfdir} \
109         --datadir=%{_datadir} \
110         --includedir=%{_includedir} \
111         --libdir=%{_libdir} \
112         --libexecdir=%{_libexecdir} \
113         --localstatedir=%{_localstatedir} \
114         --sharedstatedir=%{_sharedstatedir} \
115         --mandir=%{_mandir} \
116         --infodir=%{_infodir} \
117         --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
118         %{dependencytracking} \
119         %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \
120 }
121
122 # ------------------------------------------------------------------------
123 # Overloading of some basic macros
124 %prep \
125 %%prep\
126 LANG=C\
127 export LANG\
128 unset DISPLAY ||:\
129 unset LINGUAS ||:\
130 %{nil}
131
132 %build %%build\
133 LANG=C\
134 export LANG\
135 unset DISPLAY ||:\
136 unset LINGUAS ||:\
137 %{nil}
138
139 %install \
140 %if 0%{?_enable_debug_packages}\
141 %{?buildsubdir:%{debug_package}}\
142 %endif\
143 %%install\
144 LANG=C\
145 export LANG\
146 unset DISPLAY ||:\
147 unset LINGUAS ||:\
148 %{nil}
149
150 # Location of autoconf macros
151 %_aclocaldir    %(aclocal --print-ac-dir)
152
153 # Location of omf files
154 %_omf_dest_dir  %(scrollkeeper-config --omfdir)
155
156 # Location of pkgconfig files
157 %_pkgconfigdir  /usr/%{_lib}/pkgconfig
158
159 # Location of desktop files
160 %_desktopdir    /usr/share/applications
161 %_applnkdir     ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
162
163 # Location of pixmaps for applnk/desktop files
164 %_pixmapsdir    /usr/share/pixmaps
165
166 # Location of themable icons for applnk/desktop files
167 %_iconsdir      /usr/share/icons
168
169 # Location of fonts directories
170 %_fontsdir      /usr/share/fonts
171
172 # Location of Gtk and associated libraries documentation
173 %_gtkdocdir     %{_defaultdocdir}/gtk-doc/html
174
175 # Location of KDE documentation
176 %_kdedocdir     %{_defaultdocdir}/kde/HTML
177
178 # unsermake script
179 %__unsermake /usr/share/unsermake/unsermake
180
181 # Current date
182 %date           %(LC_ALL="C" date +"%a %b %d %Y")
183
184 # tmp directory
185 %tmpdir         %(echo "${TMPDIR:-/tmp}")
186
187 # Example files, programs, scripts...
188 %_examplesdir   /usr/src/examples
189
190 # Alternative kernel type/version
191 %alt_kernel     %{nil}%{?_alt_kernel:-%{?_alt_kernel}}
192
193 # The directory holding Linux kernel sources
194 %_kernelsrcdir  /usr/src/linux%{alt_kernel}
195
196 # If non-empty "debug" macro defined, add "dbg" suffix to release number
197 %_rpmfilename           %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
198
199 # Requires name = version-release
200 %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")
201
202 %releq_kernel_up()              %((LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
203 %releq_kernel_smp()             %((LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
204 %requires_releq_kernel_up(s:)   Requires%{-s:(%{-s*})}: %releq_kernel_up
205 %requires_releq_kernel_smp(s:)  Requires%{-s:(%{-s*})}: %releq_kernel_smp
206
207 %requires_eq()          %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
208 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
209
210 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
211
212 # kernel version-release handling
213 %__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))
214 %__kernel_rel   %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not")
215 %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not")
216 %_kernel_ver    %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
217 %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
218
219 # sgml macros
220 %xmlcat_add()           /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
221 %xmlcat_del()           /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
222 %xmlcat_add_rewrite     /usr/bin/xmlcatalog --noout --add rewriteSystem
223 %xmlcat_create()        /usr/bin/xmlcatalog --noout --create %1 ;
224 %sgmlcat_add()          /usr/bin/install-catalog --add %1 %2 > /dev/null ;
225 %sgmlcat_del()          /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
226 %docbook_sgmlcat_fix() { for l in \
227 '' \
228 '  -- default decl --' \
229 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
230 '  -- hacks for opensp --' \
231 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
232 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd"                  "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
233 '' \
234 ; do echo $l; done >> %1 \
235 }
236
237 # minimum file size needed for compressed documents.
238 # just smaller files than this get larger when compressed.
239 # some stats:
240 # - 0 byte file compressed was 25 bytes .gz
241 # - 39 byte file was compressed as 57
242 # - with test/test.spec@man 158 byte file was compressed also 158
243 %_min_compress_bytes    159
244
245 #-----------------------------------------------------------------
246 # find and gzip all files in %{_mandir} and %{infodir}
247 #
248 # Requires: xargs, find
249 #
250 #%no_install_post_compress_docs 1
251 %__spec_install_post_compress_docs { \
252 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
253         echo "Compress man and info pages."; \
254         for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
255                 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
256                         find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \
257                         find "$RPM_BUILD_ROOT$i" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \
258                         find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
259                 fi; \
260         done; \
261 }; __spec_install_post_compress_docs } }
262
263 #-----------------------------------------------------------------
264 # Strip executable binaries and shared object files
265 #
266 # Requires: find, awk, strip, cut, xargs
267 #
268 #%no_install_post_strip 1
269 %__spec_install_post_strip {%{!?debug: \
270 %{!?no_install_post_strip:__spec_install_post_strip() { \
271         if [ -d "$RPM_BUILD_ROOT" ]; then \
272         echo "Strip executable binaries, archives and shared object files."; \
273         filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
274         elfexelist=`echo $filelist | xargs -r file | \
275                 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
276         elfsharedlist=`echo $filelist | xargs -r file | \
277                 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
278         elfarchiveslist=`echo $filelist | xargs -r file | \
279                 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
280         if [ -n "$elfexelist" ]; then \
281                 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
282         fi; \
283         if [ -n "$elfsharedlist" ]; then \
284                 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
285         fi; \
286         if [ -n "$elfarchiveslist" ]; then \
287                 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
288         fi; \
289 fi; }; __spec_install_post_strip } } }
290
291 #-----------------------------------------------------------------
292 # remove all RPATH from executable binaries and shared object files
293 #
294 # Requires: find, awk, cut, xargs, chrpath, uname
295 #
296 #%no_install_post_chrpath       1
297 %__spec_install_post_chrpath {%{!?debug: \
298 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
299 if [ -d "$RPM_BUILD_ROOT" ]; then \
300 echo "Remove RPATH from executable binaries and shared object files."; \
301 find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
302         awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
303 while read file ; do \
304         rpath= ; \
305         chmod u+w "$file"; \
306         for dir in `chrpath -l "$file" | \
307                         awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
308                         case $dir in \
309                         /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
310                                 echo "remove-rpath: $dir in $file"; \
311                                 ;; \
312                         * ) \
313                                 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
314                                 else rpath="$rpath:$dir" ; fi ; \
315                                 ;; \
316                         esac ; \
317         done ; \
318         if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
319         else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
320 done; \
321 fi; }; __spec_install_post_chrpath } } }
322
323 #-----------------------------------------------------------------
324 # Find and gzip all kernel modules
325 #
326 # Requires: find
327 #
328 #%no_install_post_compress_modules      1
329 %__spec_install_post_compress_modules { \
330 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
331         if [ -d "$RPM_BUILD_ROOT" ]; then \
332                 echo "Compress kernel modules if any."; \
333                 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
334                         find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
335                         xargs -r %{__gzip} -9nf; \
336                         find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
337                         while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
338                 fi; \
339         fi; \
340 }; __spec_install_post_compress_modules } }
341
342 # Remove common Perl files we don't package
343 %__spec_install_post_perl_clean {\
344 %{!?no_install_post_perl_clean: \
345 %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
346 } }
347
348 #-----------------------------------------------------------------
349 # Update GConf2 schemas
350 #
351 # Requires: GConf2
352 #
353 %gconf_schema_install() \
354         umask 022; \
355         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 \
356         %{nil}
357
358 %gconf_schema_uninstall() \
359 if [ $1 = 0 ]; then \
360         umask 022; \
361         GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
362 fi \
363 %{nil}
364
365 #-----------------------------------------------------------------
366 # Update desktop MIME database
367 # requires: desktop-file-utils
368 #
369 %update_desktop_database_post() {{ \
370         umask 022; \
371         /usr/bin/update-desktop-database; \
372 }}
373
374 %update_desktop_database_postun() {{ \
375 if [ $1 = 0 ]; then \
376         umask 022; \
377         /usr/bin/update-desktop-database; \
378 fi \
379 }}
380
381 #-----------------------------------------------------------------
382 # Update scrollkeeper database
383 # requires: scrollkeeper
384 #
385 %scrollkeeper_update_post() \
386         /usr/bin/scrollkeeper-update -q; \
387         %{nil}
388
389 %scrollkeeper_update_postun() \
390 if [ $1 = 0 ]; then \
391         /usr/bin/scrollkeeper-update -q; \
392 fi \
393 %{nil}
394
395 #-----------------------------------------------------------------
396 # post %install sequence:
397 # - autodeps exceptions
398 # - compress all man and info pages,
399 # - strip all ELF executables and ELF shared objects if not %debug.
400 # - compress kernel modules if any
401
402 ###################################################################
403 # Requires/Provides automation
404 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
405 #
406 %__noautoreqfiles       %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
407 %__noautoprovfiles      %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
408 %__noautoreq            %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
409 %__noautoreqdep         %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
410 %__noautoprov           %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
411 #%_noautocompressdoc    %{nil}
412 #
413 %_missing_doc_files_terminate_build     1%{nil}
414 %_unpackaged_files_terminate_build      %{nil}
415 # (X)emacs support
416 %___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;}'
417 %_emacs_lispdir %(emacs %___emacs_lispdir_helper)
418 %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
419
420 %__php_provides %{nil}
421 %__php_requires %{nil}
422 %__perl_provides %{nil}
423 %__perl_requires %{nil}
424 %__mono_provides %{nil}
425 %__mono_requires %{nil}
426
427 # Perl specific macro definitions.
428 %perl_privlib           %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
429 %perl_archlib           %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
430 %perl_vendorlib         %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
431 %perl_vendorarch        %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
432 %perl_sitelib           %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
433 %perl_sitearch          %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
434
435 # Ruby
436 %ruby_archdir           %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
437 %ruby_ridir             %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
438 %ruby_rubylibdir        %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
439 %ruby_sitearchdir       %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
440 %ruby_sitelibdir        %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
441 %ruby_version           %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)
442 %ruby_ver_requires_eq   Requires:       ruby(ver) = %ruby_version
443 %ruby_mod_ver_requires_eq       Requires:       ruby-modules(ver) = %ruby_version
444
445 %php_pear_dir   %{_datadir}/pear
446
447 # directory where php includes are installed on system.
448 %__php_includedir               /usr/include/php
449 # extract php/zend api versions
450 %php_major_version              %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
451 %php_api_version                %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
452 %php_pdo_api_version    %(awk '/#define PDO_DRIVER_API/{print $3}' %{__php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
453 %php_debug                              %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
454 %zend_module_api                %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
455 %zend_extension_api             %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
456 %zend_zts                               %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
457
458 # helper macro
459 %__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
460
461 # macros for public use
462 # for php extensions (php-pecl)
463 %requires_php_extension %{__php_api_requires modules_api php_api_version} \
464 %{__php_api_requires -v %php_major_version debug php_debug} \
465 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
466
467 # for zend extensions
468 %requires_zend_extension %{__php_api_requires zend_module_api} \
469 %{__php_api_requires zend_extension_api} \
470 %{__php_api_requires -v %php_major_version debug php_debug} \
471 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
472
473 # for php pdo modules (php-pecl-PDO_*)
474 %requires_php_pdo_module %{__php_api_requires PDO_API php_pdo_api_version}
475
476 # Python specific macro definitions.
477 # python main version
478 %py_ver         %(python -c "import sys; print sys.version[:3]")
479
480 # directories
481 %py_prefix              %(python -c "import sys; print sys.prefix")
482 %py_libdir              %{py_prefix}/%{_lib}/python%{py_ver}
483 %py_scriptdir   %{py_prefix}/share/python%{py_ver}
484 %py_incdir              /usr/include/python%{py_ver}
485 %py_sitedir     %{py_libdir}/site-packages
486 %py_sitescriptdir %{py_scriptdir}/site-packages
487 %py_dyndir              %{py_libdir}/lib-dynload
488
489 # pure python modules compilation
490 %py_comp                python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
491
492 %py_ocomp               python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
493
494 # Software written in Python language require Python with main version
495 %pyrequires_eq() Requires:      %1
496
497 # Hardlink binary identical .pyc and .pyo files
498 # (idea by glen <at> pld-linux <dot> org)
499 %__spec_install_post_py_hardlink {\
500 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
501 [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
502         b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
503         if cmp -s "$a" "$b"; then \
504                 ln -f "$a" "$b"; \
505         fi; \
506 done \
507 }; __spec_install_post_py_hardlink } }
508
509 # remove python sources, so that check-files won't complain
510 # (idea by glen <at> pld-linux <dot> org)
511 %py_postclean() \
512 for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
513  [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
514 done \
515 %{nil}
516
517 # depmod macro
518 %depmod() { \
519 umask 022; \
520 if [ -e /boot/System.map-%1 ]; then \
521         /sbin/depmod -a -F /boot/System.map-%1 %1; \
522 else \
523         if [ -e /boot/System.map ]; then \
524                 /sbin/depmod -a -F /boot/System.map %1; \
525         else \
526                 /sbin/depmod -a %1; \
527         fi \
528 fi; \
529 }
530
531 # XMMS specific macros
532 %xmms_prefix                    %(xmms-config --prefix 2>/dev/null)
533 %xmms_exec_prefix               %(xmms-config --exec-prefix 2>/dev/null)
534 %xmms_version                   %(xmms-config --version 2>/dev/null)
535 %xmms_datadir                   %(xmms-config --data-dir 2>/dev/null)
536 %xmms_plugindir                 %(xmms-config --plugin-dir 2>/dev/null)
537 %xmms_visualization_plugindir   %(xmms-config --visualization-plugin-dir 2>/dev/null)
538 %xmms_input_plugindir           %(xmms-config --input-plugin-dir 2>/dev/null)
539 %xmms_output_plugindir          %(xmms-config --output-plugin-dir 2>/dev/null)
540 %xmms_effect_plugindir          %(xmms-config --effect-plugin-dir 2>/dev/null)
541 %xmms_general_plugindir         %(xmms-config --general-plugin-dir 2>/dev/null)
542
543 %_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/')
544
545 # user/group checking macros
546 #
547 # Usage:
548 #       %userremove myuser
549 #
550 %userremove     /usr/lib/rpm/user_group.sh user del
551 %groupremove    /usr/lib/rpm/user_group.sh group del
552 #
553 # Usage:
554 #       if %usertestrm myuser; then
555 #               /usr/sbin/userdel -r myuser
556 # Note:
557 #       use these macros only if you need to call userdel/groupdel with
558 #       a non-standard option or take an extra action; otherwise use the
559 #       %userremove/%groupremove macros
560 #
561 %usertestrm     /usr/lib/rpm/user_group.sh user testrm
562 %grouptestrm    /usr/lib/rpm/user_group.sh group testrm
563 # user group membership management macros
564 #
565 # Usage:
566 #       %addusertogroup myuser agroup
567 #
568 %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
569
570 # banner support (useful in {pre,post}{,un} and triggers)
571 #
572 # Usage:
573 #       %banner name [-a] [-e] [-n] [-tn] <<EOF
574 # the banner text, the banner text
575 # the banner text, and following line
576 #EOF
577 # You can use any form of here-document, <<'EOF' <<-EOT will do.
578 # NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
579 #
580 # -a   - append to the banner
581 # -e   - send to stderr instead of stdout
582 # -n   - no show banner (overrides -t)
583 # -t   - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
584 %banner(aent:)  \
585 RPM_SCRIPTVERBOSITY=5 \
586 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
587 if [ -x /usr/bin/banner.sh ]; then \
588         CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
589 else \
590         CMD="cat%{-e: >&2}" \
591 fi \
592 eval $CMD %2%{?3: %3} \
593 %nil
594
595 # useradd/groupadd macros written by glen@pld-linux.org.
596 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
597 #
598 # Usage:
599 #   %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
600 #   [-g initial_group] [-G group[,...]] login
601 #
602 #  -u uid. REQUIRED
603 #  -g gid/group. REQUIRED
604 #  -s defaults to /bin/false
605 #  -d defaults to /usr/share/empty
606 #  -c No default
607 #  -r is accepted but ignored (it's always set)
608 #  -k skeleton dir. defaults to /usr/share/empty
609 # rpm specific flags
610 #  -P package name. defaults to %{name}
611 #
612 %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
613 %{!-u:%{error:useradd: Required argument -u missing}} \
614 %{!-g:%{error:useradd: Required argument -g missing}} \
615 %{!?1:%{error:useradd: Required parameter login missing}} \
616 if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
617         if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
618                 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
619                 exit 1 \
620         fi \
621 else \
622         echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
623         /usr/sbin/useradd \\\
624                 %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\
625                 -u %{-u*} \\\
626                 -r \\\
627                 -d %{-d*}%{!-d:/usr/share/empty} \\\
628                 -s %{-s*}%{!-s:/bin/false} \\\
629                 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
630                 -g %{-g*} \\\
631                 %{-M} \\\
632                 %{-G:-G %{-G*}} \\\
633                 %{expand:%{%{#}}} 1>&2 || exit $? \
634         [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd \
635 fi;
636
637 # Usage:
638 #   %groupadd [-P package] [-g gid] group
639 #
640 # -g gid. REQUIRED
641 #
642 # Sample:
643 #   %groupadd -P %{name}-base -g %{gid} %{name}
644
645 %groupadd(g:P:rfo)      \
646 %{!-g:%{error:groupadd: Required argument -g missing}} \
647 %{!?1:%{error:groupadd: Required parameter group missing}} \
648 if [ -n "`/usr/bin/getgid %{1}`" ]; then \
649         if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
650                 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
651                 exit 1 \
652         fi \
653 else \
654         echo "Adding group %{1} GID=%{-g*}." \
655         /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
656         [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group \
657 fi;
658
659 # apache_config_{install/uninstall} macros written by glen@pld-linux.org.
660 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
661 #
662 # You should use webapp macros instead. these are here until single piece of them is gone from specs ;)
663 #
664 # The config is installed/removed inside trigger, this means that you can any
665 # time install apache1 or apache package and the configuration file is updated.
666 # if you don't need the config for various reason for specific apache, just
667 # remove the symlink from apache config directory. the trigger will not put the
668 # config again to that version of apache. In other words the config is linked
669 # to apache config directory on first install of PACKAGE or apache.
670 #
671 # should be called in trigger body:
672 #  %triggerin -- apache1 >= 1.3.33-2
673 #  %apache_config_install -v 1
674 #
675 # Add package's apache config to apache config.
676 #
677 # Usage:
678 #   %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
679 #
680 #  -v REQUIRED: specify apache version. can be 1 or 2.
681 #  -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
682 #  -n OPTIONAL: specify config "slot". defaults to 99
683 #  -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers
684 #
685 # Internal macros. don't use ;).
686 # expands apache config dir by apache version at build time.
687 %__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)
688 # expands apache service name by apache version at build time.
689 %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi)
690
691 %apache_config_install(fv:c:n:) \
692 %{!-v:%{error:apache_config_install: Required argument -v missing}} \
693 %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
694 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\
695         ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\
696 fi\
697 # reload apache if the config symlink is there\
698 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\
699         # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \
700         if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\
701                 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\
702         fi\
703 fi\
704 %{nil}
705
706 # Remove package's apache config from apache config.
707 #
708 # Usage:
709 #   %apache_config_uninstall -v {1|2} -n 99
710 #
711 #  -v REQUIRED: specify apache version. can be 1 or 2.
712 #  -n OPTIONAL: specify config "slot". defaults to 99
713 %apache_config_uninstall(v:n:) \
714 %{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \
715 %{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
716 # remove link if either of the packages are gone \
717 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
718         if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \
719                 rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \
720                 if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \
721                         /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \
722                 fi \
723         fi \
724 fi \
725 %{nil}
726
727 # webapp macros
728 #
729 # The config is installed/removed inside trigger, this means that you can any
730 # time install apache1/apache/lighttpd package and the configuration file is
731 # updated. if you don't need the config for various reason for specific
732 # webserver, just remove the symlink from config directory using webapp
733 # program. the trigger will not recreate the symlink on upgrades. In other
734 # words the config is linked to webserver config directory on first install of
735 # PACKAGE or WEBSERVER.
736 #
737 # Add package's webserver config to webserver webapps dir.
738 # Usage:
739 #   %webapp_register WEBSERVER WEBAPP
740 #
741 %webapp_register() \
742 %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
743 if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
744         /usr/sbin/webapp register %1 %2\
745 fi\
746 # reload webserver if the config symlink is there and skip reload if webserver is upgraded\
747 if [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ] && [ "$2" -lt "2" ]; then\
748         %{expand:%service -q %%1 reload}\
749 fi\
750 %{nil}
751
752 # Remove package's config from webserver webapps dir.
753 # Usage:
754 #   %webapp_register [-f] WEBSERVER WEBAPP
755 %webapp_unregister(f) \
756 %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
757 # remove link if either of the packages are gone \
758 if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ]; then \
759         /usr/sbin/webapp unregister %1 %2\
760         %{expand:%service -q %%1 reload}\
761 fi \
762 %{nil}
763
764 # see browser-plugins.spec / template-browser-plugin.spec
765 # written by glen@pld-linux.org.
766 %nsplugin_install(d:f) { \
767 # create link if it's first install of either of the packages \
768 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \
769 ( \
770 %( \
771         for file in %{*}; do \
772                 echo echo Installing $file to %{-d*}; \
773                 echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \
774         done ) \
775 ) | ( %banner -t 5 -e %{name}-in ); fi; \
776 }
777
778 %nsplugin_uninstall(d:) { \
779 # remove link if either of the packages are gone \
780 if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
781 ( \
782 %( \
783         for file in %{*}; do \
784                 echo echo Removing $file from %{-d*}; \
785                 echo "rm -f %{-d*}/$file;"; \
786         done ) \
787 ) | ( %banner -t 5 -e %{name}-un ); fi; \
788 }
789
790 # service macro.
791 #
792 # calls usual service restart on package %post, but skips the restart if
793 # administrator has disabled automatic service restarts in either global
794 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
795 #
796 # written by glen@pld-linux.org.
797 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
798 #
799 # Usage:
800 #   %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
801 #
802 #  -q be silent when service isn't started (for scriplets restaring other package's services)
803 #
804 %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
805
806
807 # java macros. based on jpackage macros.java
808 %_jvmdir                %{_libdir}/jvm
809 %_jvmjardir             %{_libdir}/jvm-exports
810 %_jvmprivdir            %{_libdir}/jvm-private
811 %_jvmlibdir             %{_libdir}/jvm
812 %_jvmdatadir            %{_datadir}/jvm
813 %_jvmsysconfdir         %{_sysconfdir}/jvm
814 # FIXME: are these used?
815 %_jvmcommonlibdir       %{_libdir}/jvm-common
816 %_jvmcommondatadir      %{_datadir}/jvm-common
817 %_jvmcommonsysconfdir   %{_sysconfdir}/jvm-common
818 %_jnidir                %{_libdir}/java
819 %java_home              %(unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
820
821 %ant                    JAVA_HOME=%{java_home} ant
822 %jar                    %{java_home}/bin/jar
823 %java                   %(unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)
824 %javac                  %{java_home}/bin/javac
825 %javadoc                %{java_home}/bin/javadoc
826
827 %add_jvm_extension      JAVA_LIBDIR=%{buildroot}/%{_javadir}    %{_bindir}/jvmjar -l
828
829 %jpackage_script() \
830 install -d $RPM_BUILD_ROOT%{_bindir}\
831 cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \
832 #!/bin/sh\
833 #\
834 # %{name} script\
835 # JPackage Project <http://www.jpackage.org/>\
836 \
837 # Source functions library\
838 . %{_javadir}-utils/java-functions\
839 \
840 # Source system prefs\
841 if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\
842     . %{_sysconfdir}/java/%{name}.conf\
843 fi\
844 \
845 # Source user prefs\
846 if [ -f $HOME/.%{name}rc ]; then\
847     . $HOME/.%{name}rc\
848 fi\
849 \
850 # Configuration\
851 MAIN_CLASS=%1\
852 BASE_FLAGS=%2\
853 BASE_OPTIONS=%3\
854 BASE_JARS="%(echo %4 | tr ':' ' ')"\
855 \
856 # Set parameters\
857 set_jvm\
858 set_classpath $BASE_JARS\
859 set_flags $BASE_FLAGS\
860 set_options $BASE_OPTIONS\
861 \
862 # Let's start\
863 run "$@"\
864 EOF
865
866 # pear install macros written by glen@pld-linux.org.
867 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
868 #
869 # Usage:
870 #       %%pear_package_setup [-a #] [-n FMT]
871 #
872 # -a #   - unpack SOURCE# instead of SOURCE0
873 # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
874 # -z     - unpack pear package and let pear use package.xml (not tarball) for install. use this for buggy packages.
875 # -f     - force pear install. use with care.
876 #
877 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
878 # destination hierarchy. you should copy the tree to buildroot after
879 # patching/reorganizing with %%pear_package_install.
880 #
881 # additionally BUILDROOT is stripped from files and files are converted to UNIX
882 # line endings.
883 #
884 # the pear install process output is recorded to install.log, you should put it
885 # to %%doc for latter debug or just information.
886 #
887 # additionally additional-packages.txt is produced if it was detected that the
888 # package has optional dependencies. the file format is suitable of displaying
889 # in %%post of a package. you should put this file to %%doc. noautocompressdoc is
890 # automatically added for this file.
891 #
892 %pear_package_setup(a:n:zf) \
893 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
894 D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
895 %{-z:tar zxf %{S:%{-a*}%{!-a:0}}; P=%{_pearname}-%{version}/package.xml; [ -f $P ] || P=package.xml} \
896 pear \\\
897         -d doc_dir=/docs \\\
898         -d php_dir=%{php_pear_dir} \\\
899         -d bin_dir=%{_bindir} \\\
900         -d data_dir=%{php_pear_dir}/data \\\
901         -d test_dir=%{php_pear_dir}/tests \\\
902         install \\\
903         --installroot=${D} \\\
904         --offline \\\
905         --nodeps \\\
906         %{-f:--force} \\\
907         %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$P} | tee install.log \
908 # make post message of optional packages \
909 grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
910 if [ -s optional-packages.txt ]; then \
911         awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
912 else \
913         rm -f optional-packages.txt \
914 fi \
915 rm ./%{php_pear_dir}/.{lock,filemap} \
916 # undos sources \
917 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
918 # bug in PEAR --installroot. \
919 # http://pear.php.net/bugs/bug.php?id=5448 \
920 grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \
921 %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \
922 %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \
923 %{nil}
924
925 # copies exctracted PEAR package structure to buildroot.
926 # also copies PEAR registry file.
927 # please use this macro, for future extensions being possible.
928 %pear_package_install() \
929 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
930 find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
931 # help the developer out a little: \
932 if [ -f _noautoreq ]; then \
933         echo "AutoReqdep detected:" \
934         echo "_noautoreq $(cat _noautoreq)" \
935 fi \
936 %{nil}
937
938
939 # Register OpenLDAP schema.
940 # Author: Elan Ruusamäe <glen@pld-linux.org>
941 #
942 # Usage:
943 #   %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
944 #
945 #  -d specify dependant schemas, separated by comma
946 #
947 %openldap_schema_register(d:) \
948 for schema in %*; do \
949         if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
950                 %{__sed} -i -e " \
951                         /^include.*local.schema/{ \
952                                 iinclude\\t     $schema\
953                         } \
954                 " /etc/openldap/slapd.conf \
955         fi \
956 done \
957 # enable dependant schemas \
958 if [ "%{-d*}" ]; then \
959         %{__sed} -i -e ' \
960         /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 's/,/\\\\|/g')\\)\\.schema/{ \
961                 s/^#// \
962         }' /etc/openldap/slapd.conf \
963 fi \
964 %{nil}
965
966 # Unregister OpenLDAP schema.
967 # Author: Elan Ruusamäe <glen@pld-linux.org>
968 #
969 # Usage:
970 #   %%openldap_schema_unregister %{schemadir}/horde.schema
971 #
972 %openldap_schema_unregister() \
973 for schema in %*; do \
974         if grep -q "$schema" /etc/openldap/slapd.conf; then \
975                 %{__sed} -i -e " \
976                 /^include.*$(echo "$schema" | %{__sed} -e 's,/,\\\\/,g')/d \
977                 # for symmetry it would be nice if we disable enabled schemas in post, \
978                 # but we really can not do that, it would break something else. \
979                 " /etc/openldap/slapd.conf \
980         fi \
981 done \
982 %{nil}
983
984 # vim:ts=4 sw=4 noet
This page took 0.152495 seconds and 4 git commands to generate.