build: honour CMake install prefix in hardcoded paths

Search plugins, ACL ressources and other data files relative to the compile
time CMAKE_INSTALL_PREFIX instead of hardcoding `/usr`.

Also ensure that plugin libraries are installed into the lib/rpcd subdir.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2021-12-03 23:36:35 +01:00
parent d11ffe9383
commit 75a96dc281
3 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6)
INCLUDE(CheckFunctionExists) INCLUDE(CheckFunctionExists)
PROJECT(rpcd C) PROJECT(rpcd C)
ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
INCLUDE_DIRECTORIES(include) INCLUDE_DIRECTORIES(include)
OPTION(FILE_SUPPORT "File plugin support" ON) OPTION(FILE_SUPPORT "File plugin support" ON)
@ -67,5 +67,5 @@ ENDIF()
INSTALL(TARGETS rpcd ${PLUGINS} INSTALL(TARGETS rpcd ${PLUGINS}
RUNTIME DESTINATION sbin RUNTIME DESTINATION sbin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib/rpcd
) )

View file

@ -39,10 +39,10 @@
#include <rpcd/session.h> #include <rpcd/session.h>
/* location of plugin executables */ /* location of plugin executables */
#define RPC_PLUGIN_DIRECTORY "/usr/libexec/rpcd" #define RPC_PLUGIN_DIRECTORY INSTALL_PREFIX "/libexec/rpcd"
/* location of plugin libraries */ /* location of plugin libraries */
#define RPC_LIBRARY_DIRECTORY "/usr/lib/rpcd" #define RPC_LIBRARY_DIRECTORY INSTALL_PREFIX "/lib/rpcd"
struct rpc_daemon_ops { struct rpc_daemon_ops {
bool (*session_access)(const char *sid, const char *scope, bool (*session_access)(const char *sid, const char *scope,

View file

@ -34,7 +34,7 @@
#define RPC_DEFAULT_SESSION_TIMEOUT 300 #define RPC_DEFAULT_SESSION_TIMEOUT 300
#define RPC_DEFAULT_SESSION_ID "00000000000000000000000000000000" #define RPC_DEFAULT_SESSION_ID "00000000000000000000000000000000"
#define RPC_SESSION_DIRECTORY "/var/run/rpcd/sessions" #define RPC_SESSION_DIRECTORY "/var/run/rpcd/sessions"
#define RPC_SESSION_ACL_DIR "/usr/share/rpcd/acl.d" #define RPC_SESSION_ACL_DIR INSTALL_PREFIX "/share/rpcd/acl.d"
extern char apply_sid[RPC_SID_LEN + 1]; extern char apply_sid[RPC_SID_LEN + 1];