commit:     03a9f4e5516702df1a185f616b06f429dc9ad19f
Author:     Thomas Bettler <thomas.bettler <AT> gmail <DOT> com>
AuthorDate: Sun Jun 11 08:53:46 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Jun 13 12:12:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03a9f4e5

qmake-utils.eclass: add qt6 support

Signed-off-by: Thomas Bettler <thomas.bettler <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/31254
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 eclass/qmake-utils.eclass | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/eclass/qmake-utils.eclass b/eclass/qmake-utils.eclass
index 88755ab7aa8a..5c5fa8dcb047 100644
--- a/eclass/qmake-utils.eclass
+++ b/eclass/qmake-utils.eclass
@@ -155,4 +155,63 @@ qt6_get_plugindir() {
        echo $(qt6_get_libdir)/qt6/plugins
 }
 
+# @FUNCTION: qt6_get_qmake_args
+# @DESCRIPTION:
+# Echoes a multi-line string containing arguments to pass to qmake.
+qt6_get_qmake_args() {
+       cat <<-EOF
+               QMAKE_AR="$(tc-getAR) cqs"
+               QMAKE_CC="$(tc-getCC)"
+               QMAKE_LINK_C="$(tc-getCC)"
+               QMAKE_LINK_C_SHLIB="$(tc-getCC)"
+               QMAKE_CXX="$(tc-getCXX)"
+               QMAKE_LINK="$(tc-getCXX)"
+               QMAKE_LINK_SHLIB="$(tc-getCXX)"
+               QMAKE_OBJCOPY="$(tc-getOBJCOPY)"
+               QMAKE_RANLIB=
+               QMAKE_STRIP=
+               QMAKE_CFLAGS="${CFLAGS}"
+               QMAKE_CFLAGS_RELEASE=
+               QMAKE_CFLAGS_DEBUG=
+               QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO=
+               QMAKE_CXXFLAGS="${CXXFLAGS}"
+               QMAKE_CXXFLAGS_RELEASE=
+               QMAKE_CXXFLAGS_DEBUG=
+               QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO=
+               QMAKE_LFLAGS="${LDFLAGS}"
+               QMAKE_LFLAGS_RELEASE=
+               QMAKE_LFLAGS_DEBUG=
+               QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO=
+       EOF
+}
+
+# @FUNCTION: eqmake6
+# @USAGE: [arguments for qmake]
+# @DESCRIPTION:
+# Wrapper for Qt6's qmake. All arguments are passed to qmake.
+#
+# For recursive build systems, i.e. those based on the subdirs template,
+# you should run eqmake6 on the top-level project file only, unless you
+# have a valid reason to do otherwise. During the building, qmake will
+# be automatically re-invoked with the right arguments on every directory
+# specified inside the top-level project file.
+eqmake6() {
+       debug-print-function ${FUNCNAME} "$@"
+
+       ebegin "Running qmake"
+
+       local -a args
+       mapfile -t args <<<"$(qt6_get_qmake_args)"
+       # NB: we're passing literal quotes in but qmake doesn't seem to mind
+       "$(qt6_get_bindir)"/qmake -makefile "${args[@]}" "$@"
+
+       if ! eend $? ; then
+               echo
+               eerror "Running qmake has failed! (see above for details)"
+               eerror "This shouldn't happen - please send a bug report to 
https://bugs.gentoo.org/";
+               echo
+               die "eqmake6 failed"
+       fi
+}
+
 fi

Reply via email to