From c11860bdcdf5c3a4e412fde2b18143ef08c2a85d Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 14 Mar 2023 17:52:06 -0400 Subject: [PATCH] Meta: Download pci.ids and usb.ids to Build/caches This ensures we only need to download these files once for all build configurations. We similarly download the UCD, CLDR, and TZDB to this cache directory as well. --- CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2543506e3e..3ff5a229bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,17 +246,21 @@ export_components("${CMAKE_BINARY_DIR}/components.ini") # https://gitlab.kitware.com/cmake/cmake/-/issues/23054 set(PCI_IDS_FILE pci.ids) -set(PCI_IDS_URL https://pci-ids.ucw.cz/v2.2/${PCI_IDS_FILE}) -set(PCI_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PCI_IDS_FILE}) +set(PCI_IDS_URL "https://pci-ids.ucw.cz/v2.2/${PCI_IDS_FILE}") +set(PCI_IDS_DOWNLOAD_PATH "${SERENITY_CACHE_DIR}/${PCI_IDS_FILE}") +set(PCI_IDS_INSTALL_PATH "${CMAKE_STAGING_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${PCI_IDS_FILE}") -if(ENABLE_PCI_IDS_DOWNLOAD AND NOT EXISTS ${CMAKE_STAGING_PREFIX}/${PCI_IDS_INSTALL_PATH} ) - download_file("${PCI_IDS_URL}" "${CMAKE_STAGING_PREFIX}/${PCI_IDS_INSTALL_PATH}") +if (ENABLE_PCI_IDS_DOWNLOAD AND NOT EXISTS "${PCI_IDS_INSTALL_PATH}") + download_file("${PCI_IDS_URL}" "${PCI_IDS_DOWNLOAD_PATH}") + file(COPY_FILE "${PCI_IDS_DOWNLOAD_PATH}" "${PCI_IDS_INSTALL_PATH}") endif() set(USB_IDS_FILE usb.ids) -set(USB_IDS_URL http://www.linux-usb.org/${USB_IDS_FILE}) -set(USB_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${USB_IDS_FILE}) +set(USB_IDS_URL "http://www.linux-usb.org/${USB_IDS_FILE}") +set(USB_IDS_DOWNLOAD_PATH "${SERENITY_CACHE_DIR}/${USB_IDS_FILE}") +set(USB_IDS_INSTALL_PATH "${CMAKE_STAGING_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${USB_IDS_FILE}") -if(ENABLE_USB_IDS_DOWNLOAD AND NOT EXISTS "${CMAKE_STAGING_PREFIX}/${USB_IDS_INSTALL_PATH}") - download_file("${USB_IDS_URL}" "${CMAKE_STAGING_PREFIX}/${USB_IDS_INSTALL_PATH}") +if (ENABLE_USB_IDS_DOWNLOAD AND NOT EXISTS "${USB_IDS_INSTALL_PATH}") + download_file("${USB_IDS_URL}" "${USB_IDS_DOWNLOAD_PATH}") + file(COPY_FILE "${USB_IDS_DOWNLOAD_PATH}" "${USB_IDS_INSTALL_PATH}") endif()