Meta: Use portable gzip option for extracting PCI and USB ID files

gzip -c is supported in both Linux and BSD flavors of gzip. The -o flag
was introduced in a previous commit which is present in OpenBSD, but not
other flavors of Linux. -c will write to stdout which is redirected to
the target files. As a side benefit, we no longer need to copy files
anywhere
This commit is contained in:
tuftedocelot 2021-12-29 11:52:59 -06:00 committed by Brian Gianforcaro
parent 018dc4bb5c
commit 4633f89217
Notes: sideshowbarker 2024-07-17 21:58:17 +09:00

View file

@ -270,8 +270,7 @@ 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}...")
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
file(COPY ${PCI_IDS_GZ_PATH} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR})
execute_process(COMMAND gzip -d -o ${PCI_IDS_INSTALL_PATH} ${CMAKE_INSTALL_DATAROOTDIR}/${PCI_IDS_FILE}.gz)
execute_process(COMMAND gzip -d -c "${PCI_IDS_GZ_PATH}" OUTPUT_FILE "${PCI_IDS_INSTALL_PATH}")
endif()
set(USB_IDS_FILE usb.ids)
@ -288,6 +287,5 @@ 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}...")
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
file(COPY ${USB_IDS_GZ_PATH} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR})
execute_process(COMMAND gzip -d -o ${USB_IDS_INSTALL_PATH} ${CMAKE_INSTALL_DATAROOTDIR}/${USB_IDS_FILE}.gz)
execute_process(COMMAND gzip -d -c "${USB_IDS_GZ_PATH}" OUTPUT_FILE "${USB_IDS_INSTALL_PATH}")
endif()