]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
cmake: probe for a system 7-Zip/LZMA SDK before fetching
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Fri, 12 Jun 2026 15:23:15 +0000 (08:23 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Wed, 17 Jun 2026 19:27:31 +0000 (12:27 -0700)
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
README_unix.md

index b71c1e8fcca17e68a6c9e2fb2c9d98439c9b1b8a..4569b4daeb91af055dcc0be5d9ddaada6135f16f 100644 (file)
@@ -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")
index 5db82e1203bc16013d58970708e292945411db6e..368114d9e00ab8f969dbd3c92649221225e2f4c4 100644 (file)
@@ -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