diff options
Diffstat (limited to 'scripts/cmake/vcpkg_acquire_msys.cmake')
| -rw-r--r-- | scripts/cmake/vcpkg_acquire_msys.cmake | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake index c7d0e8d95..c9c11a7ad 100644 --- a/scripts/cmake/vcpkg_acquire_msys.cmake +++ b/scripts/cmake/vcpkg_acquire_msys.cmake @@ -4,7 +4,7 @@ ## ## ## Usage ## ```cmake -## vcpkg_acquire_msys(<MSYS_ROOT_VAR> [PACKAGES <package>...]) +## vcpkg_acquire_msys(<MSYS_ROOT_VAR> [PACKAGES <package>...] [TIMEOUT <seconds>]) ## ``` ## ## ## Parameters @@ -14,6 +14,9 @@ ## ### PACKAGES ## A list of packages to acquire in msys. ## +## ### TIMEOUT +## Optional timeout to override the default (10 min.) after which installation of PACKAGES is terminated. +## ## To ensure a package is available: `vcpkg_acquire_msys(MSYS_ROOT PACKAGES make automake1.15)` ## ## ## Notes @@ -38,7 +41,13 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) set(TIMESTAMP 20200812) set(TOOLPATH ${DOWNLOADS}/tools/msys2-${TIMESTAMP}) - cmake_parse_arguments(_am "" "" "PACKAGES" ${ARGN}) + cmake_parse_arguments(_am "" "TIMEOUT" "PACKAGES" ${ARGN}) + + if(_am_TIMEOUT) + set(TIMEOUT_PACKAGES "TIMEOUT;${_am_TIMEOUT}") + else() + set(TIMEOUT_PACKAGES "TIMEOUT;600") + endif() if(NOT CMAKE_HOST_WIN32) message(FATAL_ERROR "vcpkg_acquire_msys() can only be used on Windows hosts") @@ -55,7 +64,7 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) set(TOOLSUBPATH msys64) set(URLS "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20190524.tar.xz/download" - "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz" + "https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz" ) set(ARCHIVE "msys2-base-x86_64-20190524.tar.xz") set(HASH 50796072d01d30cc4a02df0f9dafb70e2584462e1341ef0eff94e2542d3f5173f20f81e8f743e9641b7528ea1492edff20ce83cb40c6e292904905abe2a91ccc) @@ -64,7 +73,7 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) set(TOOLSUBPATH msys32) set(URLS "https://sourceforge.net/projects/msys2/files/Base/i686/msys2-base-i686-20190524.tar.xz/download" - "http://repo.msys2.org/distrib/i686/msys2-base-i686-20190524.tar.xz" + "https://repo.msys2.org/distrib/i686/msys2-base-i686-20190524.tar.xz" ) set(ARCHIVE "msys2-base-i686-20190524.tar.xz") set(HASH b26d7d432e1eabe2138c4caac5f0a62670f9dab833b9e91ca94b9e13d29a763323b0d30160f09a381ac442b473482dac799be0fea5dd7b28ea2ddd3ba3cd3c25) @@ -85,12 +94,12 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) # download the new keyring, without it new packages and package updates # might not install vcpkg_download_distfile(KEYRING_PATH - URLS http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz + URLS https://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz FILENAME msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz SHA512 a5023fd17ccf6364bc6e27c5e63aea25f1fc264a5247cbae4008864c828c38c3e0b4de09ded650e28d2e24e319b5fcf7a9c0da0fa3a8ac81679470fc6bd120c9 ) vcpkg_download_distfile(KEYRING_SIG_PATH - URLS http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig + URLS https://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig FILENAME msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig SHA512 c326fefd13f58339afe0d0dc78306aa6ab27cafa8c4d792c2d34aa81fdd1f759d490990ab79daa9664a03a6dfa14ffd2b2ad828bf19a883410112d01f5ed6c4c ) @@ -107,7 +116,7 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) ) # install the new keyring _execute_process( - COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman-key --verify ${KEYRING_SIG_PATH}" + COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman-key --verify \"${KEYRING_SIG_PATH}\"" WORKING_DIRECTORY ${TOOLPATH} RESULT_VARIABLE _vam_error_code ) @@ -115,7 +124,7 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) message(FATAL_ERROR "Cannot verify MSYS2 keyring.") endif() _execute_process( - COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -U ${KEYRING_PATH} --noconfirm" + COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -U \"${KEYRING_PATH}\" --noconfirm" WORKING_DIRECTORY ${TOOLPATH} ) # we have to kill all GnuPG daemons otherwise bash would potentially not be @@ -128,8 +137,9 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) # we need to update pacman before anything else due to pacman transitioning # to using zstd packages, and our pacman is too old to support those _execute_process( - COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Sy pacman --noconfirm" + COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Sy pacman --noconfirm --disable-download-timeout" WORKING_DIRECTORY ${TOOLPATH} + TIMEOUT 600 ) # dash relies on specific versions of the base packages, which prevents us # from doing a proper update. However, we don't need it so we remove it @@ -138,8 +148,9 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) WORKING_DIRECTORY ${TOOLPATH} ) _execute_process( - COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Syu --noconfirm" + COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Syu --noconfirm --disable-download-timeout" WORKING_DIRECTORY ${TOOLPATH} + TIMEOUT 600 ) file(WRITE "${TOOLPATH}/${STAMP}" "0") message(STATUS "Acquiring MSYS2... OK") @@ -153,9 +164,10 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) set(ENV{PATH} ${PATH_TO_ROOT}/usr/bin) vcpkg_execute_required_process( ALLOW_IN_DOWNLOAD_MODE - COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --needed ${_am_PACKAGES}" + COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --disable-download-timeout --needed ${_am_PACKAGES}" WORKING_DIRECTORY ${TOOLPATH} LOGNAME msys-pacman-${TARGET_TRIPLET} + ${TIMEOUT_PACKAGES} ) set(ENV{PATH} "${_ENV_ORIGINAL}") |
