summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 032e1e4b5c..5a58dbed2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ option(ENABLE_ALL_THE_DEBUG_MACROS "Enable all debug macros to validate they sti
option(ENABLE_ALL_DEBUG_FACILITIES "Enable all noisy debug symbols and options. Not recommended for normal developer use" OFF)
option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks" ON)
option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON)
+option(ENABLE_USB_IDS_DOWNLOAD "Enable download of the usb.ids database at build time" ON)
option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF)
option(ENABLE_KERNEL_LTO "Build the kernel with link-time optimization" OFF)
@@ -293,3 +294,20 @@ if(EXISTS ${PCI_IDS_GZ_PATH} AND NOT EXISTS ${PCI_IDS_INSTALL_PATH})
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
file(RENAME ${PCI_IDS_PATH} ${PCI_IDS_INSTALL_PATH})
endif()
+
+set(USB_IDS_GZ_URL http://www.linux-usb.org/usb.ids.gz)
+set(USB_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/usb.ids.gz)
+set(USB_IDS_PATH ${CMAKE_BINARY_DIR}/usb.ids)
+set(USB_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/usb.ids)
+
+if(ENABLE_USB_IDS_DOWNLOAD AND NOT EXISTS ${USB_IDS_GZ_PATH})
+ message(STATUS "Downloading USB ID database from ${USB_IDS_GZ_URL}...")
+ file(DOWNLOAD ${USB_IDS_GZ_URL} ${USB_IDS_GZ_PATH} INACTIVITY_TIMEOUT 10)
+endif()
+
+if(EXISTS ${USB_IDS_GZ_PATH} AND NOT EXISTS ${USB_IDS_INSTALL_PATH})
+ message(STATUS "Extracting USB ID database from ${USB_IDS_GZ_PATH}...")
+ execute_process(COMMAND gzip -k -d ${USB_IDS_GZ_PATH})
+ file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
+ file(RENAME ${USB_IDS_PATH} ${USB_IDS_INSTALL_PATH})
+endif()