[PATCH] Add rpath so the Qt libs are found at runtime

David Faure faure at kde.org
Sun Dec 22 10:11:56 CET 2019


>From 24261594a341d15baca0a19b415be1dab5370f70 Mon Sep 17 00:00:00 2001
From: David Faure <faure at kde.org>
Date: Sat, 21 Dec 2019 21:04:35 +0100
Subject: [PATCH] Add rpath so the Qt libs are found at runtime

This is necessary when Qt is installed into a custom prefix.
---
 configure.ac   | 1 +
 m4/qt.m4       | 5 +++++
 qt/Makefile.am | 1 +
 3 files changed, 7 insertions(+)

diff --git a/configure.ac b/configure.ac
index 0392203..9daa65d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -556,6 +556,7 @@ fi
 
 AC_SUBST(PINENTRY_QT_CFLAGS)
 AC_SUBST(PINENTRY_QT_LIBS)
+AC_SUBST(PINENTRY_QT_LDFLAGS)
 AC_SUBST(MOC)
 
 dnl If we have come so far, qt pinentry can be build.
diff --git a/m4/qt.m4 b/m4/qt.m4
index 35d9ae2..f8ef3f6 100644
--- a/m4/qt.m4
+++ b/m4/qt.m4
@@ -57,6 +57,11 @@ AC_DEFUN([FIND_QT],
       PINENTRY_QT_CFLAGS="$PINENTRY_QT_CFLAGS -std=c++11"
     fi
 
+    qtlibdir=`"$PKG_CONFIG" --variable libdir Qt5Core`
+    if test -n "$qtlibdir"; then
+        PINENTRY_QT_LDFLAGS="$PINENTRY_QT_LDFLAGS -Wl,-rpath \"$qtlibdir\""
+    fi
+
     AC_CHECK_TOOL(MOC, moc)
     AC_MSG_CHECKING([moc version])
     mocversion=`$MOC -v 2>&1`
diff --git a/qt/Makefile.am b/qt/Makefile.am
index 840d0c0..14d9a0f 100644
--- a/qt/Makefile.am
+++ b/qt/Makefile.am
@@ -41,6 +41,7 @@ AM_CXXFLAGS = $(PINENTRY_QT_CFLAGS)
 pinentry_qt_LDADD = \
 	../pinentry/libpinentry.a $(top_builddir)/secmem/libsecmem.a \
 	$(COMMON_LIBS) $(PINENTRY_QT_LIBS) $(libcurses) $(LIBCAP)
+pinentry_qt_LDFLAGS = $(PINENTRY_QT_LDFLAGS)
 
 BUILT_SOURCES = \
 	pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5






More information about the Gnupg-devel mailing list