Build: Remove gzip -k usage in PCI/USB ID files and crypt for OpenBSD

OpenBSD gzip does not have the -k flag to keep the original after
extraction. Work around this by copying the original gzip to the dest
and then extracting. A bit of a hack, but only needs to be done for the
first-time or rebuilds

OpenBSD provides crypt in libc, not libcrypt. Adjust if/else to check
for either and proceed accordingly

Remove outdated OpenBSD checks when building the toolchain
This commit is contained in:
tuftedocelot 2021-12-22 18:32:00 -06:00 committed by Brian Gianforcaro
parent ea0a002468
commit 5810467c97
Notes: sideshowbarker 2024-07-17 21:59:44 +09:00
3 changed files with 18 additions and 20 deletions

View file

@ -256,10 +256,11 @@ endif()
export_components("${CMAKE_BINARY_DIR}/components.ini")
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)
set(PCI_IDS_FILE pci.ids)
set(PCI_IDS_GZ_URL https://pci-ids.ucw.cz/v2.2/${PCI_IDS_FILE}.gz)
set(PCI_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/${PCI_IDS_FILE}.gz)
set(PCI_IDS_PATH ${CMAKE_BINARY_DIR}/${PCI_IDS_FILE})
set(PCI_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PCI_IDS_FILE})
if(ENABLE_PCI_IDS_DOWNLOAD AND NOT EXISTS ${PCI_IDS_GZ_PATH})
message(STATUS "Downloading PCI ID database from ${PCI_IDS_GZ_URL}...")
@ -268,15 +269,16 @@ 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})
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)
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)
set(USB_IDS_FILE usb.ids)
set(USB_IDS_GZ_URL http://www.linux-usb.org/${USB_IDS_FILE}.gz)
set(USB_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/${USB_IDS_FILE}.gz)
set(USB_IDS_PATH ${CMAKE_BINARY_DIR}/${USB_IDS_FILE})
set(USB_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${USB_IDS_FILE})
if(ENABLE_USB_IDS_DOWNLOAD AND NOT EXISTS ${USB_IDS_GZ_PATH})
message(STATUS "Downloading USB ID database from ${USB_IDS_GZ_URL}...")
@ -285,7 +287,7 @@ 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})
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)
endif()

View file

@ -224,8 +224,10 @@ lagom_lib(Core core
SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES}
LIBS Threads::Threads
)
if (NOT APPLE)
target_link_libraries(LagomCore crypt) # Core::Account uses crypt() but it's not in libcrypt on macOS
if (APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
target_link_libraries(LagomCore) # Core::Account uses crypt() but it's not in libcrypt on macOS
else()
target_link_libraries(LagomCore crypt)
endif()
# Main

View file

@ -384,9 +384,6 @@ pushd "$DIR/Build/$ARCH"
echo "XXX build gcc and libgcc"
buildstep "gcc/build" "$MAKE" -j "$MAKEJOBS" all-gcc || exit 1
if [ "$SYSTEM_NAME" = "OpenBSD" ]; then
ln -sf liblto_plugin.so.0.0 gcc/liblto_plugin.so
fi
buildstep "libgcc/build" "$MAKE" -j "$MAKEJOBS" all-target-libgcc || exit 1
echo "XXX install gcc and libgcc"
buildstep "gcc+libgcc/install" "$MAKE" install-gcc install-target-libgcc || exit 1
@ -397,9 +394,6 @@ pushd "$DIR/Build/$ARCH"
buildstep "libstdc++/install" "$MAKE" install-target-libstdc++-v3 || exit 1
popd
if [ "$SYSTEM_NAME" = "OpenBSD" ]; then
cd "$DIR/Local/${ARCH}/libexec/gcc/$TARGET/$GCC_VERSION" && ln -sf liblto_plugin.so.0.0 liblto_plugin.so
fi
popd