Skip to content

Commit

Permalink
When install at the system path /usr install the rules file at the pk…
Browse files Browse the repository at this point in the history
…g config udevdir
  • Loading branch information
daschuer committed Jul 20, 2021
1 parent f48c276 commit e659766
Showing 1 changed file with 50 additions and 21 deletions.
71 changes: 50 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1370,27 +1370,56 @@ if(UNIX AND NOT APPLE)
)

option(INSTALL_USER_UDEV_RULES "Install user udev rule file for USB HID and Bulk controllers" ON)
if (INSTALL_USER_UDEV_RULES)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules"
DESTINATION
"${MIXXX_INSTALL_DATADIR}/udev/rules.d"
)
install(CODE "
message(STATUS \"Important Note: Installation of udev rules\n\"
\"The udev rule file for USB HID and Bulk controller permissions will be\n\"
\"installed to:\n\"
\" ${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}/udev/rules.d.\n\"
\"If you are installing Mixxx from source for your own use, copy\n\"
\"mixxx-usb-uaccess.rules to /etc/udev/rules.d/ and run:\n\"
\" udevadm control --reload-rules && udevadm trigger\n\"
\"as root to load the rules.\n\"
\"If you are building a package for a distribution, the correct directory for\n\"
\"system rules is either /lib/udev/rules.d (e.g. Debian, Fedora) or\n\"
\"/usr/lib/udev/rules.d (e.g. Arch Linux) with an appropriate priority prefix.\n\"
\"Adjust your package script accordingly and set -DINSTALL_USER_UDEV_RULES=OFF\")
")
if(INSTALL_USER_UDEV_RULES)
set(MIXXX_UDEVDIR "${MIXXX_INSTALL_DATADIR}/udev")
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
message(FATAL_ERROR "Bla")
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules( PKGCONFIG_UDEV udev)
if (PKGCONFIG_UDEV_FOUND)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=udevdir udev
OUTPUT_VARIABLE PKGCONFIG_UDEVDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(PKGCONFIG_UDEVDIR)
file(TO_CMAKE_PATH "${PKGCONFIG_UDEVDIR}" MIXXX_UDEVDIR)
endif()
endif()
endif()
endif()
if (MIXXX_UDEVDIR STREQUAL "${MIXXX_INSTALL_DATADIR}/udev")
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules"
DESTINATION
"${MIXXX_UDEVDIR}/rules.d"
)
install(CODE "
message(STATUS \"Important Note: Installation of udev rules\n\"
\"The udev rule file for USB HID and Bulk controller permissions have been\n\"
\"installed to:\n\"
\" ${MIXXX_UDEVDIR}/rules.d.\n\"
\"If you are installing Mixxx from source for your own use, copy\n\"
\"mixxx-usb-uaccess.rules to /etc/udev/rules.d/ and run:\n\"
\" udevadm control --reload-rules && udevadm trigger\n\"
\"as root to load the rules.\n\"
\"If you are building a package for a distribution, the correct directory for\n\"
\"system rules is either /lib/udev/rules.d (e.g. Debian, Fedora) or\n\"
\"/usr/lib/udev/rules.d (e.g. Arch Linux) with an appropriate priority prefix.\n\"
\"Adjust your package script accordingly and set -DINSTALL_USER_UDEV_RULES=OFF\")
")
else()
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules"
DESTINATION
"${MIXXX_UDEVDIR}/rules.d"
RENAME
"69-mixxx-usb-uaccess.rules"
)
endif()
endif()
endif()

Expand Down

0 comments on commit e659766

Please sign in to comment.