]>
Commit | Line | Data |
---|---|---|
d54662bf AF |
1 | # PLD rpm macros |
2 | ||
f633038a | 3 | # other macros |
e05017c1 | 4 | %epoch 0 |
f633038a AM |
5 | %_enable_debug_packages 1 |
6 | ||
8f74418b MM |
7 | %__id @__ID@ |
8 | %__id_u %{__id} -u | |
9 | %__chown_Rhf @__CHOWN_RHF@ | |
10 | %__chgrp_Rhf @__CHGRP_RHF@ | |
11 | ||
07163ba3 | 12 | %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root:@ROOT_GROUP@ |
d54662bf | 13 | %_fixgroup true |
16cb1d91 | 14 | %_fixperms %{__chmod} -Rf @FIXPERMS@ |
d54662bf | 15 | %_topdir %(echo $HOME)/rpm |
9c404149 AM |
16 | #----------------------------------------------------------------- |
17 | # CFLAGS and LDFLAGS used to build | |
18 | ||
7bec8f51 | 19 | %debuginfocflags %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1: -ggdb}%{expand:%%undefine __dic_%{?_enable_debug_packages}} |
f633038a | 20 | |
8f74418b | 21 | %debugcflags -O0 -g -Wall |
81082386 | 22 | %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags} |
f4cc8832 | 23 | %rpmcxxflags %{rpmcflags} -fvisibility-inlines-hidden |
6f45e5bb | 24 | %rpmldflags %{nil} |
9c404149 | 25 | |
ba1fdedc | 26 | # kernel compiler |
d2e1bc22 | 27 | %kgcc gcc |
28 | %kgcc_package gcc | |
ba1fdedc | 29 | |
33040789 | 30 | # Build system path macros. |
31 | # | |
f93109a0 | 32 | %__autoconf autoconf %{?debug:-Wall} |
33 | %__automake automake -a -c -f --foreign | |
34 | %__autopoint autopoint --force | |
35 | ||
83094b62 | 36 | %__gettextize { \ |
afff6d37 | 37 | if ! gettextize --version | grep -q '0\.10\.' ; then \ |
8a995cff JB |
38 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ |
39 | gettextize --copy --force --no-changelog; \ | |
97589b6e | 40 | else \ |
8a995cff JB |
41 | gettextize --copy --force --no-changelog --intl; \ |
42 | fi; \ | |
43 | if [ ! -f po/Makevars ]; then \ | |
44 | cp -f po/Makevars{.template,}; \ | |
45 | fi; \ | |
46 | else \ | |
47 | gettextize --copy --force; \ | |
83094b62 | 48 | fi; \ |
8a995cff | 49 | } |
f93109a0 | 50 | |
51 | %__glib_gettextize glib-gettextize --copy --force | |
52 | %__gnome_doc_common gnome-doc-common --copy | |
53 | %__gtkdocize gtkdocize --copy | |
54 | %__intltoolize intltoolize --copy --force | |
55 | %__libtoolize libtoolize --copy --force | |
33040789 | 56 | |
6a5eda77 | 57 | %dependencytracking %{nil} |
9c404149 | 58 | #----------------------------------------------------------------- |
9f4ce098 | 59 | %configure2_13 { \ |
9c404149 AM |
60 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
61 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
62 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
f4cc8832 | 63 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ |
9c404149 | 64 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ |
8ec1a12b | 65 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
8983c4c4 AM |
66 | %{?__cc:CC="%{__cc}" ; export CC ; } \ |
67 | %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ | |
8f74418b | 68 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ |
2a7cfd3f | 69 | --host=%{_target_platform} \ |
9c404149 AM |
70 | --prefix=%{_prefix} \ |
71 | --exec-prefix=%{_exec_prefix} \ | |
72 | --bindir=%{_bindir} \ | |
73 | --sbindir=%{_sbindir} \ | |
74 | --sysconfdir=%{_sysconfdir} \ | |
75 | --datadir=%{_datadir} \ | |
76 | --includedir=%{_includedir} \ | |
77 | --libdir=%{_libdir} \ | |
78 | --libexecdir=%{_libexecdir} \ | |
79 | --localstatedir=%{_localstatedir} \ | |
80 | --sharedstatedir=%{_sharedstatedir} \ | |
81 | --mandir=%{_mandir} \ | |
82 | --infodir=%{_infodir} \ | |
c0d1b3ad | 83 | --x-libraries=/usr/X11R6/%{_lib} \ |
93059874 | 84 | %{dependencytracking} \ |
9c404149 AM |
85 | } |
86 | ||
4a6b0d54 | 87 | #---------------------------------------------------------------- |
57f4166d | 88 | %configure {./configure \ |
4a6b0d54 AF |
89 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
90 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
f4cc8832 | 91 | CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ |
4a6b0d54 | 92 | FFLAGS="${FFLAGS:-%rpmcflags}" \ |
a2bd5992 | 93 | CPPFLAGS="${CPPFLAGS:-}" \ |
8983c4c4 AM |
94 | %{?__cc:CC="%{__cc}"} \ |
95 | %{?__cxx:CXX="%{__cxx}"} \ | |
4a6b0d54 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} \ | |
c0d1b3ad | 110 | --x-libraries=/usr/X11R6/%{_lib} \ |
93059874 | 111 | %{dependencytracking} \ |
4a6b0d54 AF |
112 | } |
113 | ||
7dbab518 | 114 | # ------------------------------------------------------------------------ |
c80506a3 AM |
115 | # Overloading of some basic macros |
116 | %prep \ | |
117 | %%prep\ | |
118 | LANG=C\ | |
119 | export LANG\ | |
14e77e64 | 120 | unset DISPLAY ||:\ |
6db5639d | 121 | unset LINGUAS ||:\ |
c80506a3 AM |
122 | %{nil} |
123 | ||
124 | %build %%build\ | |
125 | LANG=C\ | |
126 | export LANG\ | |
14e77e64 | 127 | unset DISPLAY ||:\ |
6db5639d | 128 | unset LINGUAS ||:\ |
c80506a3 AM |
129 | %{nil} |
130 | ||
131 | %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\ | |
132 | %%install\ | |
133 | LANG=C\ | |
134 | export LANG\ | |
14e77e64 | 135 | unset DISPLAY ||:\ |
6db5639d | 136 | unset LINGUAS ||:\ |
c80506a3 AM |
137 | %{nil} |
138 | ||
139 | # ------------------------------------------------------------------------ | |
7dbab518 MM |
140 | # Conditional build stuff. |
141 | ||
142 | # Check if symbol is defined. | |
143 | # Example usage: %if %{defined with_foo} && %{undefined with_bar} ... | |
144 | %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}} | |
145 | %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}} | |
146 | ||
566fa098 MM |
147 | # Shorthand for %{defined with_...} |
148 | %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}} | |
149 | %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} | |
150 | ||
7dbab518 MM |
151 | # Handle conditional builds. %bcond_with is for case when feature is |
152 | # default off and needs to be activated with --with ... command line | |
153 | # switch. %bcond_without is for the dual case. | |
154 | # | |
155 | # %bcond_with foo defines symbol with_foo if --with foo was specified on | |
156 | # command line. | |
157 | # %bcond_without foo defines symbol with_foo if --without foo was *not* | |
158 | # specified on command line. | |
159 | # | |
160 | # For example: | |
161 | # | |
162 | # %bcond_with extra_fonts | |
163 | # %bcond_without static | |
f52f9976 | 164 | # %if %{with extra_fonts} |
7dbab518 MM |
165 | # ... |
166 | # %endif | |
f52f9976 | 167 | # %ifdef %{with static} |
7dbab518 MM |
168 | # ... |
169 | # %endif | |
170 | # %{?with_static: ... } | |
171 | # %{!?with_static: ... } | |
172 | # %{?with_extra_fonts: ... } | |
173 | # %{!?with_extra_fonts: ... } | |
174 | # | |
175 | # The bottom line: never use without_foo, _with_foo nor _without_foo, only | |
176 | # with_foo. This way changing default set of bconds for given spec is just | |
177 | # a matter of changing single line in it and syntax is more readable. | |
178 | %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} | |
179 | %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} | |
180 | # ------------------------------------------------------------------------ | |
181 | ||
9c404149 AM |
182 | # Location of autoconf macros |
183 | %_aclocaldir %(aclocal --print-ac-dir) | |
184 | ||
e2804f99 AM |
185 | # Location of omf files |
186 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
187 | ||
e987a186 | 188 | # Location of pkgconfig files |
9a4e877a | 189 | %_pkgconfigdir /usr/%{_lib}/pkgconfig |
e987a186 | 190 | |
486b0b5f | 191 | # Location of desktop files |
192 | %_desktopdir /usr/share/applications | |
86dff2d0 | 193 | %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead |
486b0b5f | 194 | |
481463e9 | 195 | # Location of pixmaps for applnk/desktop files |
e1f0a822 | 196 | %_pixmapsdir /usr/share/pixmaps |
9c404149 | 197 | |
481463e9 | 198 | # Location of themable icons for applnk/desktop files |
b36c8e2a | 199 | %_iconsdir /usr/share/icons |
200 | ||
e987a186 JB |
201 | # Location of fonts directories |
202 | %_fontsdir /usr/share/fonts | |
203 | ||
b3282f3f | 204 | # Location of Gtk and associated libraries documentation |
6eed6d84 | 205 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html |
b3282f3f | 206 | |
fc4d7771 | 207 | # Location of KDE documentation |
208 | %_kdedocdir %{_defaultdocdir}/kde/HTML | |
209 | ||
5869828c | 210 | # unsermake script |
211 | %__unsermake /usr/share/unsermake/unsermake | |
212 | ||
9c404149 AM |
213 | # Current date |
214 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
215 | ||
216 | # tmp directory | |
217 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
218 | ||
219 | # Example files, programs, scripts... | |
220 | %_examplesdir /usr/src/examples | |
221 | ||
8377d27d | 222 | # The directory holding Linux kernel sources |
223 | %_kernelsrcdir /usr/src/linux | |
224 | ||
9c404149 | 225 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
8f74418b | 226 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
9c404149 | 227 | |
8f74418b | 228 | # Requires name = version-release |
16cb1d91 | 229 | %requires_releq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not") |
8bf3719d | 230 | |
16cb1d91 JB |
231 | %releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)") |
232 | %releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)") | |
233 | %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):/ /' | grep -vE "(is not|no such)") | |
234 | %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):/ /' | grep -vE "(is not|no such)") | |
8bf3719d | 235 | |
16cb1d91 | 236 | %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not") |
01a9f990 | 237 | |
179fcc7f | 238 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR) |
b9d5d440 | 239 | |
240 | # kernel version-release handling | |
541d11fe | 241 | %__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)) |
8fecb226 | 242 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not") |
16cb1d91 JB |
243 | %__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}-%{RELEASE}" | grep -v "is not") |
244 | %_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})} | |
f62e856d | 245 | %_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g') |
87be1cf0 | 246 | |
e00dd7f6 | 247 | # sgml macros |
741b471b | 248 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ; |
249 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ; | |
847db862 | 250 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem |
741b471b | 251 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ; |
252 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ; | |
253 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ; | |
e00dd7f6 | 254 | %docbook_sgmlcat_fix() { for l in \ |
255 | '' \ | |
256 | ' -- default decl --' \ | |
257 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
258 | ' -- hacks for opensp --' \ | |
259 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
260 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
261 | '' \ | |
262 | ; do echo $l; done >> %1 \ | |
263 | } | |
264 | ||
9c404149 AM |
265 | #----------------------------------------------------------------- |
266 | # find and gzip all files in %{_mandir} and %{infodir} | |
267 | # | |
268 | # Requires: xargs, find | |
269 | # | |
270 | #%no_install_post_compress_docs 1 | |
271 | %__spec_install_post_compress_docs { \ | |
9c404149 | 272 | %{!?no_install_post_compress_docs: \ |
822d4d81 | 273 | echo "Compress man and info pages."; \ |
9c404149 AM |
274 | %{?verbose:set -x;} \ |
275 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
276 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
277 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
278 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
279 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
280 | fi; \ | |
281 | done; \ | |
282 | } } | |
283 | ||
284 | #----------------------------------------------------------------- | |
285 | # Strip executable binaries and shared object files | |
286 | # | |
287 | # Requires: find, awk, strip, cut, xargs | |
288 | # | |
289 | #%no_install_post_strip 1 | |
290 | %__spec_install_post_strip {%{!?debug: \ | |
291 | %{!?no_install_post_strip: \ | |
9f0d4f36 JB |
292 | %{?verbose:set -x;} \ |
293 | if [ -d "$RPM_BUILD_ROOT" ]; then \ | |
8f74418b | 294 | echo "Strip executable binaries, archives and shared object files."; \ |
60ad88f2 | 295 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \ |
9c404149 AM |
296 | elfexelist=`echo $filelist | xargs -r file | \ |
297 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
298 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
299 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
8f74418b MM |
300 | elfarchiveslist=`echo $filelist | xargs -r file | \ |
301 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
9c404149 | 302 | if [ -n "$elfexelist" ]; then \ |
60ad88f2 | 303 | %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \ |
9c404149 AM |
304 | fi; \ |
305 | if [ -n "$elfsharedlist" ]; then \ | |
60ad88f2 | 306 | %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ |
8f74418b MM |
307 | fi; \ |
308 | if [ -n "$elfarchiveslist" ]; then \ | |
60ad88f2 | 309 | %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ |
9f0d4f36 JB |
310 | fi; \ |
311 | fi; } \ | |
9c404149 | 312 | } } |
fc5d7e20 | 313 | #----------------------------------------------------------------- |
314 | # remove all RPATH from executable binaries and shared object files | |
315 | # | |
316 | # Requires: find, awk, cut, xargs, chrpath, uname | |
317 | # | |
318 | #%no_install_post_chrpath 1 | |
319 | %__spec_install_post_chrpath {%{!?debug: \ | |
320 | %{!?no_install_post_chrpath: \ | |
321 | %{?verbose:set -x;} \ | |
9f0d4f36 | 322 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
fc5d7e20 | 323 | echo "Remove RPATH from executable binaries and shared object files."; \ |
adb39da4 | 324 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ |
5bed2bb7 | 325 | awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ |
fc5d7e20 | 326 | while read file ; do \ |
327 | rpath= ; \ | |
328 | chmod u+w "$file"; \ | |
329 | for dir in `chrpath -l "$file" | \ | |
330 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ | |
331 | case $dir in \ | |
494e368c | 332 | /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \ |
fc5d7e20 | 333 | echo "remove-rpath: $dir in $file"; \ |
334 | ;; \ | |
335 | * ) \ | |
336 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
337 | else rpath="$rpath:$dir" ; fi ; \ | |
338 | ;; \ | |
339 | esac ; \ | |
340 | done ; \ | |
341 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
342 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
9f0d4f36 JB |
343 | done; \ |
344 | fi; } \ | |
fc5d7e20 | 345 | } } |
d72c185f | 346 | #----------------------------------------------------------------- |
ccb8ae8d | 347 | # Find and gzip all kernel modules |
348 | # | |
349 | # Requires: find | |
350 | # | |
351 | #%no_install_post_compress_modules 1 | |
352 | %__spec_install_post_compress_modules { \ | |
ccb8ae8d | 353 | %{!?no_install_post_compress_modules: \ |
354 | %{?verbose:set -x;} \ | |
9f0d4f36 JB |
355 | if [ -d "$RPM_BUILD_ROOT" ]; then \ |
356 | echo "Compress kernel modules if any."; \ | |
d618340e | 357 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ |
16cb1d91 JB |
358 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \ |
359 | xargs -r %{__gzip} -9nf; \ | |
a33b1418 | 360 | find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \ |
03b234a5 | 361 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ |
d618340e | 362 | fi; \ |
9f0d4f36 | 363 | fi; \ |
ccb8ae8d | 364 | } } |
9c404149 AM |
365 | |
366 | %_source_payload w9.gzdio | |
367 | %_binary_payload w9.bzdio | |
368 | ||
83094b62 | 369 | #----------------------------------------------------------------- |
0e4cb4dd | 370 | # Update GConf2 schemas |
83094b62 | 371 | # |
372 | # Requires: GConf2 | |
373 | # | |
46885239 | 374 | %gconf_schema_install() \ |
375 | umask 022; \ | |
f93109a0 | 376 | 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 \ |
46885239 | 377 | %{nil} |
378 | ||
379 | %gconf_schema_uninstall() \ | |
f93109a0 | 380 | if [ $1 = 0 ]; then \ |
46885239 | 381 | umask 022; \ |
f93109a0 | 382 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \ |
383 | fi \ | |
384 | %{nil} | |
385 | ||
386 | #----------------------------------------------------------------- | |
387 | # Update desktop MIME database | |
388 | # requries: desktop-file-utils | |
389 | # | |
390 | %update_desktop_database_post() \ | |
391 | umask 022; \ | |
392 | /usr/bin/update-desktop-database; \ | |
393 | %{nil} | |
394 | ||
395 | %update_desktop_database_postun() \ | |
396 | if [ $1 = 0 ]; then \ | |
397 | umask 022; \ | |
398 | /usr/bin/update-desktop-database; \ | |
399 | fi \ | |
400 | %{nil} | |
401 | ||
402 | #----------------------------------------------------------------- | |
403 | # Update scrollkeeper database | |
404 | # requires: scrollkeeper | |
405 | # | |
406 | %scrollkeeper_update_post() \ | |
f93109a0 | 407 | /usr/bin/scrollkeeper-update -q; \ |
408 | %{nil} | |
409 | ||
410 | %scrollkeeper_update_postun() \ | |
411 | if [ $1 = 0 ]; then \ | |
f93109a0 | 412 | /usr/bin/scrollkeeper-update -q; \ |
413 | fi \ | |
414 | %{nil} | |
415 | ||
416 | #----------------------------------------------------------------- | |
417 | # Run ldconfig after installing/deinstalling libraries | |
418 | # | |
419 | %ldconfig_post() \ | |
420 | /sbin/ldconfig; \ | |
421 | %{nil} | |
422 | ||
423 | %ldconfig_postun() \ | |
424 | if [ $1 = 0 ]; then \ | |
425 | /sbin/ldconfig; \ | |
426 | fi \ | |
427 | %{nil} | |
83094b62 | 428 | |
9c404149 AM |
429 | #----------------------------------------------------------------- |
430 | # post %install sequence: | |
431 | # - autodeps exceptions | |
432 | # - compress all man and info pages, | |
433 | # - strip all ELF executables and ELF shared objects if not %debug. | |
8f74418b | 434 | # - compress kernel modules if any |
9c404149 AM |
435 | |
436 | ################################################################### | |
437 | # Requires/Provides automation | |
438 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
338726a6 | 439 | # |
2892b5df JB |
440 | %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} |
441 | %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} | |
442 | %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}} | |
443 | %__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} | |
444 | %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}} | |
338726a6 JB |
445 | #%_noautocompressdoc %{nil} |
446 | # | |
8f74418b MM |
447 | %_missing_doc_files_terminate_build 1%{nil} |
448 | %_unpackaged_files_terminate_build %{nil} | |
8781dc74 | 449 | # (X)emacs support |
d77dcb61 | 450 | %___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;}' |
8781dc74 AF |
451 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) |
452 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
25043cd4 | 453 | |
02b58f60 JK |
454 | %__php_provides %{nil} |
455 | %__php_requires %{nil} | |
456 | %__perl_provides %{nil} | |
457 | %__perl_requires %{nil} | |
25043cd4 AF |
458 | |
459 | # Perl specific macro definitions. | |
c853f847 AF |
460 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) |
461 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
462 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
463 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) | |
464 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) | |
465 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
25043cd4 | 466 | |
c853f847 | 467 | %php_pear_dir %{_datadir}/pear |
25043cd4 AF |
468 | |
469 | # Python specific macro definitions. | |
470 | # python main version | |
c853f847 | 471 | %py_ver %(echo `python -c "import sys; print sys.version[:3]"`) |
25043cd4 AF |
472 | |
473 | # directories | |
c853f847 | 474 | %py_prefix %(echo `python -c "import sys; print sys.prefix"`) |
aadb0079 | 475 | %py_libdir %{py_prefix}/%{_lib}/python%{py_ver} |
ef7ec0a8 | 476 | %py_scriptdir %{py_prefix}/share/python%{py_ver} |
c853f847 | 477 | %py_incdir /usr/include/python%{py_ver} |
ef7ec0a8 JK |
478 | %py_sitedir %{py_libdir}/site-packages |
479 | %py_sitescriptdir %{py_scriptdir}/site-packages | |
c853f847 | 480 | %py_dyndir %{py_libdir}/lib-dynload |
25043cd4 AF |
481 | |
482 | # pure python modules compilation | |
c853f847 | 483 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
25043cd4 | 484 | |
c853f847 | 485 | %py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
25043cd4 AF |
486 | |
487 | # Software written in Python language require Python with main version | |
e63cd81d | 488 | %pyrequires_eq() Requires: %1 |
25043cd4 | 489 | |
f12c2314 AF |
490 | |
491 | # Hardlink binary identical .pyc and .pyo files | |
492 | # (idea by glen <at> pld-linux <dot> org) | |
493 | %__spec_install_post_py_hardlink {\ | |
d56b7e24 | 494 | %{!?no_install_post_py_hardlink: \ |
f12c2314 AF |
495 | [ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \ |
496 | b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \ | |
497 | if cmp -s "$a" "$b"; then \ | |
498 | ln -f "$a" "$b"; \ | |
499 | fi; \ | |
500 | done \ | |
501 | } } | |
502 | ||
503 | # remove python sources, so that check-files won't complain | |
504 | # (idea by glen <at> pld-linux <dot> org) | |
505 | %py_postclean() \ | |
506 | for d in %{py_sitescriptdir} %{py_sitedir}; do \ | |
507 | [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -exec rm {} \; ;\ | |
508 | done \ | |
509 | %{nil} | |
510 | ||
0fc5cff8 | 511 | # depmod macro |
512 | %depmod() { \ | |
f6148427 | 513 | umask 022; \ |
0fc5cff8 | 514 | if [ -e /boot/System.map-%1 ]; then \ |
515 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ | |
516 | else \ | |
517 | if [ -e /boot/System.map ]; then \ | |
518 | /sbin/depmod -a -F /boot/System.map %1; \ | |
519 | else \ | |
520 | /sbin/depmod -a %1; \ | |
521 | fi \ | |
522 | fi; \ | |
523 | } | |
524 | ||
2afc6e64 | 525 | # XMMS specific macros |
2d372986 JB |
526 | %xmms_prefix %(xmms-config --prefix) |
527 | %xmms_exec_prefix %(xmms-config --exec-prefix) | |
528 | %xmms_version %(xmms-config --version) | |
529 | %xmms_datadir %(xmms-config --data-dir) | |
530 | %xmms_plugindir %(xmms-config --plugin-dir) | |
531 | %xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir) | |
532 | %xmms_input_plugindir %(xmms-config --input-plugin-dir) | |
533 | %xmms_output_plugindir %(xmms-config --output-plugin-dir) | |
534 | %xmms_effect_plugindir %(xmms-config --effect-plugin-dir) | |
535 | %xmms_general_plugindir %(xmms-config --general-plugin-dir) | |
2afc6e64 | 536 | |
1fc7dde4 | 537 | %_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/') |
848c0d68 | 538 | |
539 | # user/group checking macros | |
540 | # | |
541 | # Usage: | |
542 | # %userremove myuser | |
543 | # | |
544 | %userremove /usr/lib/rpm/user_group.sh user del | |
545 | %groupremove /usr/lib/rpm/user_group.sh group del | |
546 | # | |
547 | # Usage: | |
548 | # if %usertestrm myuser; then | |
549 | # /usr/sbin/userdel -r myuser | |
550 | # Note: | |
551 | # use these macros only if you need to call userdel/groupdel with | |
552 | # a non-standard option or take an extra action; otherwise use the | |
553 | # %userremove/%groupremove macros | |
554 | # | |
555 | %usertestrm /usr/lib/rpm/user_group.sh user testrm | |
556 | %grouptestrm /usr/lib/rpm/user_group.sh group testrm | |
08d9b1f6 JK |
557 | # user group membership management macros |
558 | # | |
559 | # Usage: | |
560 | # %addusertogroup myuser agroup | |
561 | # | |
562 | %addusertogroup /usr/lib/rpm/user_group.sh user addtogroup | |
72fcfcb3 | 563 | |
564 | # banner support (useful in {pre,post}{,un} and triggers) | |
565 | # | |
566 | # Usage: | |
aa41c920 | 567 | # %banner name [-a] [-e] [-n] [-tn] <<EOF |
72fcfcb3 | 568 | # the banner text, the banner text |
aa41c920 ER |
569 | # the banner text, and following line |
570 | #EOF | |
571 | # You can use any form of here-document, <<'EOF' <<-EOT will do. | |
572 | # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. | |
573 | # | |
72fcfcb3 | 574 | # -a - append to the banner |
a8b9562a | 575 | # -e - send to stderr instead of stdout |
628754cb | 576 | # -n - no show banner (overrides -t) |
577 | # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 | |
aa41c920 | 578 | %banner(aent:) \ |
1b334fe4 | 579 | RPM_SCRIPTVERBOSITY=5 \ |
580 | [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ | |
581 | if [ -x /usr/bin/banner.sh ]; then \ | |
aa41c920 | 582 | CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \ |
1b334fe4 | 583 | else \ |
a8b9562a | 584 | CMD="cat%{-e: >&2}" \ |
1b334fe4 | 585 | fi \ |
aa41c920 | 586 | $CMD %2%{?3: %3} \ |
72fcfcb3 | 587 | %nil |
628754cb | 588 | |
90627280 ER |
589 | # |
590 | # useradd/groupadd macros written by glen@pld-linux.org. | |
591 | # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada | |
592 | # | |
593 | # Usage: | |
594 | # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment] | |
595 | # [-g initial_group] [-G group[,...]] login | |
596 | # | |
597 | # -u uid. REQUIRED | |
598 | # -g gid/group. REQUIRED | |
599 | # -s defaults to /bin/false | |
600 | # -d defaults to /usr/share/empty | |
601 | # -c No default | |
602 | # -r is accepted but ignored (it's always set) | |
603 | # rpm specific flags | |
604 | # -P package name. defaults to %{name} | |
605 | # | |
606 | # NOTE: the syntax errors are intentional to trigger parse error at package | |
607 | # time for required options | |
608 | # | |
609 | %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \ | |
610 | %{!-u:%(\ | |
611 | \ | |
612 | %useradd: Required argument -u missing\ | |
613 | } \ | |
614 | %{!-g:%(\ | |
615 | \ | |
616 | %useradd: Required argument -g missing\ | |
617 | } \ | |
618 | %{!?1:%(\ | |
619 | \ | |
620 | %useradd: Required parameter login missing\ | |
621 | } \ | |
622 | if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \ | |
623 | if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \ | |
624 | echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
625 | exit 1 \ | |
626 | fi \ | |
627 | else \ | |
628 | echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \ | |
629 | /usr/sbin/useradd \\\ | |
630 | -u %{-u*} \\\ | |
631 | -r \\\ | |
632 | -d %{-d*}%{!-d:/usr/share/empty} \\\ | |
633 | -s %{-s*}%{!-s:/bin/false} \\\ | |
634 | %{-c:-c '%(set -- %{-c*}%{*}; echo $1)'}\\\ | |
635 | -g %{-g*} \\\ | |
636 | %{-M} \\\ | |
637 | %{-G:-G %{-G*}} \\\ | |
638 | %{expand:%{%{#}}} 1>&2 \\\ | |
639 | fi; | |
640 | ||
641 | ||
642 | # Usage: | |
643 | # %groupadd [-P package] [-g gid] group | |
644 | # | |
645 | # -g gid. REQUIRED | |
646 | # | |
647 | # Sample: | |
648 | # %groupadd -P %{name}-base -g %{gid} %{name} | |
649 | ||
650 | %groupadd(g:P:rfo) \ | |
651 | %{!-g:%(\ | |
652 | \ | |
653 | %groupadd: Required argument -g missing\ | |
654 | } \ | |
655 | %{!?1:%(\ | |
656 | \ | |
657 | %groupadd: Required parameter group missing\ | |
658 | } \ | |
659 | if [ -n "`/usr/bin/getgid %{1}`" ]; then \ | |
660 | if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \ | |
661 | echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \ | |
662 | exit 1 \ | |
663 | fi \ | |
664 | else \ | |
665 | echo "Adding group %{1} GID=%{-g*}." \ | |
666 | /usr/sbin/groupadd -g %{-g*} -r %{1} \ | |
667 | fi; | |
668 |