[LyX/master] Improved Qt framework configuration detection on macOS, add support for Qt6

Stephan Witt switt at lyx.org
Sun Oct 24 19:19:37 UTC 2021


commit aabe9e8b11b73d57d22893f5889ebee9dd97efe5
Author: Stephan Witt <switt at lyx.org>
Date:   Sun Oct 24 21:41:11 2021 +0200

    Improved Qt framework configuration detection on macOS, add support for Qt6
---
 config/qt.m4                          |   21 ++++++++++++++-------
 development/LyX-Mac-binary-release.sh |   16 +++++-----------
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/config/qt.m4 b/config/qt.m4
index 129e2ab..b9ffe28 100644
--- a/config/qt.m4
+++ b/config/qt.m4
@@ -44,6 +44,7 @@ AC_DEFUN([QT_CHECK_COMPILE],
 		qt_cv_libname=
 		for libname in $qt_guilibs \
 		               '-framework QtCore -framework QtConcurrent -framework QtSvg -framework QtWidgets -framework QtMacExtras -framework QtGui'\
+		               '-framework QtCore -framework QtConcurrent -framework QtSvg -framework QtSvgWidgets -framework QtWidgets -framework QtGui'\
 		               '-framework QtCore -framework QtGui'
 		do
 			QT_TRY_LINK($libname)
@@ -366,21 +367,27 @@ AC_DEFUN([QT_DO_MANUAL_CONFIG],
 	QT_CORE_LDFLAGS=
 	if test -n "$qt_cv_includes"; then
 		QT_INCLUDES="-I$qt_cv_includes"
-		for i in Qt QtCore QtGui QtWidgets QtSvg QtConcurrent QtMacExtras; do
+		for i in Qt QtCore QtGui QtWidgets QtSvg QtConcurrent QtSvgWidgets QtCore5Compat QtMacExtras; do
 			QT_INCLUDES="$QT_INCLUDES -I$qt_cv_includes/$i"
+			if test "$lyx_use_packaging" = "macosx" ; then
+				QT_INCLUDES="$QT_INCLUDES -I$qt_cv_libraries/${i}.framework/Headers"
+			fi
 		done
 		QT_CORE_INCLUDES="-I$qt_cv_includes -I$qt_cv_includes/QtCore"
 	fi
 	case "$qt_cv_libraries" in
-	*framework*)
-		QT_LDFLAGS="-F$qt_cv_libraries"
-		QT_CORE_LDFLAGS="-F$qt_cv_libraries"
-		;;
 	"")
 		;;
 	*)
-		QT_LDFLAGS="-L$qt_cv_libraries"
-		QT_CORE_LDFLAGS="-L$qt_cv_libraries"
+		if test "$lyx_use_packaging" = "macosx" ; then
+			QT_INCLUDES="$QT_INCLUDES -F$qt_cv_libraries"
+			QT_CORE_INCLUDES="$QT_CORE_INCLUDES -I$qt_cv_libraries/QtCore.framework/Headers -F$qt_cv_libraries"
+			QT_LDFLAGS="-F$qt_cv_libraries"
+			QT_CORE_LDFLAGS="-F$qt_cv_libraries"
+		else
+			QT_LDFLAGS="-L$qt_cv_libraries"
+			QT_CORE_LDFLAGS="-L$qt_cv_libraries"
+		fi
 		;;
 	esac
 	AC_SUBST(QT_INCLUDES)
diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh
index 00b58e4..7cd3b79 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -374,6 +374,10 @@ case "${QtVersion}" in
 	QtLibraries=${QtLibraries:-"QtSvg QtXml QtPrintSupport QtMacExtras QtWidgets QtGui QtNetwork QtConcurrent QtCore"}
 	QtFrameworkVersion="5"
 	;;
+6*)
+	QtLibraries=${QtLibraries:-"QtCore5Compat QtDBus QtSvg QtXml QtPrintSupport QtSvgWidgets QtWidgets QtGui QtNetwork QtConcurrent QtCore"}
+	QtFrameworkVersion="A"
+	;;
 *)
 	QtLibraries=${QtLibraries:-"QtSvg QtXml QtGui QtNetwork QtCore"}
 	QtFrameworkVersion="4"
@@ -425,16 +429,6 @@ build_qt() {
 		"${QtSourceDir}"/configure ${QtConfigureOptions} ${QTARCHS} -prefix "${QtInstallDir}"
 		make -j1 && make -j1 install
 	)
-	if [ -d "${QtInstallDir}" -a ! -f "${QtInstallDir}"/include/QtCore ]; then
-		cd "${QtInstallDir}" && (
-			mkdir -p include
-			cd include
-			for libnm in ${QtLibraries} ; do
-				test -d ${libnm} -o -L ${libnm} || \
-				( ln -s ../lib/${libnm}.framework/Headers ${libnm} && echo Link to framework ${libnm} )
-			done
-		)
-	fi
 }
 
 case ${QtOnlyPackage:-"no"} in
@@ -697,7 +691,7 @@ build_lyx() {
 		mkdir -p "${LyxBuildDir}" && cd "${LyxBuildDir}"
 
 		CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
-		LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS} -F${QtInstallDir}/lib"
+		LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"
 
 		if [ "$configure_qt_frameworks" = "yes" ]; then
 			export QT_CORE_CFLAGS="-FQtCore"


More information about the lyx-cvs mailing list