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

Contents of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.49 - (hide annotations) (download)
Fri May 23 07:11:53 2014 UTC (6 months, 3 weeks ago) by mgorny
Branch: MAIN
Changes since 1.48: +18 -3 lines
Introduce multilib_get_enabled_abi_pairs() to obtain list containing both ABI values and USE flag names.

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

  ViewVC Help
Powered by ViewVC 1.1.20