From ea93fcd424e9320239f939172948ea9f0646795b Mon Sep 17 00:00:00 2001 From: wb2osz Date: Thu, 24 Apr 2025 13:32:07 -0400 Subject: [PATCH] udev rules location --- CMakeLists.txt | 1 + conf/CMakeLists.txt | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58fcb09..6fed6bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,7 @@ if (C_CLANG OR C_GCC) # TODO: # Try error checking -fsanitize=bounds-strict -fsanitize=leak # Requires libubsan and liblsan, respectively. + # Maybe -fstack-protector-all, -fstack-check ###set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wvla -ffast-math -ftree-vectorize -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE ${EXTRA_FLAGS}") if(FREEBSD) diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index ffc809b..9f45e15 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -28,10 +28,15 @@ file(WRITE "${CMAKE_BINARY_DIR}/direwolf.conf" "${file_content}") # There are two locations. The one in /etc/udev/rules.d is meant for local customization and # takes precedence for the same name. # https://sources.debian.org/src/direwolf/1.7+dfsg-2/debian/patches/lib-udev-rules/ -# says that we should use the /usr/lib/udev/rules.d location. +# says that we should use the /usr/lib/udev/rules.d location when building a package. +# TODO: I think the proper solution is to select the location based on whether +# the application installation location is /usr/local or /usr. if(LINUX) - #install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION /etc/udev/rules.d/) - install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION /usr/lib/udev/rules.d/) + if (CMAKE_INSTALL_PREFIX STREQUAL "/usr/local") + install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION /etc/udev/rules.d/) + else() + install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION /usr/lib/udev/rules.d/) + endif() endif() install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION ${INSTALL_CONF_DIR})