From dffef38ec9ed66fb51df795498ceb4914269883b Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Fri, 12 Jun 2026 08:23:15 -0700 Subject: [PATCH] cmake: probe for a system 7-Zip/LZMA SDK before fetching Requested by the openSUSE packager: distributions ship the SDK sources (lzma-sdk-devel), so the vendored lzma1604.7z download is unnecessary there. Probe WINUAE_LZMA_SDK_SYSTEM_PATHS (common /usr locations, overridable) for an installed SDK source tree before falling back to WINUAE_LZMA_SDK_DIR and the fetch. Candidates must provide the C sources, not just headers, since the SDK is compiled into the build. --- CMakeLists.txt | 11 ++++++++++- README_unix.md | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b71c1e8f..4569b4da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,12 +84,18 @@ function(winuae_unix_macos_find_qt_frameworks out_var) endfunction() function(winuae_unix_find_lzma_sdk out_var) + # A system lzma-sdk source package (e.g. openSUSE lzma-sdk-devel) is + # preferred over fetching the vendored archive; it must provide the SDK + # C sources, not just headers. set(WINUAE_LZMA_SDK_CANDIDATES "${WINUAE_LZMA_SDK_DIR}/C" "${WINUAE_LZMA_SDK_DIR}" ) + foreach(prefix IN LISTS WINUAE_LZMA_SDK_SYSTEM_PATHS) + list(APPEND WINUAE_LZMA_SDK_CANDIDATES "${prefix}/C" "${prefix}") + endforeach() foreach(candidate IN LISTS WINUAE_LZMA_SDK_CANDIDATES) - if(EXISTS "${candidate}/7z/7zVersion.h") + if(EXISTS "${candidate}/7z/7zVersion.h" AND EXISTS "${candidate}/7z/7zCrc.c") set(WINUAE_LZMA_SDK_SOURCE_DIR "${candidate}") break() endif() @@ -195,6 +201,9 @@ set(WINUAE_LZMA_SDK_SHA256 "edf8690e9d5ae0dbe80751e3df247bb4e1b497b100c4af5b95fc CACHE STRING "Expected SHA-256 for the 7-Zip/LZMA SDK archive") set(WINUAE_LZMA_SDK_DIR "${CMAKE_BINARY_DIR}/_deps/lzma-sdk/${WINUAE_LZMA_SDK_VERSION}" CACHE PATH "Local cache directory for the 7-Zip/LZMA SDK") +set(WINUAE_LZMA_SDK_SYSTEM_PATHS + "/usr/share/lzma-sdk;/usr/include/lzma-sdk;/usr/src/lzma-sdk;/usr/include/lzma" + CACHE STRING "System prefixes probed for an installed 7-Zip/LZMA SDK source tree") set(WINUAE_QEMU_UAE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../qemu-uae-v11.0" CACHE PATH "QEMU-UAE plugin source directory") diff --git a/README_unix.md b/README_unix.md index 5db82e12..368114d9 100644 --- a/README_unix.md +++ b/README_unix.md @@ -177,6 +177,13 @@ options can be passed after `--`, for example: tools/debian-build-package.sh -- -DWINUAE_UNIX_WITH_QT_UI=OFF ``` +Archive and CHD support compile the 7-Zip/LZMA SDK sources. A system SDK +source package (for example the openSUSE `lzma-sdk-devel` package) is used +when found under `WINUAE_LZMA_SDK_SYSTEM_PATHS` (or an explicit +`-DWINUAE_LZMA_SDK_DIR=`); otherwise `WINUAE_LZMA_SDK_FETCH` downloads the +SHA-verified `lzma1604.7z` archive. Pass `-DWINUAE_LZMA_SDK_FETCH=OFF` for +offline distribution builds. + To build a package from a prebuilt QEMU-UAE plugin, pass: ```sh -- 2.47.3