# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: gst-plugins10-multilib.eclass # @MAINTAINER: # gstreamer@gentoo.org # @AUTHOR: # Greg Turner # @BLURB: Manages build for invididual ebuild for gst-plugins. # @DESCRIPTION: # Eclass to make external gst-plugins emergable on a per-plugin basis and # to solve the problem with gst-plugins generating far too much unneeded # dependancies. # # GStreamer consuming applications should depend on the specific plugins they # need as defined in their source code. # # In case of spider usage, obtain recommended plugins to use from Gentoo # developers responsible for gstreamer or the application # developer. ___GST_PLUGINS10_MULTILIB_IN_USE=1 inherit eutils ehooker my-god-its-full-of-quotation-marks multilib \ toolchain-funcs versionator gst-plugins10 multilib-build # @ECLASS-VARIABLE: MULTILIB_INSECURE_INSTALL # @DEFAULT-UNSET # @DESCRIPTION: # If set to a nonempty value, multilib-minimal_src_install will not perform # automatic checking of headers for inter-ABI conflicts, nor will it automate # wrapping of header files. Instead, multilib_src_install pseudophases will # run without any special protection and the MULTILIB_WRAPPED_HEADERS array # will be ignored. # See: # @CODE@ # http://devmanual.gentoo.org/eclass-reference/multilib-build.eclass/index.html # @CODE@ # (or the multilib-build.eclass source itself) for further information about this # feature. case "${EAPI:-0}" in 4|5) :; ;; *) die "EAPI=\"${EAPI:-0}\" is not supported" ;; esac [[ ${___GST_PLUGINS_MULTILIB_IN_USE} ]] && \ die "gst-plugins10-multilib is not compatible with gst-plugins-multilib" EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install RDEPEND=" >=dev-libs/glib-2.6:2[${MULTILIB_USEDEP}] media-libs/gstreamer:${SLOT}[${MULTILIB_USEDEP}] " if [[ ${PN} != ${GST_ORG_MODULE} ]]; then # Do not run test phase for invididual plugin ebuilds. RESTRICT="test" RDEPEND="${RDEPEND} >=media-libs/${GST_ORG_MODULE}-${PV}:${SLOT}[${MULTILIB_USEDEP}]" else IUSE="nls" DEPEND="${DEPEND} nls? ( >=sys-devel/gettext-0.17[${MULTILIB_USEDEP}] )" fi DEPEND="${DEPEND} ${RDEPEND}" # @FUNCTION: gst-plugins10-multilib_find_plugin_dir # @USAGE: gst-plugins10-multilib_find_plugin_dir [] # @INTERNAL # @DESCRIPTION: # Finds plugin build directory and cd to it. # Defaults to ${GST_PLUGINS_BUILD_DIR} if argument is not provided # Overridden version of gst-plugins10 implementation for multilib compat. gst-plugins10-multilib_find_plugin_dir() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" debug-print "${FUNCNAME}: BUILD_DIR=\"${BUILD_DIR}\"" debug-print "${FUNCNAME}: S=\"${S}\"" debug-print "${FUNCNAME}: PWD=\"$(pwd)\"" local build_dir=${1:-${GST_PLUGINS_BUILD_DIR}} debug-print "${FUNCNAME}: about to search for plugin build_dir=\"${build_dir}\"" local possible_dir for possible_dir in "${BUILD_DIR}/ext" "${BUILD_DIR}/sys" "${S}/ext" "${S}/sys" "$(pwd -L)/ext" "$(pwd -L)/sys" ; do debug-print "${FUNCNAME}: testing candidiate plugin dir \"${possible_dir}/${build_dir}\"" if [[ -d "${possible_dir}/${build_dir}" ]] ; then debug-print "${FUNCNAME}: found \"${possible_dir}/${build_dir}\" directory -- we have a wiener!" if [[ ${possible_dir} == *ext ]] ; then einfo "Found external plugin directory \"${build_dir}\"." else einfo "Found system plugin directory \"${build_dir}\"." fi cd "${possible_dir}/${build_dir}" return 0 else debug-print "${FUNCNAME}: \"${possible_dir}/${build_dir}\" DNE or not a directory..." fi done debug-print "${FUNCNAME}: no candidate directories contained the modules we were looking for. Giving up the ghost." die "Can't find \"${build_dir}\" plugin dir; unable to proceed." } gst-plugins10_find_plugin_dir() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" debug-print "${FUNCNAME}: (override): redirecting to gst-plugins10-multilib_find_plugin_dir..." gst-plugins10-multilib_find_plugin_dir "$@" } # @FUNCTION: gst-plugins10-multilib_system_link # @USAGE: gst-plugins10-multilib_system_link gst-libs/gst/audio:gstreamer-audio [...] # @DESCRIPTION: # Walks through makefiles in order to make sure build will link against system # librairies. # Takes a list of path fragments and corresponding pkgconfig libraries # separated by colon (:). Will replace the path fragment by the output of # pkgconfig. Overridden version of gst-plugins10 implementation. gst-plugins10-multilib_system_link() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" local directory libs pkgconfig pc tuple pkgconfig=${PKG_CONFIG:-$(tc-getPKG_CONFIG)} for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do gst-plugins10-multilib_find_plugin_dir ${plugin_dir} for tuple in $@ ; do directory="$(echo ${tuple} | cut -f1 -d':')" pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}" libs="$(${pkgconfig} --libs-only-l ${pc})" sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \ -i Makefile.am Makefile.in || die done done } gst-plugins10_system_link() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" debug-print "${FUNCNAME}: (overridE): redirecting to gst-plugins10-multilib_system_link..." gst-plugins10-multilib_system_link "$@" } _gst-plugins10-multilib_wrap_prepare() { debug-print-function ${FUNCNAME} "$@" einfo "Preparing sources for ABI ${ABI} ..." declare -a prepare_args=( "${prepare_args[@]}" ) ehook_fire gst-plugins10-multilib-per-abi-pre_src_prepare && \ default_src_prepare ehook_fire gst-plugins10-multilib-per-abi-post_src_prepare -u } # @FUNCTION: gst-plugins10-multilib_src_prepare # @DESCRIPTION: # Clones the sources for in-tree building due to # unsafe prepare hacks in gst-plugins10 eclass gst-plugins10-multilib_src_prepare() { debug-print-function ${FUNCNAME} "$@" declare -a prepare_args=( "$@" ) if ehook_fire gst-plugins10-multilib-global-pre_src_prepare ; then multilib_copy_sources multilib_parallel_foreach_abi multilib-build_run_in_build_dir \ _gst-plugins10-multilib_wrap_prepare fi ehook_fire gst-plugins10-multilib-global-post_src_prepare -u } _gst-plugins10-multilib_wrap_configure() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" einfo "Configuring for ABI ${ABI} ..." declare -a configure_args=( "${configure_args[@]}" ) ehook_fire gst-plugins10-multilib-per-abi-pre_src_configure && \ gst-plugins10_src_configure "${configure_args[@]}" ehook_fire gst-plugins10-multilib-per-abi-post_src_configure -u } # @FUNCTION: gst-plugins10-multilib_src_configure # @DESCRIPTION: # Handles logic common to configuring gstreamer plugins gst-plugins10-multilib_src_configure() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" declare -a configure_args=( "$@" ) ehook_fire gst-plugins10-multilib-global-pre_src_configure && \ multilib_parallel_foreach_abi multilib-build_run_in_build_dir \ _gst-plugins10-multilib_wrap_configure ehook_fire gst-plugins10-multilib-global-post_src_configure -u } _gst-plugins10-multilib_wrap_compile() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" einfo "Compiling ABI ${ABI}" declare -a compile_args=( "${compile_args[@]}" ) ehook_fire gst-plugins10-multilib-per-abi-pre_src_compile && \ gst-plugins10_src_compile "${compile_args[@]}" ehook_fire gst-plugins10-multilib-per-abi-post_src_compile -u } # @FUNCTION: gst-plugins10-multilib_src_compile # @DESCRIPTION: # Compiles requested gstreamer plugin. gst-plugins10-multilib_src_compile() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" declare -a compile_args=( "$@" ) ehook_fire gst-plugins10-multilib-global-pre_src_compile && \ multilib_foreach_abi multilib-build_run_in_build_dir \ _gst-plugins10-multilib_wrap_compile ehook_fire gst-plugins10-multilib-global-post_src_compile -u } _gst-plugins10-multilib_wrap_test() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" einfo "Compiling ABI ${ABI}" declare -a test_args=( "${test_args[@]}" ) ehook_fire gst-plugins10-multilib-per-abi-pre_src_test && \ default_src_test "${test_args[@]}" ehook_fire gst-plugins10-multilib-per-abi-post_src_test -u } # @FUNCTION: gst-plugins10-multilib_src_test # @DESCRIPTION: # Compiles requested gstreamer plugin. gst-plugins10-multilib_src_test() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" declare -a test_args=( "$@" ) ehook_fire gst-plugins10-multilib-global-pre_src_test && \ multilib_foreach_abi multilib-build_run_in_build_dir \ _gst-plugins10-multilib_wrap_test ehook_fire gst-plugins10-multilib-global-post_src_test -u } _gst-plugins10-multilib_wrap_install() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" einfo "Compiling ABI ${ABI}" declare -a install_args=( "${install_args[@]}" ) ehook_fire gst-plugins10-multilib-per-abi-pre_src_install && \ gst-plugins10_src_install "${install_args[@]}" # Do multilib magic only when >1 ABI is used and # MULTILIB_INSECURE_INSTALL is not set if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 && \ -z ${MULTILIB_INSECURE_INSTALL} ]]; then multilib_prepare_wrappers multilib_check_headers fi ehook_fire gst-plugins10-multilib-per-abi-post_src_install -u } # @FUNCTION: gst-plugins10_src_install # @DESCRIPTION: # Installs requested gstreamer plugin. gst-plugins10-multilib_src_install() { debug-print-function ${FUNCNAME} "$(mg-qm "$@")" declare -a install_args=( "$@" ) if ehook_fire gst-plugins10-multilib-global-pre_src_install ; then multilib_foreach_abi multilib-build_run_in_build_dir \ _gst-plugins10-multilib_wrap_install fi [[ ${MULTILIB_INSECURE_INSTALL} ]] || multilib_install_wrappers ehook_fire gst-plugins10-multilib-global-post_src_install -u }