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

Diff of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.66

  ViewVC Help
Powered by ViewVC 1.1.20