The attached patch proposes two helper functions to be added to
qmake-utils.eclass. These functions echo the correct directory where
qt binaries such as moc and lrelease are located. They can be used in
ebuilds when such binaries need to be called directly. (Ebuilds should
not rely on qtchooser for this.)

Please review before I commit.

-- 
Cheers,

Ben | yngwin
Gentoo developer
--- gentoo-x86/eclass/qmake-utils.eclass	2014-11-22 11:04:23.765870730 +0800
+++ overlay/qt/eclass/qmake-utils.eclass	2015-02-11 23:10:51.067484243 +0800
@@ -51,6 +51,25 @@
 	esac
 }

+# @FUNCTION qt4_get_bindir
+# @DESCRIPTION:
+# Get the correct location of Qt4's installed binaries.
+qt4_get_bindir() {
+	local qtbindir=${EPREFIX}/usr/$(get_libdir)/qt4/bin
+	if [[ -x ${qtbindir} ]]; then
+		echo ${qtbindir}
+	else
+		echo ${EPREFIX}/usr/bin
+	fi
+}
+
+# @FUNCTION qt5_get_bindir
+# @DESCRIPTION:
+# Get the correct location of Qt5's installed binaries.
+qt5_get_bindir() {
+	echo ${EPREFIX}/usr/$(get_libdir)/qt5/bin
+}
+
 # @VARIABLE: EQMAKE4_EXCLUDE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -158,11 +177,7 @@

 	[[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_pop

-	# determine qmake binary location
-	local qmake_path=${EPREFIX}/usr/$(get_libdir)/qt4/bin/qmake
-	[[ ! -x ${qmake_path} ]] && qmake_path=${EPREFIX}/usr/bin/qmake
-
-	"${qmake_path}" \
+	"$(qt4_get_bindir)"/qmake \
 		-makefile \
 		QMAKE_AR="$(tc-getAR) cqs" \
 		QMAKE_CC="$(tc-getCC)" \
@@ -213,7 +228,7 @@

 	ebegin "Running qmake"

-	"${EPREFIX}"/usr/$(get_libdir)/qt5/bin/qmake \
+	"$(qt5_get_bindir)"/qmake \
 		-makefile \
 		QMAKE_AR="$(tc-getAR) cqs" \
 		QMAKE_CC="$(tc-getCC)" \

Reply via email to