diff --git a/.github/vcpkg-overlays/libaec/portfile.cmake b/.github/vcpkg-overlays/libaec/portfile.cmake new file mode 100644 index 00000000..e04dabea --- /dev/null +++ b/.github/vcpkg-overlays/libaec/portfile.cmake @@ -0,0 +1,64 @@ +# Overlay of the upstream vcpkg `libaec` port, identical to the port at our +# pinned vcpkg baseline except for where the sources come from. +# +# Upstream fetches from https://gitlab.dkrz.de/k202009/libaec. That host now +# answers every request to its /-/archive/ tarball endpoint with a bare +# nginx "429 Too Many Requests" (no Retry-After), so any cold vcpkg build +# fails there and no amount of retrying gets past it. The repository web +# pages still serve 200 — it is specifically the archive endpoint that is +# rate limited. +# +# libaec reaches us only as a transitive dependency: vtk -> hdf5 -> (szip +# feature) -> libaec, so it cannot simply be dropped. +# +# MathisRosenhauer/libaec on GitHub is the upstream author's mirror of the +# same project. The SHA512 below is of GitHub's v1.1.6 tarball, which is a +# different archive from GitLab's and therefore has a different hash than +# upstream's portfile records. +# +# Remove this overlay once gitlab.dkrz.de serves archives again. + +vcpkg_from_github( + OUT_SOURCE_PATH + SOURCE_PATH + REPO + MathisRosenhauer/libaec + REF + "v${VERSION}" + SHA512 + 76df7501d1b7d91a43b525ba828f092f18d83f8ab09a9331e5758f93942a9758ad580baca8f9316b92a98639bde2e23cacbc2f33f52d0dd98ce7efe412cf43cd + HEAD_REF + master) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) + +vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DBUILD_STATIC_LIBS=${BUILD_STATIC} + -Dlibaec_INSTALL_CMAKEDIR=share/${PORT}) +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup() +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/libaec/libaec-config.cmake" + "if(libaec_USE_STATIC_LIBS)" "if(\"${BUILD_STATIC}\") # forced by vcpkg") + +# Compatibility with user's CMake < 3.18 (vcpkg claims support for >= 3.16): +# Make imported targets global so that libaec-config.cmake can create ALIAS targets. +set(_target_file "libaec_shared-targets") +if(BUILD_STATIC) + set(_target_file "libaec_static-targets") +endif() +file(READ "${CURRENT_PACKAGES_DIR}/share/libaec/${_target_file}.cmake" libaec_targets) +string(REGEX REPLACE " (SHARED|STATIC) IMPORTED" " \\1 IMPORTED \${libaec_maybe_global}" + libaec_targets "${libaec_targets}") +file( + WRITE "${CURRENT_PACKAGES_DIR}/share/libaec/${_target_file}.cmake" + "set(libaec_maybe_global \"\") +if(CMAKE_VERSION VERSION_LESS 3.18) + set(libaec_maybe_global \"GLOBAL\") +endif() +${libaec_targets} +") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/.github/vcpkg-overlays/libaec/usage b/.github/vcpkg-overlays/libaec/usage new file mode 100644 index 00000000..a6aeb5f6 --- /dev/null +++ b/.github/vcpkg-overlays/libaec/usage @@ -0,0 +1,7 @@ +libaec provides CMake targets: + + find_package(libaec CONFIG REQUIRED) + # libaec API + target_link_libraries(main PRIVATE libaec::aec) + # szip compatible API + target_link_libraries(main PRIVATE libaec::sz) diff --git a/.github/vcpkg-overlays/libaec/vcpkg.json b/.github/vcpkg-overlays/libaec/vcpkg.json new file mode 100644 index 00000000..299cd632 --- /dev/null +++ b/.github/vcpkg-overlays/libaec/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "libaec", + "version": "1.1.6", + "description": "Adaptive Entropy Coding library", + "homepage": "https://github.com/MathisRosenhauer/libaec", + "license": "BSD-2-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d24b799..6ffad122 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,7 +78,11 @@ jobs: if: ${{ matrix.os == 'windows-latest' && steps.vcpkg-installed-cache.outputs.cache-hit != 'true' }} shell: pwsh run: | - ./vcpkg/vcpkg install --triplet x64-windows + # The libaec overlay sources that port from GitHub instead of + # gitlab.dkrz.de, whose archive endpoint returns 429 to everyone. + # See .github/vcpkg-overlays/libaec/portfile.cmake. + ./vcpkg/vcpkg install --triplet x64-windows ` + --overlay-ports="${{ github.workspace }}/.github/vcpkg-overlays" - name: 🏗️ Compile (Windows) if: ${{ matrix.os == 'windows-latest' }} diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 997fc4b2..6ad060dc 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -75,7 +75,11 @@ jobs: if: ${{ matrix.os == 'windows-latest' && steps.vcpkg-installed-cache.outputs.cache-hit != 'true' }} shell: pwsh run: | - ./vcpkg/vcpkg install --triplet x64-windows + # The libaec overlay sources that port from GitHub instead of + # gitlab.dkrz.de, whose archive endpoint returns 429 to everyone. + # See .github/vcpkg-overlays/libaec/portfile.cmake. + ./vcpkg/vcpkg install --triplet x64-windows ` + --overlay-ports="${{ github.workspace }}/.github/vcpkg-overlays" - name: 🐍 Build and check Python Module (Windows) if: ${{ matrix.os == 'windows-latest' }} @@ -153,24 +157,21 @@ jobs: env: CIBW_SKIP: ${{ matrix.skip }} CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/viennatools/vienna-builder:cuda-python - CIBW_REPAIR_WHEEL_COMMAND_LINUX: >- - auditwheel repair - --exclude libcuda.so.1 - --exclude libcudart.so.12 - --exclude libcusparse.so.12 - --exclude libnvJitLink.so.12 - -w {dest_dir} {wheel} CIBW_TEST_COMMAND: >- python -c "import viennals; print(viennals.__file__); print(viennals.d2); print(viennals.d3)" + # VIENNALS_USE_GPU is deliberately OFF for wheels: it puts hard + # DT_NEEDED entries for libcudart/libcusparse on _core.so, and those + # are far too large to vendor (libcusparse alone is >160 MB, over the + # PyPI file limit). The wheel would then fail to import on any machine + # without a CUDA toolkit. GPU users build from source with + # -DVIENNALS_USE_GPU=ON. CIBW_CONFIG_SETTINGS: >- cmake.define.VIENNALS_PACKAGE_PYTHON=ON cmake.define.VIENNALS_IS_CI=ON cmake.define.VIENNALS_VTK_RENDERING=ON - cmake.define.VIENNALS_USE_GPU=ON - cmake.define.VIENNACORE_LINK_CUDA_DRIVER=OFF cmake.define.USE_IPO=OFF - name: 🏗️ Build Wheels (Other)