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

Contents of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.53 - (hide annotations) (download)
Fri May 23 07:53:22 2014 UTC (4 months, 4 weeks ago) by mgorny
Branch: MAIN
Changes since 1.52: +19 -1 lines
Add remaining potential multilib arches to header wrapping template.

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

  ViewVC Help
Powered by ViewVC 1.1.20