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

Contents of /eclass/multilib-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.64 - (hide annotations) (download)
Sun Aug 17 03:34:32 2014 UTC (4 days, 20 hours ago) by jcallen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.63: +31 -13 lines
Add new multilib_native_enable and multilib_native_with functions; fix documentation

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 jcallen 1.64 # $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.63 2014/07/04 13:02:21 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 grobian 1.62 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 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 grobian 1.62 abi_ppc_32:ppc,ppc_aix,ppc_macos
48 mgorny 1.57 abi_ppc_64:ppc64
49 mgorny 1.60 abi_s390_32:s390
50     abi_s390_64:s390x
51 mgorny 1.1 )
52    
53 mgorny 1.46 # @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 mgorny 1.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 mgorny 1.46 #
71     # Example use:
72     # @CODE
73     # # Upstream provides binaries for x86 & amd64 only
74     # MULTILIB_COMPAT=( abi_x86_{32,64} )
75     # @CODE
76    
77 mgorny 1.1 # @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 mgorny 1.50 # @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 mgorny 1.1 _multilib_build_set_globals() {
107     local flags=( "${_MULTILIB_FLAGS[@]%:*}" )
108 mgorny 1.46
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 mgorny 1.63
120     REQUIRED_USE="|| ( ${flags[*]} )"
121 mgorny 1.46 fi
122    
123 mgorny 1.1 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 mgorny 1.49 local pairs=( $(multilib_get_enabled_abi_pairs) )
141 mgorny 1.55 echo "${pairs[@]#*.}"
142 mgorny 1.49 }
143    
144     # @FUNCTION: multilib_get_enabled_abi_pairs
145     # @DESCRIPTION:
146 mgorny 1.54 # Return the ordered list of enabled <use-flag>.<ABI> pairs
147 mgorny 1.49 # 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 mgorny 1.1 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 mgorny 1.21 local m_abis=${i#*:} m_abi
161 mgorny 1.1 local m_flag=${i%:*}
162    
163 mgorny 1.22 # split on ,; we can't switch IFS for function scope because
164     # paludis is broken (bug #486592), and switching it locally
165 mgorny 1.23 # for the split is more complex than cheating like this
166     for m_abi in ${m_abis//,/ }; do
167 mgorny 1.58 if [[ ${m_abi} == ${abi} ]] \
168 mgorny 1.59 && { [[ ! "${MULTILIB_COMPAT[@]}" ]] || has "${m_flag}" "${MULTILIB_COMPAT[@]}"; } \
169 mgorny 1.58 && use "${m_flag}"
170     then
171 mgorny 1.54 echo "${m_flag}.${abi}"
172 mgorny 1.21 found=1
173     break 2
174     fi
175     done
176 mgorny 1.1 done
177     done
178    
179     if [[ ! ${found} ]]; then
180 mgorny 1.7 # ${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 mgorny 1.54 echo ".${abi}"
187 mgorny 1.1 fi
188     }
189    
190 mgorny 1.8 # @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 mgorny 1.54 local ABI=${MULTIBUILD_VARIANT#*.}
199     local MULTILIB_ABI_FLAG=${MULTIBUILD_VARIANT%.*}
200 mgorny 1.50
201 mgorny 1.8 multilib_toolchain_setup "${ABI}"
202     "${@}"
203     }
204    
205 mgorny 1.1 # @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 mgorny 1.8 debug-print-function ${FUNCNAME} "${@}"
216 mgorny 1.1
217 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
218 mgorny 1.8 multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
219 mgorny 1.1 }
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. The commands are run
227     # in parallel with number of jobs being determined from MAKEOPTS.
228     #
229     # If multilib support is disabled, it just runs the commands. No setup
230     # is done.
231     #
232     # Useful for running configure scripts.
233     multilib_parallel_foreach_abi() {
234 mgorny 1.8 debug-print-function ${FUNCNAME} "${@}"
235 mgorny 1.1
236 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
237 mgorny 1.8 multibuild_parallel_foreach_variant _multilib_multibuild_wrapper "${@}"
238 mgorny 1.1 }
239    
240 mgorny 1.9 # @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 mgorny 1.51 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 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
251 mgorny 1.9
252     multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
253     }
254    
255 mgorny 1.2 # @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 mgorny 1.4 [[ -d ${ED}usr/include ]] && \
265 mgorny 1.2 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 mgorny 1.10 # @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 mgorny 1.50 local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abi_pairs) )
305 mgorny 1.10 multibuild_copy_sources
306     }
307    
308 mgorny 1.11 # @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 mgorny 1.26 # @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 mgorny 1.29 # 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 mgorny 1.26 #
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 mgorny 1.11 # @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 mgorny 1.43 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 mgorny 1.44 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 mgorny 1.45 if [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
430 mgorny 1.52 # 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 mgorny 1.45
435 mgorny 1.52 if [[ ${MULTILIB_ABI_FLAG} ]]; then
436 mgorny 1.45 for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
437     # drop leading slash if it's there
438     f=${f#/}
439 mgorny 1.11
440 mgorny 1.45 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 mgorny 1.11
446 mgorny 1.45 local dir=${f%/*}
447 mgorny 1.11
448 mgorny 1.48 # Some ABIs may have install less files than others.
449     if [[ -f ${root}/usr/include${f} ]]; then
450 mgorny 1.52 local wrapper=${ED}/tmp/multilib-include${f}
451    
452 mgorny 1.48 if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
453     dodir "/tmp/multilib-include${dir}"
454     # a generic template
455 mgorny 1.52 cat > "${wrapper}" <<_EOF_
456 mgorny 1.11 /* 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 mattst88 1.17 #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 mgorny 1.53 #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 mgorny 1.56 #elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
496     # error "Native ABI not supported by the package."
497 mgorny 1.11 #else
498     # error "No ABI matched, please report a bug to bugs.gentoo.org"
499     #endif
500     _EOF_
501 mgorny 1.48 fi
502 mgorny 1.11
503 mgorny 1.52 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 mgorny 1.45 # $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 mgorny 1.52 sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
514     -i "${wrapper}" || die
515 mgorny 1.47
516     # Hack for emul-linux-x86 compatibility.
517     # It assumes amd64 will come after x86, and will use amd64
518     # headers if no specific x86 headers were installed.
519     if [[ ${ABI} == amd64 ]]; then
520     sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
521 mgorny 1.52 -i "${wrapper}" || die
522 mgorny 1.47 fi
523 mgorny 1.56
524     # Needed for swig.
525     if multilib_is_native_abi; then
526     sed -e "/Native ABI/s&error.*&include <${CHOST}${f}>&" \
527     -i "${wrapper}" || die
528     fi
529 mgorny 1.45 fi
530     done
531 mgorny 1.18 fi
532 mgorny 1.45 fi
533 mgorny 1.11 }
534    
535     # @FUNCTION: multilib_install_wrappers
536     # @USAGE: [<install-root>]
537     # @DESCRIPTION:
538     # Install the previously-prepared wrappers. This function shall
539     # be called once, after all wrappers were prepared.
540     #
541     # Takes an optional custom <install-root> to which the wrappers will be
542     # installed. If no root is specified, uses ${ED}. There is no need to
543     # use the same root as when preparing the wrappers.
544     #
545     # The files to be wrapped are specified using separate variables,
546     # e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
547     # between the calls to multilib_prepare_wrappers
548     # and multilib_install_wrappers.
549     multilib_install_wrappers() {
550     debug-print-function ${FUNCNAME} "${@}"
551    
552     [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
553    
554 mgorny 1.42 [[ ${COMPLETE_MULTILIB} == yes ]] && return
555 mgorny 1.41
556 mgorny 1.11 local root=${1:-${ED}}
557    
558     if [[ -d "${ED}"/tmp/multilib-include ]]; then
559     multibuild_merge_root \
560     "${ED}"/tmp/multilib-include "${root}"/usr/include
561     # it can fail if something else uses /tmp
562     rmdir "${ED}"/tmp &>/dev/null
563     fi
564     }
565    
566 mgorny 1.15 # @FUNCTION: multilib_is_native_abi
567     # @DESCRIPTION:
568     # Determine whether the currently built ABI is the profile native.
569     # Return true status (0) if that is true, otherwise false (1).
570     multilib_is_native_abi() {
571     debug-print-function ${FUNCNAME} "${@}"
572    
573 mgorny 1.40 [[ ${#} -eq 0 ]] || die "${FUNCNAME}: too many arguments"
574    
575     [[ ${COMPLETE_MULTILIB} == yes || ${ABI} == ${DEFAULT_ABI} ]]
576 mgorny 1.15 }
577    
578 tommy 1.20 # @FUNCTION: multilib_build_binaries
579     # @DESCRIPTION:
580 jcallen 1.64 # Deprecated synonym for multilib_is_native_abi
581 tommy 1.19 multilib_build_binaries() {
582     debug-print-function ${FUNCNAME} "${@}"
583    
584 mgorny 1.40 eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent"
585     eqawarn "multilib_is_native_abi function instead."
586 tommy 1.19
587 mgorny 1.40 multilib_is_native_abi "${@}"
588 tommy 1.19 }
589 tommy 1.20
590 mgorny 1.35 # @FUNCTION: multilib_native_use_with
591     # @USAGE: <flag> [<opt-name> [<opt-value>]]
592     # @DESCRIPTION:
593     # Output --with configure option alike use_with if USE <flag> is enabled
594 mgorny 1.40 # and executables are being built (multilib_is_native_abi is true).
595 mgorny 1.35 # Otherwise, outputs --without configure option. Arguments are the same
596     # as for use_with in the EAPI.
597     multilib_native_use_with() {
598 mgorny 1.40 if multilib_is_native_abi; then
599 mgorny 1.35 use_with "${@}"
600     else
601     echo "--without-${2:-${1}}"
602     fi
603     }
604    
605     # @FUNCTION: multilib_native_use_enable
606     # @USAGE: <flag> [<opt-name> [<opt-value>]]
607     # @DESCRIPTION:
608 jcallen 1.64 # Output --enable configure option alike use_enable if USE <flag>
609 mgorny 1.40 # is enabled and executables are being built (multilib_is_native_abi
610 mgorny 1.35 # is true). Otherwise, outputs --disable configure option. Arguments are
611     # the same as for use_enable in the EAPI.
612     multilib_native_use_enable() {
613 mgorny 1.40 if multilib_is_native_abi; then
614 mgorny 1.35 use_enable "${@}"
615     else
616     echo "--disable-${2:-${1}}"
617     fi
618     }
619    
620 jcallen 1.64 # @FUNCTION: multilib_native_enable
621     # @USAGE: <opt-name> [<opt-value>]
622     # @DESCRIPTION:
623     # Output --enable configure option if executables are being built
624     # (multilib_is_native_abi is true). Otherwise, output --disable configure
625     # option.
626     multilib_native_enable() {
627     if multilib_is_native_abi; then
628     echo "--enable-${1}${2+=${2}}"
629     else
630     echo "--disable-${1}"
631     fi
632     }
633    
634     # @FUNCTION: multilib_native_with
635     # @USAGE: <opt-name> [<opt-value>]
636     # @DESCRIPTION:
637     # Output --with configure option if executables are being built
638     # (multilib_is_native_abi is true). Otherwise, output --without configure
639     # option.
640     multilib_native_with() {
641     if multilib_is_native_abi; then
642     echo "--with-${1}${2+=${2}}"
643     else
644     echo "--without-${1}"
645     fi
646     }
647    
648 mgorny 1.35 # @FUNCTION: multilib_native_usex
649     # @USAGE: <flag> [<true1> [<false1> [<true2> [<false2>]]]]
650     # @DESCRIPTION:
651     # Output the concatenation of <true1> (or 'yes' if unspecified)
652     # and <true2> if USE <flag> is enabled and executables are being built
653 mgorny 1.40 # (multilib_is_native_abi is true). Otherwise, output the concatenation
654 mgorny 1.35 # of <false1> (or 'no' if unspecified) and <false2>. Arguments
655     # are the same as for usex in the EAPI.
656     #
657     # Note: in EAPI 4 you need to inherit eutils to use this function.
658     multilib_native_usex() {
659 mgorny 1.40 if multilib_is_native_abi; then
660 mgorny 1.35 usex "${@}"
661     else
662     echo "${3-no}${5}"
663     fi
664     }
665    
666 mgorny 1.1 _MULTILIB_BUILD=1
667     fi

  ViewVC Help
Powered by ViewVC 1.1.20