diff --git a/CMakeLists.txt b/CMakeLists.txt index 56ce42f5d8..8c13b50cec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,8 @@ set(ORCA_BUNDLED_UV_EXECUTABLE "" CACHE FILEPATH "Path to a uv executable to bun # be reproducible and the download verified. To upgrade, bump ORCA_UV_VERSION # and refresh every hash below from the release's .sha256 assets, e.g.: # curl -sL https://github.com/astral-sh/uv/releases/download//uv-.tar.gz.sha256 +# The Flatpak copy in scripts/flatpak/com.orcaslicer.OrcaSlicer.yml pins the +# same version and hashes and must be bumped with them. set(ORCA_UV_VERSION "0.11.21") set(ORCA_UV_SHA256_aarch64-apple-darwin "1f921d491ba5ffeea774eb04d6681ecee379101341cbb1500394993b541bf3f4") set(ORCA_UV_SHA256_x86_64-apple-darwin "f3c8e5708a84b920c18b691214d54d2b0da6b984789caae95d47c95120cb7765") @@ -152,6 +154,15 @@ if(ORCA_BUNDLED_UV_EXECUTABLE MATCHES "/\\.uv/") set(ORCA_BUNDLED_UV_EXECUTABLE "" CACHE FILEPATH "Path to the auto-downloaded uv executable" FORCE) endif() +# A Flatpak build has no network and cannot download below: the orca_deps module +# in scripts/flatpak/com.orcaslicer.OrcaSlicer.yml fetches the same pinned uv and +# installs it into the app resources, where the runtime looks for it. +set(ORCA_UV_FLATPAK_BINARY "${CMAKE_INSTALL_FULL_DATAROOTDIR}/OrcaSlicer/tools/uv/uv") +if(FLATPAK AND NOT ORCA_BUNDLED_UV_EXECUTABLE AND EXISTS "${ORCA_UV_FLATPAK_BINARY}") + message(STATUS "Using Flatpak-provided uv: ${ORCA_UV_FLATPAK_BINARY}") + set(ORCA_BUNDLED_UV_EXECUTABLE "${ORCA_UV_FLATPAK_BINARY}") +endif() + if(NOT ORCA_BUNDLED_UV_EXECUTABLE) if(NOT EXISTS "${ORCA_UV_BINARY}") # Select uv by TARGET arch. On macOS universal builds each leg sets a single @@ -195,10 +206,8 @@ if(NOT ORCA_BUNDLED_UV_EXECUTABLE) list(GET ORCA_UV_DL_STATUS 0 ORCA_UV_DL_CODE) list(GET ORCA_UV_DL_STATUS 1 ORCA_UV_DL_MSG) if(NOT ORCA_UV_DL_CODE EQUAL 0) - # Network failure keeps the historical graceful degradation (uv is - # optional at build time) -- but a hash mismatch below is fatal. - message(WARNING "Failed to download uv: ${ORCA_UV_DL_MSG}") file(REMOVE "${ORCA_UV_ARCHIVE}") + message(FATAL_ERROR "Failed to download uv: ${ORCA_UV_DL_MSG}") else() file(SHA256 "${ORCA_UV_ARCHIVE}" _orca_uv_actual_sha256) if(NOT _orca_uv_actual_sha256 STREQUAL "${ORCA_UV_SHA256_${ORCA_UV_ARCH}}") @@ -1301,7 +1310,13 @@ elseif (SLIC3R_FHS) PATTERN "*/udev" EXCLUDE ) if(ORCA_BUNDLED_UV_EXECUTABLE) - install(PROGRAMS "${ORCA_BUNDLED_UV_EXECUTABLE}" DESTINATION "${SLIC3R_FHS_RESOURCES}/tools/uv" RENAME "${ORCA_BUNDLED_UV_FILENAME}") + # A Flatpak build finds uv at this exact path, installed by the orca_deps + # module before this one configures (see ORCA_UV_FLATPAK_BINARY above). + # Installing it there again would copy the file onto itself. + set(_orca_uv_fhs_binary "${SLIC3R_FHS_RESOURCES}/tools/uv/${ORCA_BUNDLED_UV_FILENAME}") + if(NOT ORCA_BUNDLED_UV_EXECUTABLE_CONFIG STREQUAL _orca_uv_fhs_binary) + install(PROGRAMS "${ORCA_BUNDLED_UV_EXECUTABLE}" DESTINATION "${SLIC3R_FHS_RESOURCES}/tools/uv" RENAME "${ORCA_BUNDLED_UV_FILENAME}") + endif() endif() install(FILES src/dev-utils/platform/unix/com.orcaslicer.OrcaSlicer.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) foreach(SIZE 32 128 192) diff --git a/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml b/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml index e624878561..1a18bf7766 100644 --- a/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml +++ b/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml @@ -143,6 +143,12 @@ modules: - cmake --build $BUILD_DIR --parallel - rm -rf /run/build/orca_deps/external-packages + # uv runs from the app resources at runtime and CMake finds it there + # instead of downloading it (no network in the build sandbox). It has to + # be in place before the OrcaSlicer module configures, which this module + # always precedes. + - install -Dm755 uv/uv /app/share/OrcaSlicer/tools/uv/uv + cleanup: - /include - "*.a" @@ -342,6 +348,27 @@ modules: sha256: 1b4c2cb6cba1ca5e53b9e85eeeab02154cab4b70894c96e97a9c747a26d19d63 dest: external-packages/JPEG + # --------------------------------------------------------------- + # uv 0.11.21, pinned per arch (only the matching one is fetched). + # Keep the version and hashes in sync with ORCA_UV_VERSION and + # ORCA_UV_SHA256_* in CMakeLists.txt. Installed by the build commands + # above; CMake uses that copy instead of downloading its own, because + # the build sandbox has no network. + # --------------------------------------------------------------- + - type: archive + url: https://github.com/astral-sh/uv/releases/download/0.11.21/uv-x86_64-unknown-linux-gnu.tar.gz + sha256: 8c88519b0ef0af9801fcdee419bbb12116bd9e6b18e162ae093c932d8b264050 + only-arches: + - x86_64 + dest: uv + + - type: archive + url: https://github.com/astral-sh/uv/releases/download/0.11.21/uv-aarch64-unknown-linux-gnu.tar.gz + sha256: 88e800834007cc5efd4675f166eb2a51e7e3ad19876d85fa8805a6fb5c922397 + only-arches: + - aarch64 + dest: uv + - name: OrcaSlicer buildsystem: simple build-commands: