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

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

  ViewVC Help
Powered by ViewVC 1.1.20