]>
Commit | Line | Data |
---|---|---|
d54662bf AF |
1 | # PLD rpm macros |
2 | ||
3 | %_defaultdocdir %{_usr}/share/doc | |
4 | %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@ | |
5 | %_fixgroup true | |
6 | %_topdir %(echo $HOME)/rpm | |
7 | %_exec_prefix %{_prefix} | |
8 | %_bindir %{_exec_prefix}/bin | |
9 | %_sbindir %{_exec_prefix}/sbin | |
10 | %_libexecdir %{_exec_prefix}/lib | |
11 | %_datadir %{_prefix}/share | |
12 | %_sharedstatedir %{_prefix}/com | |
13 | %_lib lib | |
14 | %_libdir %{_exec_prefix}/%{_lib} | |
15 | %_includedir %{_prefix}/include | |
16 | %_oldincludedir /usr/include | |
17 | %_sysconfdir /etc | |
18 | %_localstatedir /var | |
19 | %_infodir /usr/share/info | |
20 | %_mandir %{_prefix}/share/man | |
9c404149 AM |
21 | #----------------------------------------------------------------- |
22 | # CFLAGS and LDFLAGS used to build | |
23 | ||
24 | %debugcflags -O0 -g | |
25 | %rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags} | |
26 | %rpmldflags %{!?debug:-s} | |
27 | ||
ba1fdedc | 28 | # kernel compiler |
f18d12cf KT |
29 | %kgcc gcc |
30 | %kgcc_package gcc | |
ba1fdedc | 31 | |
33040789 | 32 | #----------------------------------------------------------------- |
33 | # Build system path macros. | |
34 | # | |
35 | %__libtoolize libtoolize --copy --force | |
bcdab9c2 JB |
36 | %__gettextize gettextize --copy --force |
37 | %__automake automake -a -c -f --foreign | |
be3a1985 | 38 | %__autoconf autoconf %{?debug:-Wall} |
33040789 | 39 | |
9c404149 | 40 | #----------------------------------------------------------------- |
9f4ce098 | 41 | %configure2_13 { \ |
9c404149 AM |
42 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
43 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
44 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
45 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \ | |
46 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ | |
8ec1a12b | 47 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
ae5d93df AM |
48 | %{?__cc:CC=%{__cc} ; export CC ; } \ |
49 | %{?__cxx:CXX=%{__cxx} ; export CXX ; } \ | |
5d6d2bff | 50 | %{?configuredir:%{configuredir}}%{?!configuredir:.}/configure \ |
2a7cfd3f | 51 | --host=%{_target_platform} \ |
9c404149 AM |
52 | --prefix=%{_prefix} \ |
53 | --exec-prefix=%{_exec_prefix} \ | |
54 | --bindir=%{_bindir} \ | |
55 | --sbindir=%{_sbindir} \ | |
56 | --sysconfdir=%{_sysconfdir} \ | |
57 | --datadir=%{_datadir} \ | |
58 | --includedir=%{_includedir} \ | |
59 | --libdir=%{_libdir} \ | |
60 | --libexecdir=%{_libexecdir} \ | |
61 | --localstatedir=%{_localstatedir} \ | |
62 | --sharedstatedir=%{_sharedstatedir} \ | |
63 | --mandir=%{_mandir} \ | |
64 | --infodir=%{_infodir} \ | |
65 | } | |
66 | ||
4a6b0d54 | 67 | #---------------------------------------------------------------- |
9f4ce098 | 68 | %configure {./configure \ |
4a6b0d54 AF |
69 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
70 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
71 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \ | |
72 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
a2bd5992 | 73 | CPPFLAGS="${CPPFLAGS:-}" \ |
9f4ce098 AF |
74 | %{?__cc:CC=%{__cc}} \ |
75 | %{?__cxx:CXX=%{__cxx}} \ | |
4a6b0d54 AF |
76 | --build=%{_target_platform} \ |
77 | --prefix=%{_prefix} \ | |
78 | --exec-prefix=%{_exec_prefix} \ | |
79 | --bindir=%{_bindir} \ | |
80 | --sbindir=%{_sbindir} \ | |
81 | --sysconfdir=%{_sysconfdir} \ | |
82 | --datadir=%{_datadir} \ | |
83 | --includedir=%{_includedir} \ | |
84 | --libdir=%{_libdir} \ | |
85 | --libexecdir=%{_libexecdir} \ | |
86 | --localstatedir=%{_localstatedir} \ | |
87 | --sharedstatedir=%{_sharedstatedir} \ | |
88 | --mandir=%{_mandir} \ | |
89 | --infodir=%{_infodir} \ | |
90 | } | |
91 | ||
9c404149 AM |
92 | # Location of autoconf macros |
93 | %_aclocaldir %(aclocal --print-ac-dir) | |
94 | ||
e2804f99 AM |
95 | # Location of omf files |
96 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
97 | ||
e987a186 | 98 | # Location of pkgconfig files |
d7021551 | 99 | %_pkgconfigdir /usr/lib/pkgconfig |
e987a186 | 100 | |
9c404149 AM |
101 | # Location of top applink dir |
102 | %_applnkdir /usr/X11R6/share/applnk | |
103 | ||
104 | # Location pixmaps for applnk/desktop files | |
105 | %_pixmapsdir /usr/X11R6/share/pixmaps | |
106 | ||
e987a186 JB |
107 | # Location of fonts directories |
108 | %_fontsdir /usr/share/fonts | |
109 | ||
26ab8a38 | 110 | # Location of Gtk and associated libraries documentation |
111 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html | |
112 | ||
9c404149 AM |
113 | # Current date |
114 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
115 | ||
116 | # tmp directory | |
117 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
118 | ||
119 | # Example files, programs, scripts... | |
120 | %_examplesdir /usr/src/examples | |
121 | ||
8377d27d | 122 | # The directory holding Linux kernel sources |
123 | %_kernelsrcdir /usr/src/linux | |
124 | ||
9c404149 | 125 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
b9d5d440 | 126 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
9c404149 | 127 | |
9abb477a | 128 | # requires name = version-release |
b9d5d440 | 129 | %requires_releq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}-%%{RELEASE}' %1| grep -v "is not") |
130 | %requires_kernel_releq() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not") | |
131 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-up = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not") | |
132 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-smp = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not") | |
133 | ||
134 | # kernel version-release handling | |
135 | %__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2) | |
136 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not") | |
137 | %_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}}) | |
138 | %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g) | |
87be1cf0 | 139 | |
e00dd7f6 | 140 | # sgml macros |
141 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog | |
142 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog | |
143 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
144 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 | |
145 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null | |
146 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null | |
147 | %docbook_sgmlcat_fix() { for l in \ | |
148 | '' \ | |
149 | ' -- default decl --' \ | |
150 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
151 | ' -- hacks for opensp --' \ | |
152 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
153 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
154 | '' \ | |
155 | ; do echo $l; done >> %1 \ | |
156 | } | |
157 | ||
9c404149 AM |
158 | #----------------------------------------------------------------- |
159 | # find and gzip all files in %{_mandir} and %{infodir} | |
160 | # | |
161 | # Requires: xargs, find | |
162 | # | |
163 | #%no_install_post_compress_docs 1 | |
164 | %__spec_install_post_compress_docs { \ | |
165 | echo "Compress man and info pages."; \ | |
166 | %{!?no_install_post_compress_docs: \ | |
167 | %{?verbose:set -x;} \ | |
168 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
169 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
170 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
171 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
172 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
173 | fi; \ | |
174 | done; \ | |
175 | } } | |
176 | ||
177 | #----------------------------------------------------------------- | |
178 | # Strip executable binaries and shared object files | |
179 | # | |
180 | # Requires: find, awk, strip, cut, xargs | |
181 | # | |
182 | #%no_install_post_strip 1 | |
183 | %__spec_install_post_strip {%{!?debug: \ | |
184 | %{!?no_install_post_strip: \ | |
185 | %{?verbose:set -x;} \ | |
186 | echo "Strip executable binaries and shared object files."; \ | |
187 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \ | |
188 | elfexelist=`echo $filelist | xargs -r file | \ | |
189 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
190 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
191 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
192 | if [ -n "$elfexelist" ]; then \ | |
193 | strip --remove-section=.note --remove-section=.comment $elfexelist; \ | |
194 | fi; \ | |
195 | if [ -n "$elfsharedlist" ]; then \ | |
196 | strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ | |
197 | fi; } \ | |
198 | } } | |
ccb8ae8d | 199 | #----------------------------------------------------------------- |
d72c185f | 200 | # remove all RPATH from executable binaries and shared object files |
201 | # | |
60b694bd | 202 | # Requires: find, awk, cut, xargs, chrpath, uname |
d72c185f | 203 | # |
204 | #%no_install_post_chrpath 1 | |
205 | %__spec_install_post_chrpath {%{!?debug: \ | |
206 | %{!?no_install_post_chrpath: \ | |
207 | %{?verbose:set -x;} \ | |
7aeb0554 | 208 | echo "Remove RPATH from executable binaries and shared object files."; \ |
60b694bd | 209 | if [ "$(uname -m)" != alpha ] ; then \ |
7aeb0554 MM |
210 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" | xargs -r file | \ |
211 | awk '/ELF.*(executable|shared object)/ {print $1}' | cut -d: -f1 | \ | |
212 | while read file ; do \ | |
213 | rpath= ; \ | |
60b694bd | 214 | chmod u+w "$file"; \ |
7aeb0554 MM |
215 | for dir in `chrpath -l "$file" | \ |
216 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ | |
217 | case $dir in \ | |
218 | /home/* | /tmp/* | /usr/lib | /lib | /usr/local/lib | /usr/X11R6/lib ) \ | |
219 | echo "remove-rpath: $dir in $file"; \ | |
220 | ;; \ | |
221 | * ) \ | |
222 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
223 | else rpath="$rpath:$dir" ; fi ; \ | |
224 | ;; \ | |
225 | esac ; \ | |
226 | done ; \ | |
227 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
228 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
60b694bd | 229 | done; fi; } \ |
d72c185f | 230 | } } |
231 | #----------------------------------------------------------------- | |
ccb8ae8d | 232 | # Find and gzip all kernel modules |
233 | # | |
234 | # Requires: find | |
235 | # | |
236 | #%no_install_post_compress_modules 1 | |
237 | %__spec_install_post_compress_modules { \ | |
ccb8ae8d | 238 | %{!?no_install_post_compress_modules: \ |
95cb4b84 | 239 | echo "Compress kernel modules if any."; \ |
ccb8ae8d | 240 | %{?verbose:set -x;} \ |
d618340e | 241 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ |
95cb4b84 | 242 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \ |
243 | xargs -r %{__gzip} -9nf; \ | |
244 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \ | |
245 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
d618340e | 246 | fi; \ |
ccb8ae8d | 247 | } } |
9c404149 AM |
248 | |
249 | %_source_payload w9.gzdio | |
250 | %_binary_payload w9.bzdio | |
251 | ||
252 | #----------------------------------------------------------------- | |
253 | # post %install sequence: | |
254 | # - autodeps exceptions | |
255 | # - compress all man and info pages, | |
256 | # - strip all ELF executables and ELF shared objects if not %debug. | |
257 | ||
258 | ################################################################### | |
259 | # Requires/Provides automation | |
260 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
7126cc1b JK |
261 | %__spec_prep_pre \ |
262 | _autoreqprov=n \ | |
263 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
264 | %{?_noautoreq:_autoreqprov=y}\ | |
265 | %{?_noautoreqdep:_autoreqprov=y}\ | |
266 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
267 | %{?_noautoprov:_autoreqprov=y}\ | |
f07a68c3 | 268 | %{?_noautocompressdoc:_autoreqprov=y}\ |
7126cc1b JK |
269 | if [ "$_autoreqprov" = "y" ] ; then \ |
270 | if [ -f %{_builddir}/__rpm_lock ] ; then \ | |
271 | echo "Some package using \%_noauto* macros is already being built" >&2 \ | |
272 | echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \ | |
273 | exit 1 \ | |
274 | else \ | |
275 | rm -f %{_builddir}/__rpm_*\ | |
276 | touch %{_builddir}/__rpm_lock \ | |
277 | fi \ | |
278 | fi \ | |
f07a68c3 | 279 | %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\ |
9c404149 AM |
280 | %{nil} |
281 | ||
ef437f4b | 282 | %__os_install_post \ |
9c404149 AM |
283 | %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\ |
284 | %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\ | |
285 | %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\ | |
286 | %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\ | |
287 | %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\ | |
288 | %{__spec_install_post_strip}\ | |
d72c185f | 289 | %{__spec_install_post_chrpath}\ |
9c404149 | 290 | %{__spec_install_post_compress_docs}\ |
ccb8ae8d | 291 | %{__spec_install_post_compress_modules}\ |
9c404149 | 292 | %{__arch_install_post}\ |
9c404149 AM |
293 | %{nil} |
294 | ||
295 | %__spec_clean_pre %{___build_pre}\ | |
7126cc1b JK |
296 | _autoreqprov=n \ |
297 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
298 | %{?_noautoreq:_autoreqprov=y}\ | |
299 | %{?_noautoreqdep:_autoreqprov=y}\ | |
300 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
301 | %{?_noautoprov:_autoreqprov=y}\ | |
302 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
f07a68c3 | 303 | %{?_noautocompressdoc:_autoreqprov=y}\ |
7126cc1b JK |
304 | if [ "$_autoreqprov" = "y" ] ; then \ |
305 | rm -f %{_builddir}/__rpm_* \ | |
306 | fi \ | |
9c404149 AM |
307 | %{nil} |
308 | ||
309 | ||
310 | #%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*" | |
311 | #%_noautoreq %{nil} | |
312 | #%_noautoreqdep %{nil} | |
313 | #%_noautoprovfiles %{nil} | |
314 | #%_noautoprov %{nil} |