From f915df0e79f1310fe389f32619747fedc92702c8 Mon Sep 17 00:00:00 2001 From: Bart Ribbers <bribbers@disroot.org> Date: Sun, 18 Jul 2021 01:47:44 +0200 Subject: [PATCH] Install UDev rules to the proper location by default The comment in the CMakeLists.txt talks about some proper location the file has to be installed too, but itself installs it to a wrong directory. Rather than telling people to turn the option off and install the file to the right directory manually, install it directly to the correct directory instead. ${CMAKE_INSTALL_LIBDIR} will expand to whatever distros require it to be _assuming_ they set their -DCMAKE_INSTALL_PREFIX and -DCMAKE_INSTALL_LIBDIR correctly Also while we're at it, make sure it's loaded before 70-uaccess.rules rather than just having a comment mention that in the udev file itself --- CMakeLists.txt | 14 +++++--------- packaging/CPackDebInstall.cmake | 6 +++--- packaging/CPackDebUploadPPA.cmake | 6 +++--- .../linux/69-mixxx-usb-uaccess.rules | 0 res/linux/mixxx.metainfo.xml | 2 +- 5 files changed, 12 insertions(+), 16 deletions(-) rename res/linux/mixxx-usb-uaccess.rules => packaging/linux/69-mixxx-usb-uaccess.rules (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b924921e418..0c012cd347e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1373,23 +1373,19 @@ if(UNIX AND NOT APPLE) if (INSTALL_USER_UDEV_RULES) install( FILES - "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules" + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/linux/69-mixxx-usb-uaccess.rules" DESTINATION - "${MIXXX_INSTALL_DATADIR}/udev/rules.d" + "${CMAKE_INSTALL_LIBDIR}/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\" + \" ${CMAKE_INSTALL_LIBDIR}/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\" + \"69-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\") + \"as root to load the rules.\n\") ") endif() endif() diff --git a/packaging/CPackDebInstall.cmake b/packaging/CPackDebInstall.cmake index 16e99ecb72d..17fce618b09 100644 --- a/packaging/CPackDebInstall.cmake +++ b/packaging/CPackDebInstall.cmake @@ -33,11 +33,11 @@ configure_file(${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/con @ONLY) file(REMOVE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in) -file(COPY ${CPACK_DEBIAN_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules +file(COPY ${CPACK_DEBIAN_SOURCE_DIR}/packaging/linux/69-mixxx-usb-uaccess.rules DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian) file(RENAME - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev) + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/69-mixxx-usb-uaccess.rules + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.69-mixxx-usb-uaccess.udev) execute_process( COMMAND ${CPACK_DEBIAN_DOCBOOK_TO_MAN} debian/mixxx.sgml diff --git a/packaging/CPackDebUploadPPA.cmake b/packaging/CPackDebUploadPPA.cmake index b817b3f7631..fc976050805 100644 --- a/packaging/CPackDebUploadPPA.cmake +++ b/packaging/CPackDebUploadPPA.cmake @@ -79,11 +79,11 @@ execute_process( WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} ) -file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/res/linux/mixxx-usb-uaccess.rules +file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/linux/69-mixxx-usb-uaccess.rules DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian) file(RENAME - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev) + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/69-mixxx-usb-uaccess.rules + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.69-mixxx-usb-uaccess.udev) if(DEB_BUILD) execute_process( diff --git a/res/linux/mixxx-usb-uaccess.rules b/packaging/linux/69-mixxx-usb-uaccess.rules similarity index 100% rename from res/linux/mixxx-usb-uaccess.rules rename to packaging/linux/69-mixxx-usb-uaccess.rules diff --git a/res/linux/mixxx.metainfo.xml b/res/linux/mixxx.metainfo.xml index 6b7636c463d..ad6d47aeec8 100644 --- a/res/linux/mixxx.metainfo.xml +++ b/res/linux/mixxx.metainfo.xml @@ -37,7 +37,7 @@ </ul> </description> <provides> - <!-- Keep these IDs in sync with res/linux/mixxx-usb-uaccess.rules --> + <!-- Keep these IDs in sync with packaging/linux/69-mixxx-usb-uaccess.rules --> <modalias>usb:v22F0p0008d*</modalias> <modalias>usb:v1C75p*</modalias> <modalias>usb:v1397p*</modalias>