From a08efc85bce3d92c7d266effc658e788321e064f Mon Sep 17 00:00:00 2001
From: Keith Bennett <keith@airmap.com>
Date: Sat, 23 Oct 2021 16:36:49 -0500
Subject: [PATCH] actually, deploy the qt.conf separately

---
 QGCPostLinkCommon.pri     |  3 +++
 deploy/linux-post-link.sh | 15 ---------------
 deploy/qt.conf            |  3 +++
 3 files changed, 6 insertions(+), 15 deletions(-)
 create mode 100644 deploy/qt.conf

diff --git a/QGCPostLinkCommon.pri b/QGCPostLinkCommon.pri
index c90cf95..6697510 100644
--- a/QGCPostLinkCommon.pri
+++ b/QGCPostLinkCommon.pri
@@ -165,4 +165,7 @@ LinuxBuild {
     }
 
     QMAKE_POST_LINK += && QTDIR="$$DESTDIR/Qt" RPATHDIR="$$DESTDIR/Qt/libs" QTCONF_PATH="$$DESTDIR/qt.conf" $$SOURCE_DIR/deploy/linux-post-link.sh
+
+    # https://doc.qt.io/qt-5/qt-conf.html
+    QMAKE_POST_LINK += && cp deploy/qt.conf $$DESTDIR
 }
diff --git a/deploy/linux-post-link.sh b/deploy/linux-post-link.sh
index cee317d..8fbbcaf 100755
--- a/deploy/linux-post-link.sh
+++ b/deploy/linux-post-link.sh
@@ -23,13 +23,6 @@
 # to be used, like such:
 # LD_LIBRARY_PATH=./Qt/libs ./QGroundControl
 #
-# In addition, Qt will sometimes want to reference its own directory to find
-# certain resources. This installs a file, qt.conf, which tells Qt where its
-# installation is at.
-# Without the qt.conf file, you would need to tell Qt where to find certain
-# files, particularly for QML, like such:
-# QML2_IMPORT_PATH=./Qt/qml QT_PLUGIN_PATH=./Qt/plugins ./QGroundControl
-#
 
 # -e: stop on error
 # -u: undefined variable use is an error
@@ -92,11 +85,3 @@ while IFS='' read -r library; do
     # patch the library's rpath
     patchelf --set-rpath "${new_rpath}" "${library}"
 done
-
-# Create a qt.conf file
-# https://doc.qt.io/qt-5/qt-conf.html
-cat <<EOF > "${QTCONF_PATH}"
-[Paths]
-Prefix=./Qt
-Libraries=libs
-EOF
diff --git a/deploy/qt.conf b/deploy/qt.conf
new file mode 100644
index 0000000..00d24eb
--- /dev/null
+++ b/deploy/qt.conf
@@ -0,0 +1,3 @@
+[Paths]
+Prefix=./Qt
+Libraries=libs