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

Contents of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.57 - (hide annotations) (download)
Sat Jun 28 09:56:26 2014 UTC (3 years, 5 months ago) by mgorny
Branch: MAIN
Changes since 1.56: +3 -1 lines
Enable multilib flags for ppc. Since ppc profiles are not multilib at the moment, this should not create any new issues.

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

  ViewVC Help
Powered by ViewVC 1.1.20