From 75a96dc281d4e3652655155e85ea04abcffcb5e9 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 3 Dec 2021 23:36:35 +0100 Subject: 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 --- CMakeLists.txt | 4 ++-- include/rpcd/plugin.h | 4 ++-- include/rpcd/session.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26e011e..7628212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6) INCLUDE(CheckFunctionExists) 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) OPTION(FILE_SUPPORT "File plugin support" ON) @@ -67,5 +67,5 @@ ENDIF() INSTALL(TARGETS rpcd ${PLUGINS} RUNTIME DESTINATION sbin - LIBRARY DESTINATION lib + LIBRARY DESTINATION lib/rpcd ) diff --git a/include/rpcd/plugin.h b/include/rpcd/plugin.h index 363c0d7..b795f0e 100644 --- a/include/rpcd/plugin.h +++ b/include/rpcd/plugin.h @@ -39,10 +39,10 @@ #include /* location of plugin executables */ -#define RPC_PLUGIN_DIRECTORY "/usr/libexec/rpcd" +#define RPC_PLUGIN_DIRECTORY INSTALL_PREFIX "/libexec/rpcd" /* location of plugin libraries */ -#define RPC_LIBRARY_DIRECTORY "/usr/lib/rpcd" +#define RPC_LIBRARY_DIRECTORY INSTALL_PREFIX "/lib/rpcd" struct rpc_daemon_ops { bool (*session_access)(const char *sid, const char *scope, diff --git a/include/rpcd/session.h b/include/rpcd/session.h index 3815a43..8ff3ed0 100644 --- a/include/rpcd/session.h +++ b/include/rpcd/session.h @@ -34,7 +34,7 @@ #define RPC_DEFAULT_SESSION_TIMEOUT 300 #define RPC_DEFAULT_SESSION_ID "00000000000000000000000000000000" #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]; -- cgit v1.2.1