aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory M. Turner <gmt@be-evil.net>2013-10-09 09:48:28 -0700
committerGregory M. Turner <gmt@be-evil.net>2013-10-09 09:48:28 -0700
commit10c2d60e7a53179be01cda6379805ba4cb683cde (patch)
tree55d62bdcba0852ed75bfe7efad8ebe50595c52ca /eclass/qt4-build-multilib.eclass
parenteclass/gnome2-multilib: new eclass (diff)
downloadgmt-10c2d60e7a53179be01cda6379805ba4cb683cde.tar.gz
gmt-10c2d60e7a53179be01cda6379805ba4cb683cde.tar.bz2
gmt-10c2d60e7a53179be01cda6379805ba4cb683cde.zip
eclass/qt4-build-multilib: new eclass
Signed-off-by: Gregory M. Turner <gmt@be-evil.net>
Diffstat (limited to 'eclass/qt4-build-multilib.eclass')
-rw-r--r--eclass/qt4-build-multilib.eclass240
1 files changed, 240 insertions, 0 deletions
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
new file mode 100644
index 0000000..78f4748
--- /dev/null
+++ b/eclass/qt4-build-multilib.eclass
@@ -0,0 +1,240 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: qt4-build-multilib.eclass
+# @MAINTAINER:
+# Greg Turner <gmt@be-evil.net>
+# @BLURB: provides a multi-abi-compatible framework similar to qt4-build.eclass
+# @DESCRIPTION:
+# This eclass wraps the qt4-build.eclass phase functions, providing
+# a quick(-ish) migration path for ebuilds based on qt4-build.eclass to
+# support multi-ABI profiles.
+
+case ${EAPI} in
+ 4|5) : ;;
+ *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
+esac
+
+inherit qt4-build multilib-build ehooker
+
+# @FUNCTION: qt4-build-multilib_pkg_setup
+# @DESCRIPTION:
+# Sets up PATH and LD_LIBRARY_PATH.
+qt4-build-multilib_pkg_setup() {
+ debug-print-function "${FUNCNAME}" "$@"
+ qt4-build_pkg_setup "$@"
+}
+
+# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space-separated list including the directories that will be extracted from
+# Qt tarball.
+
+# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Arguments for build_target_directories. Takes the directories in which the
+# code should be compiled. This is a space-separated list.
+
+# @FUNCTION: qt4-build-multilib_src_unpack
+# @DESCRIPTION:
+# Unpacks the sources.
+qt4-build-multilib_src_unpack() {
+ debug-print-function "${FUNCNAME}" "$@"
+ qt4-build_src_unpack "$@"
+}
+
+# @ECLASS-VARIABLE: PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# PATCHES array variable containing all various patches to be applied.
+# This variable is expected to be defined in global scope of ebuild.
+# Make sure to specify the full path. This variable is utilised in
+# src_prepare() phase.
+#
+# @CODE
+# PATCHES=( "${FILESDIR}/mypatch.patch"
+# "${FILESDIR}/patches_folder/" )
+# @CODE
+
+# @FUNCTION: qt4-build-multilib_src_prepare
+# @DESCRIPTION:
+# Prepare the build directories for configuration
+qt4-build-multilib_src_prepare() {
+ debug-print-function "${FUNCNAME}" "$@"
+
+ # unfortunately, qt4-build runs its paches much, much
+ # later after several extremely aggressive changes have
+ # been made. We'll just have to shore our patches up to
+ # work before instead of after :(
+ [[ -n ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
+ declare -a PATCHES=( )
+
+ # sadly, qt4-build simply isn't designed for out-of-tree
+ # builds, even though qt does support them according to
+ # the website. Even if it did, there are so many
+ # ABI-specific hacks injected during qt4-build_src_prepare
+ # that we would have to do both qt4-build_src_prepare and
+ # qt4-build_src_configure in the qt4-build-multilib_src_configure
+ # step to make it work. What really needs to happen is a full
+ # rewrite of qt4-build, which, I suppose, is what qt4-r2 is about.
+ #
+ # Another alternative would be to stop relying on qt4-build.
+ # That way we could create an elegant multilib qt4 framework
+ # but unfortunately, without some coordination with developers
+ # this invovles maintaining a complete fork of Gentoo's
+ # qt4 framework :(
+ #
+ # Therefore, we follow the path of least resistance and just....
+ multilib_copy_sources
+
+ debug-print "${FUNCNAME}___0: $(ls -l ${S})"
+
+ _qt4-build-multilib_src_prepare_hookwrap() {
+ local S="${BUILD_DIR}"
+ if ehook_fire qt4-build-multilib-pre_src_prepare ; then
+ debug-print "${FUNCNAME}___1${ABI}: $(ls -l ${S})"
+
+ qt4-build_src_prepare "$@"
+
+ debug-print "${FUNCNAME}___2${ABI}: $(ls -l ${S})"
+ # make sure PKG_CONFIG_{LIBDIR,PATH} go into the forced variables
+ # lest we end up pulling in all kinds of DEFAULT_ABI crap
+
+ debug-print "${FUNCNAME}: applying PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH overrides in configure"
+ sed -e "/^SYSTEM_VARIABLES=/i \
+PKG_CONFIG_LIBDIR='${EPREFIX}/usr/$(get_libdir)/pkgconfig'\n\
+PKG_CONFIG_PATH='${EPREFIX}/usr/share/pkgconfig'\n" \
+ -i configure \
+ || die "sed SYSTEM_VARIABLES failed"
+# sed -e '/^SYSTEM_VARIABLES=/s/"$/ PKG_CONFIG_LIBDIR PKG_CONFIG_PATH"/' -i configure \
+# || die "sed SYSTEM VARIABLES (part II) failed"
+ debug-print "${FUNCNAME}___3${ABI}: $(ls -l ${S})"
+ fi
+ ehook_fire qt4-build-multilib-post_src_prepare -u
+ }
+
+ multilib_parallel_foreach_abi run_in_build_dir \
+ _qt4-build-multilib_src_prepare_hookwrap "$@"
+}
+
+# @FUNCTION: qt4-build-multilib_src_configure
+# @DESCRIPTION:
+qt4-build-multilib_src_configure() {
+ debug-print-function "${FUNCNAME}" "$@"
+
+ _qt4-build-multilib_src_configure_hookwrap() {
+ debug-print-function "${FUNCNAME}" "$@"
+
+ _qt4_get_libdir_subst_myconf() {
+ local oldconfarg newconfarg newmyconf
+ for oldconfarg in ${myconf} ; do
+ newconfarg="$(get_libdir_subst "${oldconfarg}")"
+ [[ ${newconfarg} == ${oldconfarg} ]] || \
+ einfo "patched configure argument for ABI ${ABI}: \"${newconfarg}\""
+ newmyconf="${newmyconf}${newmyconf:+ }${newconfarg}"
+ done
+ myconf="${newmyconf}"
+ }
+
+ # we definitely don't want changes to "myconf" flowing
+ # down the call stack and out of
+ # qt4-build-multilib_src_configure. The fact that
+ # it doesn't is an implementation quirk
+ # of multiprocessing.eclass that we shouldn't be
+ # relying on, somebody might "fix" that (very doubtful)
+ # or it might not apply when MAKEOPTS=-j1
+ # anyhow doing this is just cleaner/safer
+ local myconf="${myconf}"
+ _qt4_get_libdir_subst_myconf
+
+ local S="${BUILD_DIR}"
+ ehook_fire qt4-build-multilib-pre_src_configure && \
+ qt4-build_src_configure "$@"
+ ehook_fire qt4-build-multilib-post_src_configure -u
+ }
+
+ multilib_parallel_foreach_abi run_in_build_dir \
+ _qt4-build-multilib_src_configure_hookwrap "$@"
+}
+
+# @FUNCTION: qt4-build-multilib_src_compile
+# @DESCRIPTION:
+# Compile the sources
+qt4-build-multilib_src_compile() {
+ debug-print-function "${FUNCNAME}" "$@"
+
+ _qt4-build-multilib_src_compile_hookwrap() {
+ debug-print-function "${FUNCNAME}" "$@"
+ local S="${BUILD_DIR}"
+ ehook_fire qt4-build-multilib-pre_src_compile && \
+ qt4-build_src_compile "$@"
+ ehook_fire qt4-build-multilib-post_src_compile -u
+ }
+
+ multilib_parallel_foreach_abi run_in_build_dir \
+ _qt4-build-multilib_src_compile_hookwrap "$@"
+}
+
+# @FUNCTION: qt4-build-multilib_src_test
+# @DESCRIPTION:
+# Run the test suite for each supported ABI
+qt4-build-multilib_src_test() {
+ debug-print-function "${FUNCNAME}" "$@"
+
+ _qt4-build-multilib_src_test_hookwrap() {
+ debug-print-function "${FUNCNAME}" "$@"
+ local S="${BUILD_DIR}"
+ ehook_fire qt4-build-multilib-pre_src_test && \
+ qt4-build_src_test "$@"
+ ehook_fire qt4-build-multilib-post_src_test -u
+ }
+
+ multilib_parallel_foreach_abi run_in_build_dir \
+ qt4-build-multilib_src_test_hookwrap "$@"
+}
+
+# @FUNCTION: qt4-build-multilib_src_install
+# @DESCRIPTION:
+# Install the compiled software
+qt4-build-multilib_src_install() {
+ debug-print-function "${FUNCNAME}" "$@"
+
+ _qt4-build-multilib_secure_install() {
+ debug-print-function "${FUNCNAME}" "$@"
+ local S="${BUILD_DIR}"
+ ehook_fire qt4-build-multilib-pre_src_install && \
+ qt4-build_src_install "${@}"
+ ehook_fire qt4-build-multilib-post_src_install -u
+ # Do multilib magic only when >1 ABI is used.
+ if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]]; then
+ multilib_prepare_wrappers
+ # Make sure all headers are the same for each ABI.
+ multilib_check_headers
+ fi
+ }
+ multilib_foreach_abi run_in_build_dir \
+ _qt4-build-multilib_secure_install "$@"
+ # merge the wrappers
+ multilib_install_wrappers
+}
+
+# @FUNCTION: qt4-build-multilib_pkg_postinst
+# @DESCRIPTION:
+# Regenerate configuration when the package is installed.
+qt4-build-multilib_pkg_postinst() {
+ debug-print-function "${FUNCNAME}" "$@"
+ qt4-build_pkg_postinst "$@"
+}
+
+# @FUNCTION: qt4-build-multilib_pkg_postrm
+# @DESCRIPTION:
+# Regenerate configuration when the package is completely removed.
+qt4-build-multilib_pkg_postrm() {
+ debug-print-function "${FUNCNAME}" "$@"
+ qt4-build_pkg_postrm "$@"
+}
+
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postrm pkg_postinst