summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-03-03 23:50:25 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-04 11:21:55 +0100
commit377550761335d12a298f5c28f657abc8b4d30500 (patch)
treeb27b1d21ebfc175e9d3cfd6c15478204335eea3e /CMakeLists.txt
parent15ae22f7ccfc1401db133854023a5b259f8aae46 (diff)
downloadserenity-377550761335d12a298f5c28f657abc8b4d30500.zip
Build: Download and uncompress gzipped version of pci.ids
Partially addresses #5611.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 15 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b5ce42c1f..f7209ae0a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -184,9 +184,19 @@ add_subdirectory(AK)
add_subdirectory(Kernel)
add_subdirectory(Userland)
-set(PCI_IDS_URL https://pci-ids.ucw.cz/v2.2/pci.ids)
-set(PCI_IDS_PATH ${CMAKE_INSTALL_DATAROOTDIR}/pci.ids)
-if(ENABLE_PCI_IDS_DOWNLOAD AND NOT EXISTS ${PCI_IDS_PATH})
- message(STATUS "Downloading PCI ID database from ${PCI_IDS_URL}...")
- file(DOWNLOAD ${PCI_IDS_URL} ${PCI_IDS_PATH} INACTIVITY_TIMEOUT 10)
+set(PCI_IDS_GZ_URL https://pci-ids.ucw.cz/v2.2/pci.ids.gz)
+set(PCI_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/pci.ids.gz)
+set(PCI_IDS_PATH ${CMAKE_BINARY_DIR}/pci.ids)
+set(PCI_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/pci.ids)
+
+if(ENABLE_PCI_IDS_DOWNLOAD AND NOT EXISTS ${PCI_IDS_GZ_PATH})
+ message(STATUS "Downloading PCI ID database from ${PCI_IDS_GZ_URL}...")
+ file(DOWNLOAD ${PCI_IDS_GZ_URL} ${PCI_IDS_GZ_PATH} INACTIVITY_TIMEOUT 10)
+endif()
+
+if(EXISTS ${PCI_IDS_GZ_PATH} AND NOT EXISTS ${PCI_IDS_INSTALL_PATH})
+ message(STATUS "Extracting PCI ID database from ${PCI_IDS_GZ_PATH}...")
+ execute_process(COMMAND gzip -k -d ${PCI_IDS_GZ_PATH})
+ file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
+ file(RENAME ${PCI_IDS_PATH} ${PCI_IDS_INSTALL_PATH})
endif()