]>
Commit | Line | Data |
---|---|---|
d54662bf AF |
1 | # PLD rpm macros |
2 | ||
8f74418b MM |
3 | %__id @__ID@ |
4 | %__id_u %{__id} -u | |
5 | %__chown_Rhf @__CHOWN_RHF@ | |
6 | %__chgrp_Rhf @__CHGRP_RHF@ | |
7 | ||
d54662bf AF |
8 | %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@ |
9 | %_fixgroup true | |
8f74418b | 10 | %_fixperms %{__chmod} -Rf @FIXPERMS@ |
d54662bf | 11 | %_topdir %(echo $HOME)/rpm |
9c404149 AM |
12 | #----------------------------------------------------------------- |
13 | # CFLAGS and LDFLAGS used to build | |
14 | ||
8f74418b | 15 | %debugcflags -O0 -g -Wall |
9c404149 AM |
16 | %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags} |
17 | %rpmldflags %{!?debug:-s} | |
18 | ||
ba1fdedc | 19 | # kernel compiler |
d2e1bc22 | 20 | %kgcc gcc |
21 | %kgcc_package gcc | |
ba1fdedc | 22 | |
33040789 | 23 | # Build system path macros. |
24 | # | |
25 | %__libtoolize libtoolize --copy --force | |
83094b62 | 26 | %__gettextize { \ |
afff6d37 | 27 | if ! gettextize --version | grep -q '0\.10\.' ; then \ |
8a995cff JB |
28 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ |
29 | gettextize --copy --force --no-changelog; \ | |
97589b6e | 30 | else \ |
8a995cff JB |
31 | gettextize --copy --force --no-changelog --intl; \ |
32 | fi; \ | |
33 | if [ ! -f po/Makevars ]; then \ | |
34 | cp -f po/Makevars{.template,}; \ | |
35 | fi; \ | |
36 | else \ | |
37 | gettextize --copy --force; \ | |
83094b62 | 38 | fi; \ |
8a995cff JB |
39 | } |
40 | %__autopoint autopoint --force | |
bcdab9c2 | 41 | %__automake automake -a -c -f --foreign |
be3a1985 | 42 | %__autoconf autoconf %{?debug:-Wall} |
33040789 | 43 | |
9c404149 | 44 | #----------------------------------------------------------------- |
9f4ce098 | 45 | %configure2_13 { \ |
9c404149 AM |
46 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
47 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
48 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
49 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \ | |
50 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ | |
8ec1a12b | 51 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
ae5d93df AM |
52 | %{?__cc:CC=%{__cc} ; export CC ; } \ |
53 | %{?__cxx:CXX=%{__cxx} ; export CXX ; } \ | |
8f74418b | 54 | %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ |
2a7cfd3f | 55 | --host=%{_target_platform} \ |
9c404149 AM |
56 | --prefix=%{_prefix} \ |
57 | --exec-prefix=%{_exec_prefix} \ | |
58 | --bindir=%{_bindir} \ | |
59 | --sbindir=%{_sbindir} \ | |
60 | --sysconfdir=%{_sysconfdir} \ | |
61 | --datadir=%{_datadir} \ | |
62 | --includedir=%{_includedir} \ | |
63 | --libdir=%{_libdir} \ | |
64 | --libexecdir=%{_libexecdir} \ | |
65 | --localstatedir=%{_localstatedir} \ | |
66 | --sharedstatedir=%{_sharedstatedir} \ | |
67 | --mandir=%{_mandir} \ | |
68 | --infodir=%{_infodir} \ | |
69 | } | |
70 | ||
4a6b0d54 | 71 | #---------------------------------------------------------------- |
57f4166d | 72 | %configure {./configure \ |
4a6b0d54 AF |
73 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
74 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
75 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \ | |
76 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
a2bd5992 | 77 | CPPFLAGS="${CPPFLAGS:-}" \ |
9f4ce098 AF |
78 | %{?__cc:CC=%{__cc}} \ |
79 | %{?__cxx:CXX=%{__cxx}} \ | |
4a6b0d54 AF |
80 | --build=%{_target_platform} \ |
81 | --prefix=%{_prefix} \ | |
82 | --exec-prefix=%{_exec_prefix} \ | |
83 | --bindir=%{_bindir} \ | |
84 | --sbindir=%{_sbindir} \ | |
85 | --sysconfdir=%{_sysconfdir} \ | |
86 | --datadir=%{_datadir} \ | |
87 | --includedir=%{_includedir} \ | |
88 | --libdir=%{_libdir} \ | |
89 | --libexecdir=%{_libexecdir} \ | |
90 | --localstatedir=%{_localstatedir} \ | |
91 | --sharedstatedir=%{_sharedstatedir} \ | |
92 | --mandir=%{_mandir} \ | |
93 | --infodir=%{_infodir} \ | |
94 | } | |
95 | ||
9c404149 AM |
96 | # Location of autoconf macros |
97 | %_aclocaldir %(aclocal --print-ac-dir) | |
98 | ||
e2804f99 AM |
99 | # Location of omf files |
100 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
101 | ||
e987a186 | 102 | # Location of pkgconfig files |
d7021551 | 103 | %_pkgconfigdir /usr/lib/pkgconfig |
e987a186 | 104 | |
9c404149 | 105 | # Location of top applink dir |
30562d7e | 106 | %_applnkdir /usr/X11R6/share/applnk |
9c404149 | 107 | |
486b0b5f | 108 | # Location of desktop files |
109 | %_desktopdir /usr/share/applications | |
110 | ||
9c404149 | 111 | # Location pixmaps for applnk/desktop files |
e1f0a822 | 112 | %_pixmapsdir /usr/share/pixmaps |
9c404149 | 113 | |
e987a186 JB |
114 | # Location of fonts directories |
115 | %_fontsdir /usr/share/fonts | |
116 | ||
b3282f3f | 117 | # Location of Gtk and associated libraries documentation |
6eed6d84 | 118 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html |
b3282f3f | 119 | |
9c404149 AM |
120 | # Current date |
121 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
122 | ||
123 | # tmp directory | |
124 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
125 | ||
126 | # Example files, programs, scripts... | |
127 | %_examplesdir /usr/src/examples | |
128 | ||
8377d27d | 129 | # The directory holding Linux kernel sources |
130 | %_kernelsrcdir /usr/src/linux | |
131 | ||
9c404149 | 132 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
8f74418b | 133 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
9c404149 | 134 | |
8f74418b MM |
135 | # Requires name = version-release |
136 | %requires_releq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") | |
137 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'Prereq: kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -vE "(is not|no such)") | |
138 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'Prereq: kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -vE "(is not|no such)") | |
b9d5d440 | 139 | |
140 | # kernel version-release handling | |
141 | %__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2) | |
142 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not") | |
143 | %_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}}) | |
144 | %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g) | |
87be1cf0 | 145 | |
e00dd7f6 | 146 | # sgml macros |
147 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog | |
148 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog | |
149 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
150 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 | |
151 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null | |
152 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null | |
153 | %docbook_sgmlcat_fix() { for l in \ | |
154 | '' \ | |
155 | ' -- default decl --' \ | |
156 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
157 | ' -- hacks for opensp --' \ | |
158 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
159 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
160 | '' \ | |
161 | ; do echo $l; done >> %1 \ | |
162 | } | |
163 | ||
9c404149 AM |
164 | #----------------------------------------------------------------- |
165 | # find and gzip all files in %{_mandir} and %{infodir} | |
166 | # | |
167 | # Requires: xargs, find | |
168 | # | |
169 | #%no_install_post_compress_docs 1 | |
170 | %__spec_install_post_compress_docs { \ | |
171 | echo "Compress man and info pages."; \ | |
172 | %{!?no_install_post_compress_docs: \ | |
173 | %{?verbose:set -x;} \ | |
174 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
175 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
176 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
177 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
178 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
179 | fi; \ | |
180 | done; \ | |
181 | } } | |
182 | ||
183 | #----------------------------------------------------------------- | |
184 | # Strip executable binaries and shared object files | |
185 | # | |
186 | # Requires: find, awk, strip, cut, xargs | |
187 | # | |
188 | #%no_install_post_strip 1 | |
189 | %__spec_install_post_strip {%{!?debug: \ | |
190 | %{!?no_install_post_strip: \ | |
191 | %{?verbose:set -x;} \ | |
8f74418b | 192 | echo "Strip executable binaries, archives and shared object files."; \ |
9c404149 AM |
193 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \ |
194 | elfexelist=`echo $filelist | xargs -r file | \ | |
195 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
196 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
197 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
8f74418b MM |
198 | elfarchiveslist=`echo $filelist | xargs -r file | \ |
199 | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \ | |
9c404149 AM |
200 | if [ -n "$elfexelist" ]; then \ |
201 | strip --remove-section=.note --remove-section=.comment $elfexelist; \ | |
202 | fi; \ | |
203 | if [ -n "$elfsharedlist" ]; then \ | |
204 | strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ | |
8f74418b MM |
205 | fi; \ |
206 | if [ -n "$elfarchiveslist" ]; then \ | |
207 | strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \ | |
9c404149 AM |
208 | fi; } \ |
209 | } } | |
fc5d7e20 | 210 | #----------------------------------------------------------------- |
211 | # remove all RPATH from executable binaries and shared object files | |
212 | # | |
213 | # Requires: find, awk, cut, xargs, chrpath, uname | |
214 | # | |
215 | #%no_install_post_chrpath 1 | |
216 | %__spec_install_post_chrpath {%{!?debug: \ | |
217 | %{!?no_install_post_chrpath: \ | |
218 | %{?verbose:set -x;} \ | |
219 | echo "Remove RPATH from executable binaries and shared object files."; \ | |
220 | if [ "$(uname -m)" != alpha ] ; then \ | |
221 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" | xargs -r file | \ | |
222 | awk '/ELF.*(executable|shared object)/ {print $1}' | cut -d: -f1 | \ | |
223 | while read file ; do \ | |
224 | rpath= ; \ | |
225 | chmod u+w "$file"; \ | |
226 | for dir in `chrpath -l "$file" | \ | |
227 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ | |
228 | case $dir in \ | |
229 | /home/* | /tmp/* | /usr/lib | /lib | /usr/local/lib | /usr/X11R6/lib ) \ | |
230 | echo "remove-rpath: $dir in $file"; \ | |
231 | ;; \ | |
232 | * ) \ | |
233 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
234 | else rpath="$rpath:$dir" ; fi ; \ | |
235 | ;; \ | |
236 | esac ; \ | |
237 | done ; \ | |
238 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
239 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
240 | done; fi; } \ | |
241 | } } | |
d72c185f | 242 | #----------------------------------------------------------------- |
ccb8ae8d | 243 | # Find and gzip all kernel modules |
244 | # | |
245 | # Requires: find | |
246 | # | |
247 | #%no_install_post_compress_modules 1 | |
248 | %__spec_install_post_compress_modules { \ | |
ccb8ae8d | 249 | %{!?no_install_post_compress_modules: \ |
fc1ea397 | 250 | echo "Compress kernel modules if any."; \ |
ccb8ae8d | 251 | %{?verbose:set -x;} \ |
d618340e | 252 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ |
fc1ea397 | 253 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \ |
d618340e | 254 | xargs -r %{__gzip} -9nf; \ |
fc1ea397 | 255 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \ |
03b234a5 | 256 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ |
d618340e | 257 | fi; \ |
ccb8ae8d | 258 | } } |
9c404149 AM |
259 | |
260 | %_source_payload w9.gzdio | |
261 | %_binary_payload w9.bzdio | |
262 | ||
83094b62 | 263 | #----------------------------------------------------------------- |
264 | # Update all GConf2 schemas | |
265 | # | |
266 | # Requires: GConf2 | |
267 | # | |
7bd8c922 | 268 | %gconf_schema_install { umask 022; \ |
269 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \ | |
270 | /usr/bin/gconftool-2 --makefile-install-rule \ | |
271 | /etc/gconf/schemas/*.schemas > /dev/null \ | |
3ee1090a | 272 | } |
83094b62 | 273 | |
9c404149 AM |
274 | #----------------------------------------------------------------- |
275 | # post %install sequence: | |
276 | # - autodeps exceptions | |
277 | # - compress all man and info pages, | |
278 | # - strip all ELF executables and ELF shared objects if not %debug. | |
8f74418b | 279 | # - compress kernel modules if any |
9c404149 AM |
280 | |
281 | ################################################################### | |
282 | # Requires/Provides automation | |
283 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
7126cc1b JK |
284 | %__spec_prep_pre \ |
285 | _autoreqprov=n \ | |
286 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
287 | %{?_noautoreq:_autoreqprov=y}\ | |
288 | %{?_noautoreqdep:_autoreqprov=y}\ | |
289 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
290 | %{?_noautoprov:_autoreqprov=y}\ | |
f07a68c3 | 291 | %{?_noautocompressdoc:_autoreqprov=y}\ |
7126cc1b JK |
292 | if [ "$_autoreqprov" = "y" ] ; then \ |
293 | if [ -f %{_builddir}/__rpm_lock ] ; then \ | |
294 | echo "Some package using \%_noauto* macros is already being built" >&2 \ | |
295 | echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \ | |
296 | exit 1 \ | |
297 | else \ | |
298 | rm -f %{_builddir}/__rpm_*\ | |
299 | touch %{_builddir}/__rpm_lock \ | |
300 | fi \ | |
301 | fi \ | |
f07a68c3 | 302 | %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\ |
9c404149 AM |
303 | %{nil} |
304 | ||
9c404149 AM |
305 | |
306 | %__spec_clean_pre %{___build_pre}\ | |
7126cc1b JK |
307 | _autoreqprov=n \ |
308 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
309 | %{?_noautoreq:_autoreqprov=y}\ | |
310 | %{?_noautoreqdep:_autoreqprov=y}\ | |
311 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
312 | %{?_noautoprov:_autoreqprov=y}\ | |
313 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
f07a68c3 | 314 | %{?_noautocompressdoc:_autoreqprov=y}\ |
7126cc1b JK |
315 | if [ "$_autoreqprov" = "y" ] ; then \ |
316 | rm -f %{_builddir}/__rpm_* \ | |
317 | fi \ | |
9c404149 AM |
318 | %{nil} |
319 | ||
320 | ||
321 | #%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*" | |
322 | #%_noautoreq %{nil} | |
323 | #%_noautoreqdep %{nil} | |
324 | #%_noautoprovfiles %{nil} | |
325 | #%_noautoprov %{nil} | |
8f74418b MM |
326 | %_missing_doc_files_terminate_build 1%{nil} |
327 | %_unpackaged_files_terminate_build %{nil} | |
8781dc74 | 328 | # (X)emacs support |
d77dcb61 | 329 | %___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 |
330 | %_emacs_lispdir %(emacs %___emacs_lispdir_helper) |
331 | %_xemacs_lispdir %(xemacs %___emacs_lispdir_helper) | |
25043cd4 AF |
332 | |
333 | %__php_provides @RPMCONFIGDIR@/php.prov | |
334 | %__php_requires @RPMCONFIGDIR@/php.req | |
335 | ||
336 | # Perl specific macro definitions. | |
c853f847 AF |
337 | %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) |
338 | %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) | |
339 | %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) | |
340 | %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) | |
341 | %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) | |
342 | %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) | |
25043cd4 | 343 | |
c853f847 | 344 | %php_pear_dir %{_datadir}/pear |
25043cd4 AF |
345 | |
346 | # Python specific macro definitions. | |
347 | # python main version | |
c853f847 | 348 | %py_ver %(echo `python -c "import sys; print sys.version[:3]"`) |
25043cd4 AF |
349 | |
350 | # directories | |
c853f847 AF |
351 | %py_prefix %(echo `python -c "import sys; print sys.prefix"`) |
352 | %py_libdir %{py_prefix}/lib/python%{py_ver} | |
353 | %py_incdir /usr/include/python%{py_ver} | |
354 | %py_sitedir %{py_libdir}/site-packages | |
355 | %py_dyndir %{py_libdir}/lib-dynload | |
25043cd4 AF |
356 | |
357 | # pure python modules compilation | |
c853f847 | 358 | %py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" |
25043cd4 | 359 | |
c853f847 | 360 | %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 |
361 | |
362 | # Software written in Python language require Python with main version | |
363 | # unchanged | |
c853f847 | 364 | %pyrequires_eq() Requires: %1 >= %py_ver %1 < %(echo `python -c "import sys; import string; ver=sys.version[:3].split('.'); ver[1]=str(int(ver[1])+1); print string.join(ver, '.')"`) |
25043cd4 | 365 |