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