/[gentoo-x86]/eclass/multilib-build.eclass
Gentoo

Contents of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.58 - (hide annotations) (download)
Sun Jun 29 07:53:33 2014 UTC (4 years ago) by mgorny
Branch: MAIN
Changes since 1.57: +5 -2 lines
Check MULTILIB_COMPAT before querying USE flags. Bug #515642, thanks to Greg Turner.

1 mgorny 1.26 # Copyright 1999-2014 Gentoo Foundation
2 mgorny 1.1 # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.58 # $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.57 2014/06/28 09:56:26 mgorny Exp $
4 mgorny 1.1
5     # @ECLASS: multilib-build.eclass
6     # @MAINTAINER:
7 mgorny 1.34 # gx86-multilib team <multilib@gentoo.org>
8     # @AUTHOR:
9     # Author: Michał Górny <mgorny@gentoo.org>
10 mgorny 1.1 # @BLURB: flags and utility functions for building multilib packages
11     # @DESCRIPTION:
12     # The multilib-build.eclass exports USE flags and utility functions
13     # necessary to build packages for multilib in a clean and uniform
14     # manner.
15     #
16     # Please note that dependency specifications for multilib-capable
17     # dependencies shall use the USE dependency string in ${MULTILIB_USEDEP}
18     # to properly request multilib enabled.
19    
20     if [[ ! ${_MULTILIB_BUILD} ]]; then
21    
22 mgorny 1.12 # EAPI=4 is required for meaningful MULTILIB_USEDEP.
23 mgorny 1.1 case ${EAPI:-0} in
24 mgorny 1.12 4|5) ;;
25 mgorny 1.1 *) die "EAPI=${EAPI} is not supported" ;;
26     esac
27    
28 mgorny 1.8 inherit multibuild multilib
29 mgorny 1.1
30     # @ECLASS-VARIABLE: _MULTILIB_FLAGS
31     # @INTERNAL
32     # @DESCRIPTION:
33 mgorny 1.21 # The list of multilib flags and corresponding ABI values. If the same
34     # flag is reused for multiple ABIs (e.g. x86 on Linux&FreeBSD), multiple
35     # ABIs may be separated by commas.
36 mgorny 1.33 #
37     # Please contact multilib before modifying this list. This way we can
38     # ensure that every *preliminary* work is done and the multilib can be
39     # extended safely.
40 mgorny 1.1 _MULTILIB_FLAGS=(
41 mgorny 1.21 abi_x86_32:x86,x86_fbsd
42     abi_x86_64:amd64,amd64_fbsd
43 mgorny 1.6 abi_x86_x32:x32
44 mattst88 1.17 abi_mips_n32:n32
45     abi_mips_n64:n64
46     abi_mips_o32:o32
47 mgorny 1.57 abi_ppc_32:ppc
48     abi_ppc_64:ppc64
49 mgorny 1.1 )
50    
51 mgorny 1.46 # @ECLASS-VARIABLE: MULTILIB_COMPAT
52     # @DEFAULT_UNSET
53     # @DESCRIPTION:
54     # List of multilib ABIs supported by the ebuild. If unset, defaults to
55     # all ABIs supported by the eclass.
56     #
57     # This variable is intended for use in prebuilt multilib packages that
58     # can provide binaries only for a limited set of ABIs. If ABIs need to
59     # be limited due to a bug in source code, package.use.mask is
60     # recommended instead.
61     #
62     # Example use:
63     # @CODE
64     # # Upstream provides binaries for x86 & amd64 only
65     # MULTILIB_COMPAT=( abi_x86_{32,64} )
66     # @CODE
67    
68 mgorny 1.1 # @ECLASS-VARIABLE: MULTILIB_USEDEP
69     # @DESCRIPTION:
70     # The USE-dependency to be used on dependencies (libraries) needing
71     # to support multilib as well.
72     #
73     # Example use:
74     # @CODE
75     # RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}]
76     # net-libs/libbar[ssl,${MULTILIB_USEDEP}]"
77     # @CODE
78    
79 mgorny 1.50 # @ECLASS-VARIABLE: MULTILIB_ABI_FLAG
80     # @DEFAULT_UNSET
81     # @DESCRIPTION:
82     # The complete ABI name. Resembles the USE flag name.
83     #
84     # This is set within multilib_foreach_abi(),
85     # multilib_parallel_foreach_abi() and multilib-minimal sub-phase
86     # functions.
87     #
88     # It may be null (empty) when the build is done on ABI not controlled
89     # by a USE flag (e.g. on non-multilib arch or when using multilib
90     # portage). The build will always be done for a single ABI then.
91     #
92     # Example value:
93     # @CODE
94     # abi_x86_64
95     # @CODE
96    
97 mgorny 1.1 _multilib_build_set_globals() {
98     local flags=( "${_MULTILIB_FLAGS[@]%:*}" )
99 mgorny 1.46
100     if [[ ${MULTILIB_COMPAT[@]} ]]; then
101     # Validate MULTILIB_COMPAT and filter out the flags.
102     local f
103     for f in "${MULTILIB_COMPAT[@]}"; do
104     if ! has "${f}" "${flags[@]}"; then
105     die "Invalid value in MULTILIB_COMPAT: ${f}"
106     fi
107     done
108    
109     flags=( "${MULTILIB_COMPAT[@]}" )
110     fi
111    
112 mgorny 1.1 local usedeps=${flags[@]/%/(-)?}
113    
114     IUSE=${flags[*]}
115     MULTILIB_USEDEP=${usedeps// /,}
116     }
117     _multilib_build_set_globals
118    
119     # @FUNCTION: multilib_get_enabled_abis
120     # @DESCRIPTION:
121     # Return the ordered list of enabled ABIs if multilib builds
122     # are enabled. The best (most preferred) ABI will come last.
123     #
124     # If multilib is disabled, the default ABI will be returned
125     # in order to enforce consistent testing with multilib code.
126     multilib_get_enabled_abis() {
127     debug-print-function ${FUNCNAME} "${@}"
128    
129 mgorny 1.49 local pairs=( $(multilib_get_enabled_abi_pairs) )
130 mgorny 1.55 echo "${pairs[@]#*.}"
131 mgorny 1.49 }
132    
133     # @FUNCTION: multilib_get_enabled_abi_pairs
134     # @DESCRIPTION:
135 mgorny 1.54 # Return the ordered list of enabled <use-flag>.<ABI> pairs
136 mgorny 1.49 # if multilib builds are enabled. The best (most preferred)
137     # ABI will come last.
138     #
139     # If multilib is disabled, the default ABI will be returned
140     # along with empty <use-flag>.
141     multilib_get_enabled_abi_pairs() {
142     debug-print-function ${FUNCNAME} "${@}"
143    
144 mgorny 1.1 local abis=( $(get_all_abis) )
145    
146     local abi i found
147     for abi in "${abis[@]}"; do
148     for i in "${_MULTILIB_FLAGS[@]}"; do
149 mgorny 1.21 local m_abis=${i#*:} m_abi
150 mgorny 1.1 local m_flag=${i%:*}
151    
152 mgorny 1.22 # split on ,; we can't switch IFS for function scope because
153     # paludis is broken (bug #486592), and switching it locally
154 mgorny 1.23 # for the split is more complex than cheating like this
155     for m_abi in ${m_abis//,/ }; do
156 mgorny 1.58 if [[ ${m_abi} == ${abi} ]] \
157     && has "${m_flag}" "${MULTILIB_COMPAT[@]}" \
158     && use "${m_flag}"
159     then
160 mgorny 1.54 echo "${m_flag}.${abi}"
161 mgorny 1.21 found=1
162     break 2
163     fi
164     done
165 mgorny 1.1 done
166     done
167    
168     if [[ ! ${found} ]]; then
169 mgorny 1.7 # ${ABI} can be used to override the fallback (multilib-portage),
170     # ${DEFAULT_ABI} is the safe fallback.
171     local abi=${ABI:-${DEFAULT_ABI}}
172    
173     debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
174     debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
175 mgorny 1.54 echo ".${abi}"
176 mgorny 1.1 fi
177     }
178    
179 mgorny 1.8 # @FUNCTION: _multilib_multibuild_wrapper
180     # @USAGE: <argv>...
181     # @INTERNAL
182     # @DESCRIPTION:
183     # Initialize the environment for ABI selected for multibuild.
184     _multilib_multibuild_wrapper() {
185     debug-print-function ${FUNCNAME} "${@}"
186    
187 mgorny 1.54 local ABI=${MULTIBUILD_VARIANT#*.}
188     local MULTILIB_ABI_FLAG=${MULTIBUILD_VARIANT%.*}
189 mgorny 1.50
190 mgorny 1.8 multilib_toolchain_setup "${ABI}"
191     "${@}"
192     }
193    
194 mgorny 1.1 # @FUNCTION: multilib_foreach_abi
195     # @USAGE: <argv>...
196     # @DESCRIPTION:
197     # If multilib support is enabled, sets the toolchain up for each
198     # supported ABI along with the ABI variable and correct BUILD_DIR,
199     # and runs the given commands with them.
200     #
201     # If multilib support is disabled, it just runs the commands. No setup
202     # is done.
203     multilib_foreach_abi() {
204 mgorny 1.8 debug-print-function ${FUNCNAME} "${@}"
205 mgorny 1.1
206 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
207 mgorny 1.8 multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
208 mgorny 1.1 }
209    
210     # @FUNCTION: multilib_parallel_foreach_abi
211     # @USAGE: <argv>...
212     # @DESCRIPTION:
213     # If multilib support is enabled, sets the toolchain up for each
214     # supported ABI along with the ABI variable and correct BUILD_DIR,
215     # and runs the given commands with them. The commands are run
216     # in parallel with number of jobs being determined from MAKEOPTS.
217     #
218     # If multilib support is disabled, it just runs the commands. No setup
219     # is done.
220     #
221     # Useful for running configure scripts.
222     multilib_parallel_foreach_abi() {
223 mgorny 1.8 debug-print-function ${FUNCNAME} "${@}"
224 mgorny 1.1
225 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
226 mgorny 1.8 multibuild_parallel_foreach_variant _multilib_multibuild_wrapper "${@}"
227 mgorny 1.1 }
228    
229 mgorny 1.9 # @FUNCTION: multilib_for_best_abi
230     # @USAGE: <argv>...
231     # @DESCRIPTION:
232     # Runs the given command with setup for the 'best' (usually native) ABI.
233     multilib_for_best_abi() {
234     debug-print-function ${FUNCNAME} "${@}"
235    
236 mgorny 1.51 eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should"
237     eqawarn "not be used. The multilib_is_native_abi() check may be used instead."
238    
239 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
240 mgorny 1.9
241     multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
242     }
243    
244 mgorny 1.2 # @FUNCTION: multilib_check_headers
245     # @DESCRIPTION:
246     # Check whether the header files are consistent between ABIs.
247     #
248     # This function needs to be called after each ABI's installation phase.
249     # It obtains the header file checksums and compares them with previous
250     # runs (if any). Dies if header files differ.
251     multilib_check_headers() {
252     _multilib_header_cksum() {
253 mgorny 1.4 [[ -d ${ED}usr/include ]] && \
254 mgorny 1.2 find "${ED}"usr/include -type f \
255     -exec cksum {} + | sort -k2
256     }
257    
258     local cksum=$(_multilib_header_cksum)
259     local cksum_file=${T}/.multilib_header_cksum
260    
261     if [[ -f ${cksum_file} ]]; then
262     local cksum_prev=$(< "${cksum_file}")
263    
264     if [[ ${cksum} != ${cksum_prev} ]]; then
265     echo "${cksum}" > "${cksum_file}.new"
266    
267     eerror "Header files have changed between ABIs."
268    
269     if type -p diff &>/dev/null; then
270     eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")"
271     else
272     eerror "Old checksums in: ${cksum_file}"
273     eerror "New checksums in: ${cksum_file}.new"
274     fi
275    
276     die "Header checksum mismatch, aborting."
277     fi
278     else
279     echo "${cksum}" > "${cksum_file}"
280     fi
281     }
282    
283 mgorny 1.10 # @FUNCTION: multilib_copy_sources
284     # @DESCRIPTION:
285     # Create a single copy of the package sources for each enabled ABI.
286     #
287     # The sources are always copied from initial BUILD_DIR (or S if unset)
288     # to ABI-specific build directory matching BUILD_DIR used by
289     # multilib_foreach_abi().
290     multilib_copy_sources() {
291     debug-print-function ${FUNCNAME} "${@}"
292    
293 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
294 mgorny 1.10 multibuild_copy_sources
295     }
296    
297 mgorny 1.11 # @ECLASS-VARIABLE: MULTILIB_WRAPPED_HEADERS
298     # @DESCRIPTION:
299     # A list of headers to wrap for multilib support. The listed headers
300     # will be moved to a non-standard location and replaced with a file
301     # including them conditionally to current ABI.
302     #
303     # This variable has to be a bash array. Paths shall be relative to
304     # installation root (${ED}), and name regular files. Recursive wrapping
305     # is not supported.
306     #
307     # Please note that header wrapping is *discouraged*. It is preferred to
308     # install all headers in a subdirectory of libdir and use pkg-config to
309     # locate the headers. Some C preprocessors will not work with wrapped
310     # headers.
311     #
312     # Example:
313     # @CODE
314     # MULTILIB_WRAPPED_HEADERS=(
315     # /usr/include/foobar/config.h
316     # )
317     # @CODE
318    
319 mgorny 1.26 # @ECLASS-VARIABLE: MULTILIB_CHOST_TOOLS
320     # @DESCRIPTION:
321     # A list of tool executables to preserve for each multilib ABI.
322     # The listed executables will be renamed to ${CHOST}-${basename},
323     # and the native variant will be symlinked to the generic name.
324     #
325     # This variable has to be a bash array. Paths shall be relative to
326 mgorny 1.29 # installation root (${ED}), and name regular files or symbolic
327     # links to regular files. Recursive wrapping is not supported.
328     #
329     # If symbolic link is passed, both symlink path and symlink target
330     # will be changed. As a result, the symlink target is expected
331     # to be wrapped as well (either by listing in MULTILIB_CHOST_TOOLS
332     # or externally).
333 mgorny 1.26 #
334     # Please note that tool wrapping is *discouraged*. It is preferred to
335     # install pkg-config files for each ABI, and require reverse
336     # dependencies to use that.
337     #
338     # Packages that search for tools properly (e.g. using AC_PATH_TOOL
339     # macro) will find the wrapper executables automatically. Other packages
340     # will need explicit override of tool paths.
341     #
342     # Example:
343     # @CODE
344     # MULTILIB_CHOST_TOOLS=(
345     # /usr/bin/foo-config
346     # )
347    
348     # @CODE
349 mgorny 1.11 # @FUNCTION: multilib_prepare_wrappers
350     # @USAGE: [<install-root>]
351     # @DESCRIPTION:
352     # Perform the preparation of all kinds of wrappers for the current ABI.
353     # This function shall be called once per each ABI, after installing
354     # the files to be wrapped.
355     #
356     # Takes an optional custom <install-root> from which files will be
357     # used. If no root is specified, uses ${ED}.
358     #
359     # The files to be wrapped are specified using separate variables,
360     # e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
361     # between the successive calls to multilib_prepare_wrappers
362     # and multilib_install_wrappers.
363     #
364     # After all wrappers are prepared, multilib_install_wrappers shall
365     # be called to commit them to the installation tree.
366     multilib_prepare_wrappers() {
367     debug-print-function ${FUNCNAME} "${@}"
368    
369     [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
370    
371     local root=${1:-${ED}}
372     local f
373    
374 mgorny 1.43 if [[ ${COMPLETE_MULTILIB} == yes ]]; then
375     # symlink '${CHOST}-foo -> foo' to support abi-wrapper while
376     # keeping ${CHOST}-foo calls correct.
377    
378     for f in "${MULTILIB_CHOST_TOOLS[@]}"; do
379     # drop leading slash if it's there
380     f=${f#/}
381    
382     local dir=${f%/*}
383     local fn=${f##*/}
384    
385     ln -s "${fn}" "${root}/${dir}/${CHOST}-${fn}" || die
386     done
387    
388     return
389     fi
390    
391 mgorny 1.44 for f in "${MULTILIB_CHOST_TOOLS[@]}"; do
392     # drop leading slash if it's there
393     f=${f#/}
394    
395     local dir=${f%/*}
396     local fn=${f##*/}
397    
398     if [[ -L ${root}/${f} ]]; then
399     # rewrite the symlink target
400     local target=$(readlink "${root}/${f}")
401     local target_dir
402     local target_fn=${target##*/}
403    
404     [[ ${target} == */* ]] && target_dir=${target%/*}
405    
406     ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" \
407     "${root}/${f}" || die
408     fi
409    
410     mv "${root}/${f}" "${root}/${dir}/${CHOST}-${fn}" || die
411    
412     # symlink the native one back
413     if multilib_is_native_abi; then
414     ln -s "${CHOST}-${fn}" "${root}/${f}" || die
415     fi
416     done
417    
418 mgorny 1.45 if [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
419 mgorny 1.52 # If abi_flag is unset, then header wrapping is unsupported on
420     # this ABI. This means the arch doesn't support multilib at all
421     # -- in this case, the headers are not wrapped and everything
422     # works as expected.
423 mgorny 1.45
424 mgorny 1.52 if [[ ${MULTILIB_ABI_FLAG} ]]; then
425 mgorny 1.45 for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
426     # drop leading slash if it's there
427     f=${f#/}
428 mgorny 1.11
429 mgorny 1.45 if [[ ${f} != usr/include/* ]]; then
430     die "Wrapping headers outside of /usr/include is not supported at the moment."
431     fi
432     # and then usr/include
433     f=${f#usr/include}
434 mgorny 1.11
435 mgorny 1.45 local dir=${f%/*}
436 mgorny 1.11
437 mgorny 1.48 # Some ABIs may have install less files than others.
438     if [[ -f ${root}/usr/include${f} ]]; then
439 mgorny 1.52 local wrapper=${ED}/tmp/multilib-include${f}
440    
441 mgorny 1.48 if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
442     dodir "/tmp/multilib-include${dir}"
443     # a generic template
444 mgorny 1.52 cat > "${wrapper}" <<_EOF_
445 mgorny 1.11 /* This file is auto-generated by multilib-build.eclass
446     * as a multilib-friendly wrapper. For the original content,
447     * please see the files that are #included below.
448     */
449    
450     #if defined(__x86_64__) /* amd64 */
451     # if defined(__ILP32__) /* x32 ABI */
452     # error "abi_x86_x32 not supported by the package."
453     # else /* 64-bit ABI */
454     # error "abi_x86_64 not supported by the package."
455     # endif
456     #elif defined(__i386__) /* plain x86 */
457     # error "abi_x86_32 not supported by the package."
458 mattst88 1.17 #elif defined(__mips__)
459     # if(_MIPS_SIM == _ABIN32) /* n32 */
460     # error "abi_mips_n32 not supported by the package."
461     # elif(_MIPS_SIM == _ABI64) /* n64 */
462     # error "abi_mips_n64 not supported by the package."
463     # elif(_MIPS_SIM == _ABIO32) /* o32 */
464     # error "abi_mips_o32 not supported by the package."
465     # endif
466 mgorny 1.53 #elif defined(__sparc__)
467     # if defined(__arch64__)
468     # error "abi_sparc_64 not supported by the package."
469     # else
470     # error "abi_sparc_32 not supported by the package."
471     # endif
472     #elif defined(__s390__)
473     # if defined(__s390x__)
474     # error "abi_s390_64 not supported by the package."
475     # else
476     # error "abi_s390_32 not supported by the package."
477     # endif
478     #elif defined(__powerpc__)
479     # if defined(__powerpc64__)
480     # error "abi_ppc_64 not supported by the package."
481     # else
482     # error "abi_ppc_32 not supported by the package."
483     # endif
484 mgorny 1.56 #elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
485     # error "Native ABI not supported by the package."
486 mgorny 1.11 #else
487     # error "No ABI matched, please report a bug to bugs.gentoo.org"
488     #endif
489     _EOF_
490 mgorny 1.48 fi
491 mgorny 1.11
492 mgorny 1.52 if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"
493     then
494     die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org."
495     fi
496    
497 mgorny 1.45 # $CHOST shall be set by multilib_toolchain_setup
498     dodir "/tmp/multilib-include/${CHOST}${dir}"
499     mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
500    
501     # Note: match a space afterwards to avoid collision potential.
502 mgorny 1.52 sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
503     -i "${wrapper}" || die
504 mgorny 1.47
505     # Hack for emul-linux-x86 compatibility.
506     # It assumes amd64 will come after x86, and will use amd64
507     # headers if no specific x86 headers were installed.
508     if [[ ${ABI} == amd64 ]]; then
509     sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
510 mgorny 1.52 -i "${wrapper}" || die
511 mgorny 1.47 fi
512 mgorny 1.56
513     # Needed for swig.
514     if multilib_is_native_abi; then
515     sed -e "/Native ABI/s&error.*&include <${CHOST}${f}>&" \
516     -i "${wrapper}" || die
517     fi
518 mgorny 1.45 fi
519     done
520 mgorny 1.18 fi
521 mgorny 1.45 fi
522 mgorny 1.11 }
523    
524     # @FUNCTION: multilib_install_wrappers
525     # @USAGE: [<install-root>]
526     # @DESCRIPTION:
527     # Install the previously-prepared wrappers. This function shall
528     # be called once, after all wrappers were prepared.
529     #
530     # Takes an optional custom <install-root> to which the wrappers will be
531     # installed. If no root is specified, uses ${ED}. There is no need to
532     # use the same root as when preparing the wrappers.
533     #
534     # The files to be wrapped are specified using separate variables,
535     # e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
536     # between the calls to multilib_prepare_wrappers
537     # and multilib_install_wrappers.
538     multilib_install_wrappers() {
539     debug-print-function ${FUNCNAME} "${@}"
540    
541     [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
542    
543 mgorny 1.42 [[ ${COMPLETE_MULTILIB} == yes ]] && return
544 mgorny 1.41
545 mgorny 1.11 local root=${1:-${ED}}
546    
547     if [[ -d "${ED}"/tmp/multilib-include ]]; then
548     multibuild_merge_root \
549     "${ED}"/tmp/multilib-include "${root}"/usr/include
550     # it can fail if something else uses /tmp
551     rmdir "${ED}"/tmp &>/dev/null
552     fi
553     }
554    
555 mgorny 1.15 # @FUNCTION: multilib_is_native_abi
556     # @DESCRIPTION:
557     # Determine whether the currently built ABI is the profile native.
558     # Return true status (0) if that is true, otherwise false (1).
559     #
560 mgorny 1.25 # This function is not intended to be used directly. Please use
561     # multilib_build_binaries instead.
562 mgorny 1.15 multilib_is_native_abi() {
563     debug-print-function ${FUNCNAME} "${@}"
564    
565 mgorny 1.40 [[ ${#} -eq 0 ]] || die "${FUNCNAME}: too many arguments"
566    
567     [[ ${COMPLETE_MULTILIB} == yes || ${ABI} == ${DEFAULT_ABI} ]]
568 mgorny 1.15 }
569    
570 tommy 1.20 # @FUNCTION: multilib_build_binaries
571     # @DESCRIPTION:
572 mgorny 1.27 # Determine whether to build binaries for the currently built ABI.
573 mgorny 1.25 # Returns true status (0) if the currently built ABI is the profile
574     # native or COMPLETE_MULTILIB variable is set to 'yes', otherwise
575 tommy 1.20 # false (1).
576     #
577 mgorny 1.25 # This is often useful for configure calls when some of the options are
578     # supposed to be disabled for multilib ABIs (like those used for
579     # executables only).
580 tommy 1.19 multilib_build_binaries() {
581     debug-print-function ${FUNCNAME} "${@}"
582    
583 mgorny 1.40 eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent"
584     eqawarn "multilib_is_native_abi function instead."
585 tommy 1.19
586 mgorny 1.40 multilib_is_native_abi "${@}"
587 tommy 1.19 }
588 tommy 1.20
589 mgorny 1.35 # @FUNCTION: multilib_native_use_with
590     # @USAGE: <flag> [<opt-name> [<opt-value>]]
591     # @DESCRIPTION:
592     # Output --with configure option alike use_with if USE <flag> is enabled
593 mgorny 1.40 # and executables are being built (multilib_is_native_abi is true).
594 mgorny 1.35 # Otherwise, outputs --without configure option. Arguments are the same
595     # as for use_with in the EAPI.
596     multilib_native_use_with() {
597 mgorny 1.40 if multilib_is_native_abi; then
598 mgorny 1.35 use_with "${@}"
599     else
600     echo "--without-${2:-${1}}"
601     fi
602     }
603    
604     # @FUNCTION: multilib_native_use_enable
605     # @USAGE: <flag> [<opt-name> [<opt-value>]]
606     # @DESCRIPTION:
607     # Output --enable configure option alike use_with if USE <flag>
608 mgorny 1.40 # is enabled and executables are being built (multilib_is_native_abi
609 mgorny 1.35 # is true). Otherwise, outputs --disable configure option. Arguments are
610     # the same as for use_enable in the EAPI.
611     multilib_native_use_enable() {
612 mgorny 1.40 if multilib_is_native_abi; then
613 mgorny 1.35 use_enable "${@}"
614     else
615     echo "--disable-${2:-${1}}"
616     fi
617     }
618    
619     # @FUNCTION: multilib_native_usex
620     # @USAGE: <flag> [<true1> [<false1> [<true2> [<false2>]]]]
621     # @DESCRIPTION:
622     # Output the concatenation of <true1> (or 'yes' if unspecified)
623     # and <true2> if USE <flag> is enabled and executables are being built
624 mgorny 1.40 # (multilib_is_native_abi is true). Otherwise, output the concatenation
625 mgorny 1.35 # of <false1> (or 'no' if unspecified) and <false2>. Arguments
626     # are the same as for usex in the EAPI.
627     #
628     # Note: in EAPI 4 you need to inherit eutils to use this function.
629     multilib_native_usex() {
630 mgorny 1.40 if multilib_is_native_abi; then
631 mgorny 1.35 usex "${@}"
632     else
633     echo "${3-no}${5}"
634     fi
635     }
636    
637 mgorny 1.1 _MULTILIB_BUILD=1
638     fi

  ViewVC Help
Powered by ViewVC 1.1.20