git: 2c9a938c5b69 - main - devel/qt5-qdoc: fix CMake Config file for doctools

From: Adriaan de Groot <adridg_at_FreeBSD.org>
Date: Sun, 06 Feb 2022 17:52:21 UTC
The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2c9a938c5b69e6d6fb88cf33f6ad32394b9966a2

commit 2c9a938c5b69e6d6fb88cf33f6ad32394b9966a2
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2022-02-06 17:43:50 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-02-06 17:52:19 +0000

    devel/qt5-qdoc: fix CMake Config file for doctools
    
    We patch Qt to install into $LOCALBASE/lib/qt5, but the CMake
    bits of Qt go into $LOCALBASE; this mismatch of installation-
    prefixes means that the CMake Config files are generated with
    an incorrect number of "../" components, and end up looking in
    the wrong prefix. Symptom is this:
    
      The package "Qt5DocTools" references the file
         "/usr/lib/qt5/bin/qdoc"
    
    The logic to use the correct path is there, but not selected
    when writing out the Config file. Delete all the ones we don't
    want, rather than letting qmake / whatever text-substitution tool
    is in the build do it.
    
    Suggested by:   tcberner
---
 devel/qt5-qdoc/Makefile                            |  1 +
 .../patch-src_qdoc_Qt5DocToolsConfig.cmake.in      | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/devel/qt5-qdoc/Makefile b/devel/qt5-qdoc/Makefile
index f954b602e778..dd9057daeb82 100644
--- a/devel/qt5-qdoc/Makefile
+++ b/devel/qt5-qdoc/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	qdoc
 PORTVERSION=	${QT5_VERSION}${QT5_KDE_PATCH}
+PORTREVISION=	1
 CATEGORIES=	devel textproc
 PKGNAMEPREFIX=	qt5-
 
diff --git a/devel/qt5-qdoc/files/patch-src_qdoc_Qt5DocToolsConfig.cmake.in b/devel/qt5-qdoc/files/patch-src_qdoc_Qt5DocToolsConfig.cmake.in
new file mode 100644
index 000000000000..2f3e727b074c
--- /dev/null
+++ b/devel/qt5-qdoc/files/patch-src_qdoc_Qt5DocToolsConfig.cmake.in
@@ -0,0 +1,32 @@
+--- src/qdoc/Qt5DocToolsConfig.cmake.in.orig	2022-02-06 16:38:55 UTC
++++ src/qdoc/Qt5DocToolsConfig.cmake.in
+@@ -2,29 +2,7 @@ if (CMAKE_VERSION VERSION_LESS 2.8.3)
+     message(FATAL_ERROR \"Qt 5 requires at least CMake version 2.8.3\")
+ endif()
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ set(_qt5_qdoctools_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5DocTools\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5_qdoctools_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5_qdoctools_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5_qdoctools_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5_qdoctools_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+ 
+ macro(_qt5_DocTools_check_file_exists file)
+     if(NOT EXISTS \"${file}\" )