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.
This commit is contained in:
Michael Zanetti 2022-04-13 00:25:55 +02:00
parent bb03d17c79
commit 9c5a6fadb6
2 changed files with 9 additions and 3 deletions

6
debian/rules vendored
View File

@ -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

View File

@ -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