From 49248f598564dc81af23811201cbe2ea3bb65456 Mon Sep 17 00:00:00 2001 From: Christian Mauderer Date: Wed, 26 Oct 2016 20:40:25 +0200 Subject: [PATCH] Fix install locations for modprobe config and udev rules (#502) * cmake: Fix location of modprobe.d config. * cmake: Use cmake variables for install locations. This commit add the following two Cmake variables to change the install location of the udev and modprobe configuration files: - STLINK_UDEV_RULES_DIR - STLINK_MODPROBED_DIR * doc/compiling.md: Add info about new CMAKE variables. * debian: Use CMAKE variables for build. --- CMakeLists.txt | 6 ++++-- debian/rules | 3 ++- doc/compiling.md | 10 ++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04717e0a6..4aac51c05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8.7) project(stlink C) set(PROJECT_DESCRIPTION "Open source version of the STMicroelectronics Stlink Tools") +set(STLINK_UDEV_RULES_DIR "/etc/udev/rules.d" CACHE PATH "Udev rules directory") +set(STLINK_MODPROBED_DIR "/etc/modprobe.d" CACHE PATH "modprobe.d directory") option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF) @@ -131,9 +133,9 @@ install(TARGETS st-flash st-info if (CMAKE_SYSTEM_NAME STREQUAL "Linux") file(GLOB RULES_FILES etc/udev/rules.d/*.rules) install(FILES etc/modprobe.d/stlink_v1.conf - DESTINATION /etc) + DESTINATION ${STLINK_MODPROBED_DIR}/) install(FILES ${RULES_FILES} - DESTINATION /lib/udev/rules.d/) + DESTINATION ${STLINK_UDEV_RULES_DIR}/) endif() add_subdirectory(src/gdbserver) diff --git a/debian/rules b/debian/rules index 2b826772b..2ff7e59a8 100755 --- a/debian/rules +++ b/debian/rules @@ -24,4 +24,5 @@ include /usr/share/dpkg/default.mk # This is example for Cmake (See http://bugs.debian.org/641051 ) override_dh_auto_configure: dh_auto_configure -- \ - -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \ + -DSTLINK_UDEV_RULES_DIR='/lib/udev/rules.d' diff --git a/doc/compiling.md b/doc/compiling.md index 7ce1bfcc5..c8a06dc86 100644 --- a/doc/compiling.md +++ b/doc/compiling.md @@ -79,3 +79,13 @@ brew install libusb cmake ``` Compile as described in the first section of this document. + +## Build using different directories for udev and modprobe + +To put the udev or the modprobe configuration files into a different directory +during installation you can use the following cmake options: + +``` +$ cmake -DSTLINK_UDEV_RULES_DIR="/usr/lib/udev/rules.d" \ + -DSTLINK_MODPROBED_DIR="/usr/lib/modprobe.d" .. +```