aboutsummaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2014-06-12 15:23:09 -0700
committerGregory M. Tuner <gmt@be-evil.net>2014-06-12 15:23:09 -0700
commit7986c3523496b28334e4fd9a571a375834bf85af (patch)
treebd0426e4ade6875d73cb7781b5370323285978ad /eclass
parenteclass/autotools-multilib: drop pointless redundant inheritance (diff)
downloadgmt-7986c3523496b28334e4fd9a571a375834bf85af.tar.gz
gmt-7986c3523496b28334e4fd9a571a375834bf85af.tar.bz2
gmt-7986c3523496b28334e4fd9a571a375834bf85af.zip
eclass/cmake-multilib: migrate to upstream-style multilib-minimal basis
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cmake-multilib.eclass227
-rw-r--r--eclass/mysql-cmake-multilib.eclass17
2 files changed, 158 insertions, 86 deletions
diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass
index bdc5247..65f314a 100644
--- a/eclass/cmake-multilib.eclass
+++ b/eclass/cmake-multilib.eclass
@@ -9,126 +9,191 @@
# Author: Michał Górny <mgorny@gentoo.org>
# @BLURB: cmake-utils wrapper for multilib builds
# @DESCRIPTION:
-# The cmake-multilib.eclass is a cmake-utils.eclass(5) wrapper
-# introducing support for building for more than one ABI (multilib).
+# The cmake-multilib.eclass provides a glue between cmake-utils.eclass(5)
+# and multilib-minimal.eclass(5), aiming to provide a convenient way
+# to build packages using cmake for multiple ABIs.
#
-# 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.
+# Inheriting this eclass sets IUSE and exports default multilib_src_*()
+# sub-phases that call cmake-utils phase functions for each ABI enabled.
+# The multilib_src_*() functions can be defined in ebuild just like
+# in multilib-minimal, yet they ought to call appropriate cmake-utils
+# phase rather than 'default'.
-# EAPI=4 is required for meaningful MULTILIB_USEDEP.
+# EAPI=5 is required for meaningful MULTILIB_USEDEP.
case ${EAPI:-0} in
5) :;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
-inherit my-god-its-full-of-quotation-marks ehooker cmake-utils multilib-build
+inherit my-god-its-full-of-quotation-marks ehooker cmake-utils multilib-minimal ehooker
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
+
+ if ehook_fire cmake-multilib-global-pre_src_prepare; then
+ cmake-utils_src_prepare "$@"
+ [[ ${CMAKE_IN_SOURCE_BUILD} ]] && multilib_copy_sources
+ fi
+ ehook_fire cmake-multilib-global-post_src_prepare -u
}
-_cmake-multilib_munge_build_dir() {
+# this may not be neccesary but for now it's being left in as a backwards-
+# compatbility paranoia thing. Worth seeing what happens if we get rid of it
+_cmake-multilib_localize_vars() {
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
+ # Forget these variables after each phase 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}\")"
"$@"
}
+# generate ehook listeners for cmake-utils per-phase pre/post ehooks, which wrap
+# near-equivalent (but less confusingly named) cmake-multilib e-hooks.
+_cmake-multilib_wrap_cmake_utils_phase_hooks() {
+ local phase evaltext
+ for phase in src_configure src_compile src_test src_install; do
+ read -r -d '' evaltext <<-EOF
+ _cmake-multilib-cmake-utils-pre_${phase}_wrapper() {
+ debug-print-function \${FUNCNAME} "\$(mg-qm "\$@")"
+ ehook_fire cmake-multilib-per-abi-pre_${phase}
+ local rslt=\$?
+ if [[ \${rslt} == 0 ]] ; then
+ if multilib_is_native_abi ; then
+ ehook_fire cmake-multilib-best-abi-pre_${phase}
+ rslt=\$?
+ fi
+ fi
+ [[ \$rslt == 0 ]] && _CMAKE_MULTILIB_PHASE=${phase} ehook_fire cmake-multilib-internal-per-abi_postproc -u
+ return \$rslt
+ }
+ _cmake-multilib-cmake-utils-post_${phase}_wrapper() {
+ debug-print-function \${FUNCNAME} "\$(mg-qm "\$@")"
+ ehook_fire cmake-multilib-per-abi-post_${phase} -u
+ if multilib_is_native_abi ; then
+ ehook_fire cmake-multilib-best-abi-post_${phase} -u
+ fi
+ }
+ EOF
+ eval "${evaltext}"
+ done
+ _CMAKE_MULTILIB_CMAKE_UTILS_HOOKS_WRAPPED=yes
+}
+
+[[ ${_CMAKE_MULTILIB_CMAKE_UTILS_HOOKS_WRAPPED} ]] || \
+ _cmake-multilib_wrap_cmake_utils_phase_hooks
+
+# do @GET_LIBDIR@ substitution in each of the named arrays
+_cmake-multilib_libdir_subst() {
+ local _array _array_reference _item
+ for _array in "$@"; do
+ local _new_array=()
+ _array_reference="${_array}[@]"
+ for _item in "${!_array_reference}"; do
+ _new_array+=("${_item//@GET_LIBDIR@/$(get_libdir)}")
+ done
+ eval "${_array}=(\"\${_new_array[@]}\")"
+ done
+}
+
+ehook cmake-multilib-internal-per-abi_postproc _cmake-multilib_abi_postproc
+# munge @GET_LIBDIR@ arguments flowing into phase actions as appropriate
+_cmake-multilib_abi_postproc() {
+ case ${_CMAKE_MULTILIB_PHASE} in
+ src_configure) _cmake-multilib_libdir_subst mycmakeargs ;;
+ src_compile) _cmake-multilib_libdir_subst myninjamakeargs mycmakemakeargs;;
+ src_test) _cmake-multilib_libdir_subst myctestargs ;;
+ src_install) _cmake-multilib_libdir_subst mycmakeinstallargs ;;
+ *) die "Don't know what to do about phase \"${_CMAKE_MULTILIB_PHASE}\"" ;;
+ esac
+}
+
+multilib_src_configure() {
+ debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
+ [[ ${CMAKE_MULTILIB_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR}
+
+ ehook cmake-utils-pre_src_configure _cmake-multilib-cmake-utils-pre_src_configure_wrapper
+ ehook cmake-utils-post_src_configure _cmake-multilib-cmake-utils-post_src_configure_wrapper
+ _cmake-multilib_localize_vars cmake-utils_src_configure "${_cm_args[@]}"
+ eunhook cmake-utils-pre_src_configure _cmake-multilib-cmake-utils-pre_src_configure_wrapper
+ eunhook cmake-utils-post_src_configure _cmake-multilib-cmake-utils-post_src_configure_wrapper
+}
+
cmake-multilib_src_configure() {
+ debug-print-function ${FUNCNAME} "$(mg-qm "$@")"
+
+ local _cm_args=( "$@" )
+ ehook_fire cmake-multilib-global-pre_src_configure && \
+ multilib-minimal_src_configure
+ ehook_fire cmake-multilib-global-post_src_configure -u
+}
+
+multilib_src_compile() {
debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- _cmake-multilib_src_configure_wrapper() {
- debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- declare -a mycmakeargs=("${mycmakeargs[@]}")
- declare -a morecmakeargs=("$@")
- debug-print "${FUNCNAME} (pre-pre-hook): mycmakeargs=($(mg-qm "${mycmakeargs[@]}"))"
- debug-print "${FUNCNAME} (pre-pre-hook): morecmakeargs=($(mg-qm "${morecmakeargs[@]}"))"
- 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-multilib_munge_build_dir \
- cmake-utils_src_configure "${morecmakeargs[@]}"
- fi
- ehook_fire cmake-multilib-post_src_configure -u
- }
-
- multilib_parallel_foreach_abi _cmake-multilib_src_configure_wrapper "${@}"
+ ehook cmake-utils-pre_src_compile _cmake-multilib-cmake-utils-pre_src_compile_wrapper
+ ehook cmake-utils-post_src_compile _cmake-multilib-cmake-utils-post_src_compile_wrapper
+ _cmake-multilib_localize_vars cmake-utils_src_compile "${_cm_args[@]}"
+ eunhook cmake-utils-pre_src_compile _cmake-multilib-cmake-utils-pre_src_compile_wrapper
+ eunhook cmake-utils-post_src_compile _cmake-multilib-cmake-utils-post_src_compile_wrapper
}
cmake-multilib_src_compile() {
+ debug-print-function ${FUNCNAME} "$(mg-qm "$@")"
+
+ local _cm_args=( "$@" )
+ ehook_fire cmake-multilib-global-pre_src_compile && \
+ multilib-minimal_src_compile
+ ehook_fire cmake-multilib-global-post_src_compile -u
+}
+
+multilib_src_test() {
debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- _cmake-multilib_src_compile_wrapper() {
- debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- declare -a cmake_compile_args=("$@")
- 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-multilib_munge_build_dir \
- cmake-utils_src_compile "${cmake_compile_args[@]}"
- fi
- ehook_fire cmake-multilib-post_src_compile -u
- }
-
- multilib_foreach_abi _cmake-multilib_src_compile_wrapper "${@}"
+ ehook cmake-utils-pre_src_test _cmake-multilib-cmake-utils-pre_src_test_wrapper
+ ehook cmake-utils-post_src_test _cmake-multilib-cmake-utils-post_src_test_wrapper
+ _cmake-multilib_localize_vars cmake-utils_src_test "${_cm_args[@]}"
+ eunhook cmake-utils-pre_src_test _cmake-multilib-cmake-utils-pre_src_test_wrapper
+ eunhook cmake-utils-post_src_test _cmake-multilib-cmake-utils-post_src_test_wrapper
}
cmake-multilib_src_test() {
+ debug-print-function ${FUNCNAME} "$(mg-qm "$@")"
+
+ local _cm_args=( "$@" )
+ ehook_fire cmake-multilib-global-pre_src_test && \
+ multilib-minimal_src_test
+ ehook_fire cmake-multilib-global-post_src_test -u
+}
+
+multilib_src_install() {
debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- _cmake-multilib_src_test_wrapper() {
- debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- declare -a cmake_test_args=("$@")
- 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-multilib_munge_build_dir \
- cmake-utils_src_test "${cmake_test_args[@]}"
- fi
- ehook_fire cmake-multilib-post_src_test -u
- }
-
- multilib_foreach_abi _cmake-multilib_src_test_wrapper "${@}"
+ # override some variables that cmake-utils might attempt to process, but
+ # for which we have alternate processing in multilib_src_install_all. This
+ # prevents pointless repeat-installation of nongenerated documentation.
+ local DOCS=() HTML_DOCS=()
+ ehook cmake-utils-pre_src_install _cmake-multilib-cmake-utils-pre_src_install_wrapper
+ ehook cmake-utils-post_src_install _cmake-multilib-cmake-utils-post_src_install_wrapper
+ _cmake-multilib_localize_vars cmake-utils_src_install "${_cm_args[@]}"
+ eunhook cmake-utils-pre_src_install _cmake-multilib-cmake-utils-pre_src_install_wrapper
+ eunhook cmake-utils-post_src_install _cmake-multilib-cmake-utils-post_src_install_wrapper
+}
+
+multilib_src_install_all() {
+ debug-print-function ${FUNCNAME} "$(mg-qm "$@")"
+ einstalldocs
}
cmake-multilib_src_install() {
debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- cmake-multilib_secure_install() {
- debug-print-function "${FUNCNAME}" "$(mg-qm "$@")"
- declare -a cmake_install_args=("$@")
- 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-multilib_munge_build_dir \
- cmake-utils_src_install "${cmake_install_args[@]}"
- fi
- ehook_fire cmake-multilib-post_src_install -u
-
- # Make sure all headers are the same for each ABI.
- multilib_prepare_wrappers
- multilib_check_headers
- }
-
- multilib_foreach_abi cmake-multilib_secure_install "${@}"
- multilib_install_wrappers
+ local _cm_args=( "$@" )
+ ehook_fire cmake-multilib-global-pre_src_install && \
+ multilib-minimal_src_install
+ ehook_fire cmake-multilib-global-post_src_install -u
}
diff --git a/eclass/mysql-cmake-multilib.eclass b/eclass/mysql-cmake-multilib.eclass
index 4ed1e56..cd68066 100644
--- a/eclass/mysql-cmake-multilib.eclass
+++ b/eclass/mysql-cmake-multilib.eclass
@@ -18,6 +18,13 @@
inherit flag-o-matic multilib prefix eutils mysql-cmake cmake-multilib
+# FIXME
+# systemtap is currently broken for multilib targets, so don't allow
+# multiple abi's to be selected if that use-flag is on :(
+__SHITTY_HACK=( ${MULTILIB_USEDEP//(-)\?/ } )
+REQUIRED_USE="systemtap? ( ?? ( "${__SHITTY_HACK[@]#,}" ) )"
+unset __SHITTY_HACK
+
#
# HELPER FUNCTIONS:
#
@@ -54,7 +61,7 @@ configure_cmake_minimal() {
-DWITHOUT_PARTITION_STORAGE_ENGINE=1
-DWITHOUT_INNOBASE_STORAGE_ENGINE=1
-DWITH_UNIT_TESTS=0
- -DENABLE_DTRACE=0
+ -DENABLE_DTRACE=OFF
)
}
@@ -74,9 +81,9 @@ configure_cmake_standard() {
$(cmake-utils_use_with debug)
$(cmake-utils_use_with embedded EMBEDDED_SERVER)
$(cmake-utils_use_with profiling)
- $(cmake-utils_use_enable systemtap DTRACE)
$(cmake-utils_use_with test UNIT_TESTS)
$(cmake-utils_use_enable static-libs STATIC_LIBS)
+ -DENABLE_DTRACE=$(usex systemtap ON OFF)
)
if use static; then
@@ -261,7 +268,7 @@ mysql-cmake-multilib_src_configure() {
# bug #283926, with GCC4.4, this is required to get correct behavior.
append-flags -fno-strict-aliasing
- ehook cmake-multilib-pre_src_configure mysql_cmake_abi_pre_configure
+ ehook cmake-multilib-per-abi-pre_src_configure mysql_cmake_abi_pre_configure
cmake-multilib_src_configure
}
@@ -293,8 +300,8 @@ mysql-cmake-multilib_src_install() {
debug-print-function ${FUNCNAME} "$@"
# Make sure the vars are correctly initialized
- ehook cmake-multilib-pre_src_install mysql_init_vars
- ehook cmake-multilib-post_src_install _mysql-cmake-post-src_install_perabi
+ ehook cmake-multilib-per-abi-pre_src_install mysql_init_vars
+ ehook cmake-multilib-per-abi-post_src_install _mysql-cmake-post-src_install_perabi
cmake-multilib_src_install
# Convenience links