From 9c5a6fadb61d24c3389aab5602d92594ea8bb06a Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 13 Apr 2022 00:25:55 +0200 Subject: [PATCH] Add rpath to nymead binary This allows to run it from the build directory without having to specify LD_LIBRARY_PATH. This is particularly useul when working with parts that require special capabilities such as the NetworkDiscovery, given that setcap on a binary disables LD_LIBRARY_LATH loading for security reasons. Building the dpkg package, the rpath will not be added. --- debian/rules | 6 +++--- server/server.pro | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 02110b5c..9d5bbc7f 100755 --- a/debian/rules +++ b/debian/rules @@ -16,11 +16,11 @@ ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) MAKE_TARGETS += doc endif -QMAKE_ADDITIONAL_ARGS= +QMAKE_ADDITIONAL_ARGS = CONFIG+=norpath ifneq (,$(filter coverage,$(DEB_BUILD_OPTIONS))) - QMAKE_ADDITIONAL_ARGS += CONFIG+=coverage CONFIG+=debug + QMAKE_ADDITIONAL_ARGS += CONFIG+=coverage CONFIG+=debug else - QMAKE_ADDITIONAL_ARGS += CONFIG+=release + QMAKE_ADDITIONAL_ARGS += CONFIG+=release endif DPKG_EXPORT_BUILDFLAGS = 1 diff --git a/server/server.pro b/server/server.pro index a952594a..398a2c65 100644 --- a/server/server.pro +++ b/server/server.pro @@ -17,6 +17,12 @@ LIBS += -L$$top_builddir/libnymea/ -lnymea \ -L$$top_builddir/libnymea-core -lnymea-core \ -lnymea-remoteproxyclient +# Add rpath for easy running from the build dir, unless explicitly disabled +!norpath: { + message("Adding rpath to nymead binary") + LIBS += -Wl,-rpath ../libnymea/:../libnymea-core/ +} + CONFIG += link_pkgconfig PKGCONFIG += nymea-zigbee