]>
Commit | Line | Data |
---|---|---|
a8bf9720 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 | |
cd33aab7 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 | ||
a544555d | 28 | # kernel compiler |
7c956c69 KT |
29 | %kgcc gcc |
30 | %kgcc_package gcc | |
a544555d | 31 | |
5f9f9bd7 | 32 | #----------------------------------------------------------------- |
33 | # Build system path macros. | |
34 | # | |
35 | %__libtoolize libtoolize --copy --force | |
8064452c | 36 | %__gettextize { \ |
37 | if ! gettextize --version | grep -q '0\.10\.' ; then \ | |
38 | if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ | |
39 | gettextize --copy --force --no-changelog; \ | |
40 | else \ | |
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; \ | |
48 | fi; \ | |
49 | } | |
8be41fd8 | 50 | %__autopoint autopoint --force |
fa4547da | 51 | %__automake automake -a -c -f --foreign |
4413e4a3 | 52 | %__autoconf autoconf %{?debug:-Wall} |
5f9f9bd7 | 53 | |
cd33aab7 | 54 | #----------------------------------------------------------------- |
9f0287b5 | 55 | %configure2_13 { \ |
cd33aab7 AM |
56 | if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ |
57 | LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ | |
58 | CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ | |
59 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \ | |
60 | FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ | |
c55f2219 | 61 | CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \ |
700ee83b AM |
62 | %{?__cc:CC=%{__cc} ; export CC ; } \ |
63 | %{?__cxx:CXX=%{__cxx} ; export CXX ; } \ | |
a640d5c2 | 64 | %{?configuredir:%{configuredir}}%{?!configuredir:.}/configure \ |
fa74a11c | 65 | --host=%{_target_platform} \ |
cd33aab7 AM |
66 | --prefix=%{_prefix} \ |
67 | --exec-prefix=%{_exec_prefix} \ | |
68 | --bindir=%{_bindir} \ | |
69 | --sbindir=%{_sbindir} \ | |
70 | --sysconfdir=%{_sysconfdir} \ | |
71 | --datadir=%{_datadir} \ | |
72 | --includedir=%{_includedir} \ | |
73 | --libdir=%{_libdir} \ | |
74 | --libexecdir=%{_libexecdir} \ | |
75 | --localstatedir=%{_localstatedir} \ | |
76 | --sharedstatedir=%{_sharedstatedir} \ | |
77 | --mandir=%{_mandir} \ | |
78 | --infodir=%{_infodir} \ | |
79 | } | |
80 | ||
85f82bec | 81 | #---------------------------------------------------------------- |
9f0287b5 | 82 | %configure {./configure \ |
85f82bec AF |
83 | LDFLAGS="${LDFLAGS:-%rpmldflags}" \ |
84 | CFLAGS="${CFLAGS:-%rpmcflags}" \ | |
85 | CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \ | |
86 | FFLAGS="${FFLAGS:-%rpmcflags}" \ | |
418d9760 | 87 | CPPFLAGS="${CPPFLAGS:-}" \ |
9f0287b5 AF |
88 | %{?__cc:CC=%{__cc}} \ |
89 | %{?__cxx:CXX=%{__cxx}} \ | |
85f82bec AF |
90 | --build=%{_target_platform} \ |
91 | --prefix=%{_prefix} \ | |
92 | --exec-prefix=%{_exec_prefix} \ | |
93 | --bindir=%{_bindir} \ | |
94 | --sbindir=%{_sbindir} \ | |
95 | --sysconfdir=%{_sysconfdir} \ | |
96 | --datadir=%{_datadir} \ | |
97 | --includedir=%{_includedir} \ | |
98 | --libdir=%{_libdir} \ | |
99 | --libexecdir=%{_libexecdir} \ | |
100 | --localstatedir=%{_localstatedir} \ | |
101 | --sharedstatedir=%{_sharedstatedir} \ | |
102 | --mandir=%{_mandir} \ | |
103 | --infodir=%{_infodir} \ | |
104 | } | |
105 | ||
cd33aab7 AM |
106 | # Location of autoconf macros |
107 | %_aclocaldir %(aclocal --print-ac-dir) | |
108 | ||
32720a50 AM |
109 | # Location of omf files |
110 | %_omf_dest_dir %(scrollkeeper-config --omfdir) | |
111 | ||
c5eece2c | 112 | # Location of pkgconfig files |
895ccc5b | 113 | %_pkgconfigdir /usr/lib/pkgconfig |
c5eece2c | 114 | |
cd33aab7 | 115 | # Location of top applink dir |
efa0d2c1 JB |
116 | %_applnkdir /usr/X11R6/share/applnk |
117 | ||
118 | # Location of desktop files | |
119 | %_desktopdir /usr/X11R6/share/applications | |
cd33aab7 | 120 | |
1f28b7b9 | 121 | # Location of pixmaps for applnk/desktop files |
cd33aab7 AM |
122 | %_pixmapsdir /usr/X11R6/share/pixmaps |
123 | ||
1f28b7b9 JB |
124 | # Location of themable icons for applnk/desktop files |
125 | %_iconsdir /usr/X11R6/share/icons | |
126 | ||
c5eece2c JB |
127 | # Location of fonts directories |
128 | %_fontsdir /usr/share/fonts | |
129 | ||
c42d163c | 130 | # Location of Gtk and associated libraries documentation |
1f28b7b9 | 131 | %_gtkdocdir %{_defaultdocdir}/gtk-doc/html |
c42d163c | 132 | |
cd33aab7 AM |
133 | # Current date |
134 | %date %(LC_ALL="C" date +"%a %b %d %Y") | |
135 | ||
136 | # tmp directory | |
137 | %tmpdir %(echo "${TMPDIR:-/tmp}") | |
138 | ||
139 | # Example files, programs, scripts... | |
140 | %_examplesdir /usr/src/examples | |
141 | ||
bd63739a | 142 | # The directory holding Linux kernel sources |
143 | %_kernelsrcdir /usr/src/linux | |
144 | ||
1f28b7b9 JB |
145 | # XMMS specific macros |
146 | %xmms_prefix %(echo `xmms-config --prefix`) | |
147 | %xmms_exec_prefix %(echo `xmms-config --exec-prefix`) | |
148 | %xmms_version %(echo `xmms-config --version`) | |
149 | %xmms_datadir %(echo `xmms-config --data-dir`) | |
150 | %xmms_plugindir %(echo `xmms-config --plugin-dir`) | |
151 | %xmms_visualization_plugindir %(echo `xmms-config --visualization-plugin-dir`) | |
152 | %xmms_input_plugindir %(echo `xmms-config --input-plugin-dir`) | |
153 | %xmms_output_plugindir %(echo `xmms-config --output-plugin-dir`) | |
154 | %xmms_effect_plugindir %(echo `xmms-config --effect-plugin-dir`) | |
155 | %xmms_general_plugindir %(echo `xmms-config --general-plugin-dir`) | |
156 | ||
cd33aab7 | 157 | # If non-empty "debug" macro defined, add "dbg" suffix to release number |
8dea1306 | 158 | %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm |
cd33aab7 | 159 | |
0cdbc762 | 160 | # requires name = version-release |
8dea1306 | 161 | %requires_releq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}-%%{RELEASE}' %1| grep -v "is not") |
162 | %requires_kernel_releq() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not") | |
163 | %requires_releq_kernel_up() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-up = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not") | |
164 | %requires_releq_kernel_smp() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-smp = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not") | |
1f28b7b9 JB |
165 | %requires_eq_to %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") |
166 | ||
167 | %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' `apr-config --includedir`/ap_mmn.h) | |
8dea1306 | 168 | |
169 | # kernel version-release handling | |
170 | %__kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2) | |
171 | %__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not") | |
172 | %_kernel_ver %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}}) | |
173 | %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g) | |
fd4d8ee0 | 174 | |
c2c27a5a | 175 | # sgml macros |
176 | %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog | |
177 | %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog | |
178 | %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem | |
179 | %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 | |
180 | %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null | |
181 | %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null | |
182 | %docbook_sgmlcat_fix() { for l in \ | |
183 | '' \ | |
184 | ' -- default decl --' \ | |
185 | 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ | |
186 | ' -- hacks for opensp --' \ | |
187 | 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
188 | 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ | |
189 | '' \ | |
190 | ; do echo $l; done >> %1 \ | |
191 | } | |
192 | ||
efa0d2c1 JB |
193 | #----------------------------------------------------------------- |
194 | # Update all GConf2 schemas | |
195 | # | |
196 | # Requires: GConf2 | |
197 | # | |
198 | %gconf_schema_install { umask 022; \ | |
199 | GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \ | |
200 | /usr/bin/gconftool-2 --makefile-install-rule \ | |
201 | /etc/gconf/schemas/*.schemas > /dev/null \ | |
202 | } | |
203 | ||
cd33aab7 AM |
204 | #----------------------------------------------------------------- |
205 | # find and gzip all files in %{_mandir} and %{infodir} | |
206 | # | |
207 | # Requires: xargs, find | |
208 | # | |
209 | #%no_install_post_compress_docs 1 | |
210 | %__spec_install_post_compress_docs { \ | |
211 | echo "Compress man and info pages."; \ | |
212 | %{!?no_install_post_compress_docs: \ | |
213 | %{?verbose:set -x;} \ | |
214 | for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \ | |
215 | if [ -d "$RPM_BUILD_ROOT$i" ]; then \ | |
216 | find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \ | |
217 | find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \ | |
218 | find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \ | |
219 | fi; \ | |
220 | done; \ | |
221 | } } | |
222 | ||
223 | #----------------------------------------------------------------- | |
224 | # Strip executable binaries and shared object files | |
225 | # | |
226 | # Requires: find, awk, strip, cut, xargs | |
227 | # | |
228 | #%no_install_post_strip 1 | |
229 | %__spec_install_post_strip {%{!?debug: \ | |
230 | %{!?no_install_post_strip: \ | |
231 | %{?verbose:set -x;} \ | |
232 | echo "Strip executable binaries and shared object files."; \ | |
233 | filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \ | |
234 | elfexelist=`echo $filelist | xargs -r file | \ | |
235 | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \ | |
236 | elfsharedlist=`echo $filelist | xargs -r file | \ | |
237 | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \ | |
238 | if [ -n "$elfexelist" ]; then \ | |
239 | strip --remove-section=.note --remove-section=.comment $elfexelist; \ | |
240 | fi; \ | |
241 | if [ -n "$elfsharedlist" ]; then \ | |
242 | strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \ | |
243 | fi; } \ | |
244 | } } | |
93b46c00 | 245 | #----------------------------------------------------------------- |
22a54b3e | 246 | # remove all RPATH from executable binaries and shared object files |
247 | # | |
688387c8 | 248 | # Requires: find, awk, cut, xargs, chrpath, uname |
22a54b3e | 249 | # |
250 | #%no_install_post_chrpath 1 | |
251 | %__spec_install_post_chrpath {%{!?debug: \ | |
252 | %{!?no_install_post_chrpath: \ | |
253 | %{?verbose:set -x;} \ | |
c15b0de8 | 254 | echo "Remove RPATH from executable binaries and shared object files."; \ |
688387c8 | 255 | if [ "$(uname -m)" != alpha ] ; then \ |
c15b0de8 MM |
256 | find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" | xargs -r file | \ |
257 | awk '/ELF.*(executable|shared object)/ {print $1}' | cut -d: -f1 | \ | |
258 | while read file ; do \ | |
259 | rpath= ; \ | |
688387c8 | 260 | chmod u+w "$file"; \ |
c15b0de8 MM |
261 | for dir in `chrpath -l "$file" | \ |
262 | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \ | |
263 | case $dir in \ | |
264 | /home/* | /tmp/* | /usr/lib | /lib | /usr/local/lib | /usr/X11R6/lib ) \ | |
265 | echo "remove-rpath: $dir in $file"; \ | |
266 | ;; \ | |
267 | * ) \ | |
268 | if [ "$rpath" = "" ] ; then rpath="$dir" ; \ | |
269 | else rpath="$rpath:$dir" ; fi ; \ | |
270 | ;; \ | |
271 | esac ; \ | |
272 | done ; \ | |
273 | if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \ | |
274 | else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \ | |
688387c8 | 275 | done; fi; } \ |
22a54b3e | 276 | } } |
277 | #----------------------------------------------------------------- | |
93b46c00 | 278 | # Find and gzip all kernel modules |
279 | # | |
280 | # Requires: find | |
281 | # | |
282 | #%no_install_post_compress_modules 1 | |
283 | %__spec_install_post_compress_modules { \ | |
93b46c00 | 284 | %{!?no_install_post_compress_modules: \ |
eb60f4f1 | 285 | echo "Compress kernel modules if any."; \ |
93b46c00 | 286 | %{?verbose:set -x;} \ |
390bdd1d | 287 | if test -d $RPM_BUILD_ROOT/lib/modules ; then \ |
eb60f4f1 | 288 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \ |
289 | xargs -r %{__gzip} -9nf; \ | |
290 | find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \ | |
291 | while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ | |
390bdd1d | 292 | fi; \ |
93b46c00 | 293 | } } |
cd33aab7 AM |
294 | |
295 | %_source_payload w9.gzdio | |
296 | %_binary_payload w9.bzdio | |
297 | ||
298 | #----------------------------------------------------------------- | |
299 | # post %install sequence: | |
300 | # - autodeps exceptions | |
301 | # - compress all man and info pages, | |
302 | # - strip all ELF executables and ELF shared objects if not %debug. | |
303 | ||
304 | ################################################################### | |
305 | # Requires/Provides automation | |
306 | # exceptions system by Jacek Konieczny <jajcus@pld.org.pl> | |
f10da3d9 JK |
307 | %__spec_prep_pre \ |
308 | _autoreqprov=n \ | |
309 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
310 | %{?_noautoreq:_autoreqprov=y}\ | |
311 | %{?_noautoreqdep:_autoreqprov=y}\ | |
312 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
313 | %{?_noautoprov:_autoreqprov=y}\ | |
5701c444 | 314 | %{?_noautocompressdoc:_autoreqprov=y}\ |
f10da3d9 JK |
315 | if [ "$_autoreqprov" = "y" ] ; then \ |
316 | if [ -f %{_builddir}/__rpm_lock ] ; then \ | |
317 | echo "Some package using \%_noauto* macros is already being built" >&2 \ | |
318 | echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \ | |
319 | exit 1 \ | |
320 | else \ | |
321 | rm -f %{_builddir}/__rpm_*\ | |
322 | touch %{_builddir}/__rpm_lock \ | |
323 | fi \ | |
324 | fi \ | |
5701c444 | 325 | %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\ |
1f28b7b9 | 326 | %{___build_pre}\ |
cd33aab7 AM |
327 | %{nil} |
328 | ||
81bcf939 | 329 | %__os_install_post \ |
cd33aab7 AM |
330 | %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\ |
331 | %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\ | |
332 | %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\ | |
333 | %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\ | |
334 | %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\ | |
335 | %{__spec_install_post_strip}\ | |
22a54b3e | 336 | %{__spec_install_post_chrpath}\ |
cd33aab7 | 337 | %{__spec_install_post_compress_docs}\ |
93b46c00 | 338 | %{__spec_install_post_compress_modules}\ |
cd33aab7 | 339 | %{__arch_install_post}\ |
cd33aab7 AM |
340 | %{nil} |
341 | ||
342 | %__spec_clean_pre %{___build_pre}\ | |
f10da3d9 JK |
343 | _autoreqprov=n \ |
344 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
345 | %{?_noautoreq:_autoreqprov=y}\ | |
346 | %{?_noautoreqdep:_autoreqprov=y}\ | |
347 | %{?_noautoprovfiles:_autoreqprov=y}\ | |
348 | %{?_noautoprov:_autoreqprov=y}\ | |
349 | %{?_noautoreqfiles:_autoreqprov=y}\ | |
5701c444 | 350 | %{?_noautocompressdoc:_autoreqprov=y}\ |
f10da3d9 JK |
351 | if [ "$_autoreqprov" = "y" ] ; then \ |
352 | rm -f %{_builddir}/__rpm_* \ | |
353 | fi \ | |
cd33aab7 AM |
354 | %{nil} |
355 | ||
356 | ||
357 | #%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*" | |
358 | #%_noautoreq %{nil} | |
359 | #%_noautoreqdep %{nil} | |
360 | #%_noautoprovfiles %{nil} | |
361 | #%_noautoprov %{nil} | |
a3664353 JB |
362 | |
363 | # depmod macro | |
364 | %depmod() { \ | |
365 | if [ -e /boot/System.map-%1 ]; then \ | |
366 | /sbin/depmod -a -F /boot/System.map-%1 %1; \ | |
367 | else \ | |
368 | if [ -e /boot/System.map ]; then \ | |
369 | /sbin/depmod -a -F /boot/System.map %1; \ | |
370 | else \ | |
371 | /sbin/depmod -a %1; \ | |
372 | fi \ | |
373 | fi; \ | |
374 | } | |
375 | ||
376 | # ------------------------------------------------------------------------ | |
377 | # Conditional build stuff. | |
378 | ||
379 | # Check if symbol is defined. | |
380 | # Example usage: %if %{defined with_foo} && %{undefined with_bar} ... | |
381 | %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}} | |
382 | %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}} | |
383 | ||
a3664353 JB |
384 | # Shorthand for %{defined with_...} |
385 | %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}} | |
386 | %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} | |
387 | ||
a3664353 JB |
388 | # Handle conditional builds. %bcond_with is for case when feature is |
389 | # default off and needs to be activated with --with ... command line | |
390 | # switch. %bcond_without is for the dual case. | |
391 | # | |
392 | # %bcond_with foo defines symbol with_foo if --with foo was specified on | |
393 | # command line. | |
394 | # %bcond_without foo defines symbol with_foo if --without foo was *not* | |
395 | # specified on command line. | |
396 | # | |
397 | # For example: | |
398 | # | |
399 | # %bcond_with extra_fonts | |
400 | # %bcond_without static | |
401 | # %ifdef with_extra_fonts | |
402 | # ... | |
403 | # %endif | |
404 | # %ifdef with_static | |
405 | # ... | |
406 | # %endif | |
407 | # %{?with_static: ... } | |
408 | # %{!?with_static: ... } | |
409 | # %{?with_extra_fonts: ... } | |
410 | # %{!?with_extra_fonts: ... } | |
411 | # | |
412 | # The bottom line: never use without_foo, _with_foo nor _without_foo, only | |
413 | # with_foo. This way changing default set of bconds for given spec is just | |
414 | # a matter of changing single line in it and syntax is more readable. | |
415 | %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} | |
416 | %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} | |
417 | # ------------------------------------------------------------------------ |