summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJesse Buhagiar <jooster669@gmail.com>2021-06-10 00:24:04 +1000
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-18 17:04:57 +0430
commit01cd474930d8f8fc262647fe069bed63ddc60744 (patch)
treeb2537f00bac3da0ffe1f0cc66c59f4860fdbdeb6 /CMakeLists.txt
parent119b8a2692300e9479b28feb053c6f6af6088801 (diff)
downloadserenity-01cd474930d8f8fc262647fe069bed63ddc60744.zip
Userland/Libraries: Add LibUSBDB library
Simple clone of LibPCIDB to support USB IDs instead of PCI ones. The format is basically identical, besides a few changes of the double tab fields.
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()