Skip to content

Commit

Permalink
Fix install locations for modprobe config and udev rules (#502)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
c-mauderer authored and xor-gate committed Oct 26, 2016
1 parent 78e849f commit 49248f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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'
10 changes: 10 additions & 0 deletions doc/compiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" ..
```

0 comments on commit 49248f5

Please sign in to comment.