diff options
author | 2014-01-19 11:38:32 -0800 | |
---|---|---|
committer | 2014-01-19 11:38:32 -0800 | |
commit | 1afa7928beb882477b9b28e60efccc291c52220f (patch) | |
tree | 1fe970ddac7b5dea0ebc4bc28db4cc36a42b21a4 /eclass | |
parent | media-libs/taglib: clone upstream (diff) | |
download | gmt-1afa7928beb882477b9b28e60efccc291c52220f.tar.gz gmt-1afa7928beb882477b9b28e60efccc291c52220f.tar.bz2 gmt-1afa7928beb882477b9b28e60efccc291c52220f.zip |
eclass/cmake-multilib: support in-source multilib building
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/cmake-multilib.eclass | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass index 8e74784..36efdd0 100644 --- a/eclass/cmake-multilib.eclass +++ b/eclass/cmake-multilib.eclass @@ -4,7 +4,7 @@ # @ECLASS: cmake-multilib.eclass # @MAINTAINER: -# Michał Górny <mgorny@gentoo.org> +# none # @BLURB: cmake-utils wrapper for multilib builds # @DESCRIPTION: # The cmake-multilib.eclass is a cmake-utils.eclass(5) wrapper @@ -13,24 +13,43 @@ # Inheriting this eclass sets IUSE and exports cmake-utils phase # function wrappers which build the package for each supported ABI # if the appropriate flag is enabled. -# -# Note that the multilib support requires out-of-source builds to be -# enabled. Thus, it is impossible to use CMAKE_IN_SOURCE_BUILD with -# it. # EAPI=4 is required for meaningful MULTILIB_USEDEP. case ${EAPI:-0} in - 4|5|4-*|5-*) ;; + 4|5) ;; *) die "EAPI=${EAPI} is not supported" ;; esac -if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then - die "${ECLASS}: multilib support requires out-of-source builds." -fi - inherit my-god-its-full-of-quotation-marks ehooker cmake-utils multilib-build -EXPORT_FUNCTIONS src_configure src_compile src_test src_install +EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install + +cmake-multilib_src_prepare() { + debug-print-function "${FUNCNAME}" "$(mg-qm "$@")" + cmake-utils_src_prepare "$@" + [[ ${CMAKE_IN_SOURCE_BUILD} ]] && multilib_copy_sources +} + +_cmake-multilib_munge_build_dir() { + debug-print-function ${FUNCNAME} "$(mg-qm "$@")" + + debug-print "${FUNCNAME} unmunged: S=\"${S}\" BUILD_DIR=\"${BUILD_DIR}\" ECONF_SOURCE=\"${ECONF_SOURCE}\" CMAKE_USE_DIR=\"${CMAKE_USE_DIR}\" (CMAKE_IN_SOURCE_BUILD=\"${CMAKE_IN_SOURCE_BUILD}\")" + # Forgetting munged variables after each ABI is processed + local S="${S}" + local BUILD_DIR="${BUILD_DIR}" + local ECONF_SOURCE="${ECONF_SOURCE}" + local CMAKE_USE_DIR="${CMAKE_USE_DIR}" + + if [[ ${CMAKE_IN_SOURCE_BUILD} ]] ; then + CMAKE_USE_DIR="${CMAKE_USE_DIR:-${BUILD_DIR}}" + # it's debatable if we should change S here. But I think doing so leads to a more intuitive + # result. Certainly, it'd allow more code to work unmodified, when porting non-multibuild ebuilds + S="${CMAKE_USE_DIR}" + fi + debug-print "${FUNCNAME} result: S=\"${S}\" BUILD_DIR=\"${BUILD_DIR}\" ECONF_SOURCE=\"${ECONF_SOURCE}\" CMAKE_USE_DIR=\"${CMAKE_USE_DIR}\" (CMAKE_IN_SOURCE_BUILD=\"${CMAKE_IN_SOURCE_BUILD}\")" + + "$@" +} cmake-multilib_src_configure() { debug-print-function "${FUNCNAME}" "$(mg-qm "$@")" @@ -44,7 +63,8 @@ cmake-multilib_src_configure() { if ehook_fire cmake-multilib-pre_src_configure ; then debug-print "${FUNCNAME} (post-pre-hook): mycmakeargs=($(mg-qm "${mycmakeargs[@]}"))" debug-print "${FUNCNAME} (post-pre-hook): morecmakeargs=($(mg-qm "${morecmakeargs[@]}"))" - cmake-utils_src_configure "${morecmakeargs[@]}" + _cmake-multilib_munge_build_dir \ + cmake-utils_src_configure "${morecmakeargs[@]}" fi ehook_fire cmake-multilib-post_src_configure -u } @@ -61,7 +81,8 @@ cmake-multilib_src_compile() { debug-print "${FUNCNAME} (pre-pre-hook): cmake_compile_args=($(mg-qm "${cmake_compile_args[@]}"))" if ehook_fire cmake-multilib-pre_src_compile ; then debug-print "${FUNCNAME} (post-pre-hook): cmake_compile_args=($(mg-qm "${cmake_compile_args[@]}"))" - cmake-utils_src_compile "${cmake_compile_args[@]}" + _cmake-multilib_munge_build_dir \ + cmake-utils_src_compile "${cmake_compile_args[@]}" fi ehook_fire cmake-multilib-post_src_compile -u } @@ -78,7 +99,8 @@ cmake-multilib_src_test() { debug-print "${FUNCNAME} (pre-pre-hook): cmake_test_args=($(mg-qm "${cmake_test_args[@]}"))" if ehook_fire cmake-multilib-pre_src_test ; then debug-print "${FUNCNAME} (post-pre-hook): cmake_test_args=($(mg-qm "${cmake_test_args[@]}"))" - cmake-utils_src_test "${cmake_test_args[@]}" + _cmake-multilib_munge_build_dir \ + cmake-utils_src_test "${cmake_test_args[@]}" fi ehook_fire cmake-multilib-post_src_test -u } @@ -95,7 +117,8 @@ cmake-multilib_src_install() { debug-print "${FUNCNAME} (pre-pre-hook): cmake_install_args=($(mg-qm "${cmake_install_args[@]}"))" if ehook_fire cmake-multilib-pre_src_install ; then debug-print "${FUNCNAME} (post-pre-hook): cmake_install_args=($(mg-qm "${cmake_install_args[@]}"))" - cmake-utils_src_install "${cmake_install_args[@]}" + _cmake-multilib_munge_build_dir \ + cmake-utils_src_install "${cmake_install_args[@]}" fi ehook_fire cmake-multilib-post_src_install -u |