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

Contents of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.66 - (show annotations) (download)
Fri Jun 26 20:43:13 2015 UTC (15 months ago) by mgorny
Branch: MAIN
CVS Tags: HEAD
Changes since 1.65: +2 -10 lines
Remove emul-linux-x86 hack, since emul-linux-x86 is no more.

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.65 2014/12/13 08:41:37 mgorny Exp $
4
5 # @ECLASS: multilib-build.eclass
6 # @MAINTAINER:
7 # gx86-multilib team <multilib@gentoo.org>
8 # @AUTHOR:
9 # Author: Michał Górny <mgorny@gentoo.org>
10 # @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 # EAPI=4 is required for meaningful MULTILIB_USEDEP.
23 case ${EAPI:-0} in
24 4|5) ;;
25 *) die "EAPI=${EAPI} is not supported" ;;
26 esac
27
28 inherit multibuild multilib
29
30 # @ECLASS-VARIABLE: _MULTILIB_FLAGS
31 # @INTERNAL
32 # @DESCRIPTION:
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.
40 _MULTILIB_FLAGS=(
41 abi_x86_32:x86,x86_fbsd,x86_freebsd,x86_linux,x86_macos,x86_solaris
42 abi_x86_64:amd64,amd64_fbsd,x64_freebsd,amd64_linux,x64_macos,x64_solaris
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
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
76
77 # @ECLASS-VARIABLE: MULTILIB_USEDEP
78 # @DESCRIPTION:
79 # The USE-dependency to be used on dependencies (libraries) needing
80 # to support multilib as well.
81 #
82 # Example use:
83 # @CODE
84 # RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}]
85 # net-libs/libbar[ssl,${MULTILIB_USEDEP}]"
86 # @CODE
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
106 _multilib_build_set_globals() {
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
123 local usedeps=${flags[@]/%/(-)?}
124
125 IUSE=${flags[*]}
126 MULTILIB_USEDEP=${usedeps// /,}
127 }
128 _multilib_build_set_globals
129
130 # @FUNCTION: multilib_get_enabled_abis
131 # @DESCRIPTION:
132 # Return the ordered list of enabled ABIs if multilib builds
133 # are enabled. The best (most preferred) ABI will come last.
134 #
135 # If multilib is disabled, the default ABI will be returned
136 # in order to enforce consistent testing with multilib code.
137 multilib_get_enabled_abis() {
138 debug-print-function ${FUNCNAME} "${@}"
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>.
152 multilib_get_enabled_abi_pairs() {
153 debug-print-function ${FUNCNAME} "${@}"
154
155 local abis=( $(get_all_abis) )
156
157 local abi i found
158 for abi in "${abis[@]}"; do
159 for i in "${_MULTILIB_FLAGS[@]}"; do
160 local m_abis=${i#*:} m_abi
161 local m_flag=${i%:*}
162
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
171 echo "${m_flag}.${abi}"
172 found=1
173 break 2
174 fi
175 done
176 done
177 done
178
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
184 debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
185 debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
186 echo ".${abi}"
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 "${@}"
203 }
204
205 # @FUNCTION: multilib_foreach_abi
206 # @USAGE: <argv>...
207 # @DESCRIPTION:
208 # If multilib support is enabled, sets the toolchain up for each
209 # supported ABI along with the ABI variable and correct BUILD_DIR,
210 # and runs the given commands with them.
211 #
212 # If multilib support is disabled, it just runs the commands. No setup
213 # is done.
214 multilib_foreach_abi() {
215 debug-print-function ${FUNCNAME} "${@}"
216
217 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
218 multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
219 }
220
221 # @FUNCTION: multilib_parallel_foreach_abi
222 # @USAGE: <argv>...
223 # @DESCRIPTION:
224 # If multilib support is enabled, sets the toolchain up for each
225 # supported ABI along with the ABI variable and correct BUILD_DIR,
226 # and runs the given commands with them.
227 #
228 # If multilib support is disabled, it just runs the commands. No setup
229 # is done.
230 #
231 # This function used to run multiple commands in parallel. Now it's just
232 # a deprecated alias to multilib_foreach_abi.
233 multilib_parallel_foreach_abi() {
234 debug-print-function ${FUNCNAME} "${@}"
235
236 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
237 multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
238 }
239
240 # @FUNCTION: multilib_for_best_abi
241 # @USAGE: <argv>...
242 # @DESCRIPTION:
243 # Runs the given command with setup for the 'best' (usually native) ABI.
244 multilib_for_best_abi() {
245 debug-print-function ${FUNCNAME} "${@}"
246
247 eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should"
248 eqawarn "not be used. The multilib_is_native_abi() check may be used instead."
249
250 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
251
252 multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
253 }
254
255 # @FUNCTION: multilib_check_headers
256 # @DESCRIPTION:
257 # Check whether the header files are consistent between ABIs.
258 #
259 # This function needs to be called after each ABI's installation phase.
260 # It obtains the header file checksums and compares them with previous
261 # runs (if any). Dies if header files differ.
262 multilib_check_headers() {
263 _multilib_header_cksum() {
264 [[ -d ${ED}usr/include ]] && \
265 find "${ED}"usr/include -type f \
266 -exec cksum {} + | sort -k2
267 }
268
269 local cksum=$(_multilib_header_cksum)
270 local cksum_file=${T}/.multilib_header_cksum
271
272 if [[ -f ${cksum_file} ]]; then
273 local cksum_prev=$(< "${cksum_file}")
274
275 if [[ ${cksum} != ${cksum_prev} ]]; then
276 echo "${cksum}" > "${cksum_file}.new"
277
278 eerror "Header files have changed between ABIs."
279
280 if type -p diff &>/dev/null; then
281 eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")"
282 else
283 eerror "Old checksums in: ${cksum_file}"
284 eerror "New checksums in: ${cksum_file}.new"
285 fi
286
287 die "Header checksum mismatch, aborting."
288 fi
289 else
290 echo "${cksum}" > "${cksum_file}"
291 fi
292 }
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().
301 multilib_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.
377 multilib_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.
541 multilib_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).
562 multilib_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
573 multilib_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.
589 multilib_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.
604 multilib_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.
618 multilib_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.
632 multilib_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.
650 multilib_native_usex() {
651 if multilib_is_native_abi; then
652 usex "${@}"
653 else
654 echo "${3-no}${5}"
655 fi
656 }
657
658 _MULTILIB_BUILD=1
659 fi

  ViewVC Help
Powered by ViewVC 1.1.20