The new function can be used to create per-variant copies of source
trees. Code based on python_copy_sources from python-r1.
---
 gx86/eclass/multibuild.eclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gx86/eclass/multibuild.eclass b/gx86/eclass/multibuild.eclass
index 8ccd3b6..65f3926 100644
--- a/gx86/eclass/multibuild.eclass
+++ b/gx86/eclass/multibuild.eclass
@@ -205,6 +205,27 @@ multibuild_for_best_variant() {
        multibuild_foreach_variant "${@}"
 }
 
+# @FUNCTION: multibuild_copy_sources
+# @DESCRIPTION:
+# Create per-variant copies of source tree. The source tree is assumed
+# to be in ${BUILD_DIR}, or ${S} if the former is unset. The copies will
+# be placed in directories matching BUILD_DIRs used by
+# multibuild_foreach().
+multibuild_copy_sources() {
+       debug-print-function ${FUNCNAME} "${@}"
+
+       local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}}
+
+       einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}"
+
+       _multibuild_create_source_copy() {
+               einfo "${impl}: copying to ${BUILD_DIR}"
+               cp -pr "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
+       }
+
+       multibuild_foreach_variant _multibuild_create_source_copy
+}
+
 # @FUNCTION: run_in_build_dir
 # @USAGE: <argv>...
 # @DESCRIPTION:
-- 
1.8.1.5


Reply via email to