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

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

  ViewVC Help
Powered by ViewVC 1.1.20