summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-04-07 16:56:14 +0000
committerMichał Górny <mgorny@gentoo.org>2013-04-07 16:56:14 +0000
commitcab4def56486b77968cad9283ff16ac992a99f4d (patch)
treecca7571480cf3634a72132dbbee8f2963b15d498 /eclass
parentfix deps (diff)
downloadhistorical-cab4def56486b77968cad9283ff16ac992a99f4d.tar.gz
historical-cab4def56486b77968cad9283ff16ac992a99f4d.tar.bz2
historical-cab4def56486b77968cad9283ff16ac992a99f4d.zip
Move header wrapping to multilib-build. Use the new code in autotools-multilib and multilib-minimal.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog7
-rw-r--r--eclass/autotools-multilib.eclass97
-rw-r--r--eclass/multilib-build.eclass136
-rw-r--r--eclass/multilib-minimal.eclass4
4 files changed, 148 insertions, 96 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index c89662241d8b..f63e1f75e08e 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.768 2013/04/05 15:27:40 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.769 2013/04/07 16:56:14 mgorny Exp $
+
+ 07 Apr 2013; Michał Górny <mgorny@gentoo.org> autotools-multilib.eclass,
+ multilib-build.eclass, multilib-minimal.eclass:
+ Move header wrapping to multilib-build. Use the new code in
+ autotools-multilib and multilib-minimal.
05 Apr 2013; Mike Gilbert <floppym@gentoo.org> mozextension.eclass,
mozlinguas.eclass:
diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass
index 5ecbd2f993d7..5ca81126ab93 100644
--- a/eclass/autotools-multilib.eclass
+++ b/eclass/autotools-multilib.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.14 2013/04/01 11:05:27 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.15 2013/04/07 16:56:14 mgorny Exp $
# @ECLASS: autotools-multilib.eclass
# @MAINTAINER:
@@ -33,28 +33,6 @@ inherit autotools-utils multilib-build
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
-# @ECLASS-VARIABLE: MULTILIB_WRAPPED_HEADERS
-# @DESCRIPTION:
-# A list of headers to wrap for multilib support. The listed headers
-# will be moved to a non-standard location and replace with a file
-# including them conditionally to current ABI.
-#
-# This variable has to be a bash array. Paths shall be relative to
-# installation root (${ED}), and name regular files. Recursive wrapping
-# is not supported.
-#
-# Please note that header wrapping is *discouraged*. It is preferred to
-# install all headers in a subdirectory of libdir and use pkg-config to
-# locate the headers. Some C preprocessors will not work with wrapped
-# headers.
-#
-# Example:
-# @CODE
-# MULTILIB_WRAPPED_HEADERS=(
-# /usr/include/foobar/config.h
-# )
-# @CODE
-
autotools-multilib_src_prepare() {
autotools-utils_src_prepare "${@}"
}
@@ -71,84 +49,17 @@ autotools-multilib_src_test() {
multilib_foreach_abi autotools-utils_src_test "${@}"
}
-_autotools-multilib_wrap_headers() {
- debug-print-function ${FUNCNAME} "$@"
- local f
-
- for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
- # drop leading slash if it's there
- f=${f#/}
-
- if [[ ${f} != usr/include/* ]]; then
- die "Wrapping headers outside of /usr/include is not supported at the moment."
- fi
- # and then usr/include
- f=${f#usr/include}
-
- local dir=${f%/*}
-
- # $CHOST shall be set by multilib_toolchain_setup
- dodir "/tmp/multilib-include/${CHOST}${dir}"
- mv "${ED}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
-
- if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
- dodir "/tmp/multilib-include${dir}"
- # a generic template
- cat > "${ED}/tmp/multilib-include${f}" <<_EOF_ || die
-/* This file is auto-generated by autotools-multilib.eclass
- * as a multilib-friendly wrapper. For the original content,
- * please see the files that are #included below.
- */
-
-#if defined(__x86_64__) /* amd64 */
-# if defined(__ILP32__) /* x32 ABI */
-# error "abi_x86_x32 not supported by the package."
-# else /* 64-bit ABI */
-# error "abi_x86_64 not supported by the package."
-# endif
-#elif defined(__i386__) /* plain x86 */
-# error "abi_x86_32 not supported by the package."
-#else
-# error "No ABI matched, please report a bug to bugs.gentoo.org"
-#endif
-_EOF_
- fi
-
- # XXX: get abi_* directly
- local abi_flag
- case "${ABI}" in
- amd64)
- abi_flag=abi_x86_64;;
- x86)
- abi_flag=abi_x86_32;;
- x32)
- abi_flag=abi_x86_x32;;
- *)
- die "Header wrapping for ${ABI} not supported yet";;
- esac
-
- # Note: match a space afterwards to avoid collision potential.
- sed -e "/${abi_flag} /s&error.*&include <${CHOST}/${f}>&" \
- -i "${ED}/tmp/multilib-include${f}" || die
- done
-}
-
autotools-multilib_src_install() {
autotools-multilib_secure_install() {
autotools-utils_src_install "${@}"
- _autotools-multilib_wrap_headers
+ multilib_prepare_wrappers
# Make sure all headers are the same for each ABI.
multilib_check_headers
}
multilib_foreach_abi autotools-multilib_secure_install "${@}"
- # merge the wrapped headers
- if [[ -d "${ED}"/tmp/multilib-include ]]; then
- multibuild_merge_root \
- "${ED}"/tmp/multilib-include "${ED}"/usr/include
- # it can fail if something else uses /tmp
- rmdir "${ED}"/tmp &>/dev/null
- fi
+ # merge the wrappers
+ multilib_install_wrappers
}
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index dbaed70ad773..5e8cb54344bc 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.10 2013/03/09 13:52:05 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.11 2013/04/07 16:56:14 mgorny Exp $
# @ECLASS: multilib-build.eclass
# @MAINTAINER:
@@ -204,5 +204,139 @@ multilib_copy_sources() {
multibuild_copy_sources
}
+# @ECLASS-VARIABLE: MULTILIB_WRAPPED_HEADERS
+# @DESCRIPTION:
+# A list of headers to wrap for multilib support. The listed headers
+# will be moved to a non-standard location and replaced with a file
+# including them conditionally to current ABI.
+#
+# This variable has to be a bash array. Paths shall be relative to
+# installation root (${ED}), and name regular files. Recursive wrapping
+# is not supported.
+#
+# Please note that header wrapping is *discouraged*. It is preferred to
+# install all headers in a subdirectory of libdir and use pkg-config to
+# locate the headers. Some C preprocessors will not work with wrapped
+# headers.
+#
+# Example:
+# @CODE
+# MULTILIB_WRAPPED_HEADERS=(
+# /usr/include/foobar/config.h
+# )
+# @CODE
+
+# @FUNCTION: multilib_prepare_wrappers
+# @USAGE: [<install-root>]
+# @DESCRIPTION:
+# Perform the preparation of all kinds of wrappers for the current ABI.
+# This function shall be called once per each ABI, after installing
+# the files to be wrapped.
+#
+# Takes an optional custom <install-root> from which files will be
+# used. If no root is specified, uses ${ED}.
+#
+# The files to be wrapped are specified using separate variables,
+# e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
+# between the successive calls to multilib_prepare_wrappers
+# and multilib_install_wrappers.
+#
+# After all wrappers are prepared, multilib_install_wrappers shall
+# be called to commit them to the installation tree.
+multilib_prepare_wrappers() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
+
+ local root=${1:-${ED}}
+ local f
+
+ for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
+ # drop leading slash if it's there
+ f=${f#/}
+
+ if [[ ${f} != usr/include/* ]]; then
+ die "Wrapping headers outside of /usr/include is not supported at the moment."
+ fi
+ # and then usr/include
+ f=${f#usr/include}
+
+ local dir=${f%/*}
+
+ # $CHOST shall be set by multilib_toolchain_setup
+ dodir "/tmp/multilib-include/${CHOST}${dir}"
+ mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
+
+ if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
+ dodir "/tmp/multilib-include${dir}"
+ # a generic template
+ cat > "${ED}/tmp/multilib-include${f}" <<_EOF_ || die
+/* This file is auto-generated by multilib-build.eclass
+ * as a multilib-friendly wrapper. For the original content,
+ * please see the files that are #included below.
+ */
+
+#if defined(__x86_64__) /* amd64 */
+# if defined(__ILP32__) /* x32 ABI */
+# error "abi_x86_x32 not supported by the package."
+# else /* 64-bit ABI */
+# error "abi_x86_64 not supported by the package."
+# endif
+#elif defined(__i386__) /* plain x86 */
+# error "abi_x86_32 not supported by the package."
+#else
+# error "No ABI matched, please report a bug to bugs.gentoo.org"
+#endif
+_EOF_
+ fi
+
+ # XXX: get abi_* directly
+ local abi_flag
+ case "${ABI}" in
+ amd64)
+ abi_flag=abi_x86_64;;
+ x86)
+ abi_flag=abi_x86_32;;
+ x32)
+ abi_flag=abi_x86_x32;;
+ *)
+ die "Header wrapping for ${ABI} not supported yet";;
+ esac
+
+ # Note: match a space afterwards to avoid collision potential.
+ sed -e "/${abi_flag} /s&error.*&include <${CHOST}/${f}>&" \
+ -i "${ED}/tmp/multilib-include${f}" || die
+ done
+}
+
+# @FUNCTION: multilib_install_wrappers
+# @USAGE: [<install-root>]
+# @DESCRIPTION:
+# Install the previously-prepared wrappers. This function shall
+# be called once, after all wrappers were prepared.
+#
+# Takes an optional custom <install-root> to which the wrappers will be
+# installed. If no root is specified, uses ${ED}. There is no need to
+# use the same root as when preparing the wrappers.
+#
+# The files to be wrapped are specified using separate variables,
+# e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
+# between the calls to multilib_prepare_wrappers
+# and multilib_install_wrappers.
+multilib_install_wrappers() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
+
+ local root=${1:-${ED}}
+
+ if [[ -d "${ED}"/tmp/multilib-include ]]; then
+ multibuild_merge_root \
+ "${ED}"/tmp/multilib-include "${root}"/usr/include
+ # it can fail if something else uses /tmp
+ rmdir "${ED}"/tmp &>/dev/null
+ fi
+}
+
_MULTILIB_BUILD=1
fi
diff --git a/eclass/multilib-minimal.eclass b/eclass/multilib-minimal.eclass
index 070425f1e959..0a5aab9b197f 100644
--- a/eclass/multilib-minimal.eclass
+++ b/eclass/multilib-minimal.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-minimal.eclass,v 1.1 2013/03/09 20:33:29 hasufell Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-minimal.eclass,v 1.2 2013/04/07 16:56:14 mgorny Exp $
# @ECLASS: multilib-minimal.eclass
# @MAINTAINER:
@@ -86,10 +86,12 @@ multilib-minimal_src_install() {
else
default_src_install
fi
+ multilib_prepare_wrappers
multilib_check_headers
popd >/dev/null || die
}
multilib_foreach_abi multilib-minimal_abi_src_install
+ multilib_install_wrappers
if declare -f multilib_src_install_all >/dev/null ; then
multilib_src_install_all