Commit 3e0584ba authored by Ben Boeckel's avatar Ben Boeckel

ci: update scripts with macOS support

parent 0d89c256
......@@ -3,14 +3,38 @@
set -e
readonly version="3.17.3"
readonly sha256sum="da8093956f0b4ae30293c9db498da9bdeaeea4e7a2b1f2d1637ddda064d06dd0"
readonly filename="cmake-$version-Linux-x86_64"
case "$( uname -s )" in
Linux)
shatool="sha256sum"
sha256sum="da8093956f0b4ae30293c9db498da9bdeaeea4e7a2b1f2d1637ddda064d06dd0"
platform="Linux"
;;
Darwin)
shatool="shasum -a 256"
sha256sum="2ad1413510681b041ec305923c6ccbc64b0fed6608df82f5543577f7b4b88305"
platform="Darwin"
;;
*)
echo "Unrecognized platform $( uname -s )"
exit 1
;;
esac
readonly shatool
readonly sha256sum
readonly platform
readonly filename="cmake-$version-$platform-x86_64"
readonly tarball="$filename.tar.gz"
cd .gitlab
echo "$sha256sum $tarball" > cmake.sha256sum
curl -OL "https://github.com/Kitware/CMake/releases/download/v$version/$tarball"
sha256sum --check cmake.sha256sum
$shatool --check cmake.sha256sum
tar xf "$tarball"
mv "$filename" cmake
if [ "$( uname -s )" = "Darwin" ]; then
ln -s CMake.app/Contents/bin cmake/bin
fi
set(CMAKE_C_COMPILER_LAUNCHER "sccache" CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER "sccache" CACHE STRING "")
if (NOT "$ENV{CMAKE_CONFIGURATION}" MATCHES "macos")
set(CMAKE_C_COMPILER_LAUNCHER "sccache" CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER "sccache" CACHE STRING "")
endif ()
cmake_minimum_required(VERSION 3.12)
# Input variables.
set(qt_version_major "5")
set(qt_version_minor "15")
set(qt_version_patch "0")
# This URL is only visible inside of Kitware's network. Please use your own Qt
# Account to obtain these files.
set(qt_url_root "https://paraview.org/files/dependencies/internal/qt")
# Determine the ABI to fetch for Qt.
if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2015")
set(qt_platform "windows_x86")
set(msvc_year "2015")
set(qt_abi "win64_msvc${msvc_year}_64")
elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2017" OR
"$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2019")
set(qt_platform "windows_x86")
set(msvc_year "2017")
set(qt_abi "win64_msvc${msvc_year}_64")
elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos")
set(qt_platform "mac_x64")
set(qt_abi "clang_64")
else ()
message(FATAL_ERROR
"Unknown ABI to use for Qt")
endif ()
# Combined version variables.
set(qt_version "${qt_version_major}.${qt_version_minor}.${qt_version_patch}")
set(qt_version_nodot "${qt_version_major}${qt_version_minor}${qt_version_patch}")
# Files needed to download.
set(qt_files)
if (qt_platform STREQUAL "windows_x86")
if (msvc_year STREQUAL "2017")
set(qt_build_stamp "202002260536")
elseif (msvc_year STREQUAL "2015")
set(qt_build_stamp "202005150700")
else ()
message(FATAL_ERROR
"Build stamp for MSVC ${msvc_year} is unknown")
endif ()
set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}")
list(APPEND qt_files
"${qt_file_name_prefix}d3dcompiler_47-x64.7z"
"${qt_file_name_prefix}opengl32sw-64-mesa_12_0_rc2.7z")
foreach (qt_component IN ITEMS qtbase qtsvg qttools qtxmlpatterns)
list(APPEND qt_files
"${qt_file_name_prefix}${qt_component}-Windows-Windows_10-MSVC${msvc_year}-Windows-Windows_10-X86_64.7z")
endforeach ()
set(qt_subdir "${qt_version}/msvc${msvc_year}_64")
elseif (qt_platform STREQUAL "mac_x64")
set(qt_build_stamp "202005140805")
set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}")
foreach (qt_component IN ITEMS qtbase qtsvg qttools qtxmlpatterns)
list(APPEND qt_files
"${qt_file_name_prefix}${qt_component}-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z")
endforeach ()
set(qt_subdir "${qt_version}/clang_64")
else ()
message(FATAL_ERROR
"Unknown files for ${qt_platform}")
endif ()
# Verify that we know what directory will be extracted.
if (NOT qt_subdir)
message(FATAL_ERROR
"The extracted subdirectory is not set")
endif ()
# Build up the path to the file to download.
set(qt_url_path "${qt_platform}/desktop/qt5_${qt_version_nodot}/qt.qt5.${qt_version_nodot}.${qt_abi}")
set(qt_url_prefix "${qt_url_root}/${qt_url_path}")
# Include the file containing the hashes of the files that matter.
include("${CMAKE_CURRENT_LIST_DIR}/download_qt_hashes.cmake")
# Download and extract each file.
foreach (qt_file IN LISTS qt_files)
# Ensure we have a hash to verify.
if (NOT DEFINED "${qt_file}_hash")
message(FATAL_ERROR
"Unknown hash for ${qt_file}")
endif ()
# Download the file.
file(DOWNLOAD
"${qt_url_prefix}/${qt_file}"
".gitlab/${qt_file}"
STATUS download_status
EXPECTED_HASH "SHA256=${${qt_file}_hash}")
# Check the download status.
list(GET download_status 0 res)
if (res)
list(GET download_status 1 err)
message(FATAL_ERROR
"Failed to download ${qt_file}: ${err}")
endif ()
# Extract the file.
execute_process(
COMMAND
"${CMAKE_COMMAND}"
-E tar
xf "${qt_file}"
WORKING_DIRECTORY ".gitlab"
RESULT_VARIABLE res
ERROR_VARIABLE err
ERROR_STRIP_TRAILING_WHITESPACE)
if (res)
message(FATAL_ERROR
"Failed to extract ${qt_file}: ${err}")
endif ()
endforeach ()
# The Windows tarballs have some unfortunate permissions in them that prevent
# deletion when `git clean -ffdx` tries to clean up the directory.
if (qt_platform STREQUAL "windows_x86")
# Fix permissions.
file(TO_NATIVE_PATH ".gitlab/${qt_subdir}/*.*" native_qt_dir)
execute_process(
# Remove any read-only flags that aren't affected by `icacls`.
COMMAND
attrib
-r # Remove readonly flag
"${native_qt_dir}"
/d # Treat as a directory
/s # Recursive
/l # Don't dereference symlinks
RESULT_VARIABLE res
ERROR_VARIABLE err
ERROR_STRIP_TRAILING_WHITESPACE)
if (res)
message(FATAL_ERROR
"Failed to fix remove read-only flags in ${qt_file}: ${err}")
endif ()
endif ()
# Move to a predictable prefix.
file(RENAME
".gitlab/${qt_subdir}"
".gitlab/qt")
# Lines can be generated by doing:
#
# sha256sum $files | awk '{ print "set(\"" $2 "_hash\" " $1 ")" }' >> $thisfile
set("5.15.0-0-202002260536d3dcompiler_47-x64.7z_hash" 428a8b5d74b31d42a234d9ddc05a1f13f9a651b0798094215b25263108983a95)
set("5.15.0-0-202002260536opengl32sw-64-mesa_12_0_rc2.7z_hash" dd40f61374ba988afabcb239713a10504816d7afc2997707c7ebcbe57eb30112)
set("5.15.0-0-202002260536qtbase-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z_hash" c041596be8f7a16c7be9ea6757c14766ff3200ab6d56f7db8f865dbfe039fe20)
set("5.15.0-0-202002260536qtsvg-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z_hash" 5c29598c8b9251536a9a2679dbabce20628c6cd51a66d9fe9d68ddbe0c69c172)
set("5.15.0-0-202002260536qttools-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z_hash" ba02878360ca11c90b7c7581a673383a698d17f771d672070af9330b6b789586)
set("5.15.0-0-202002260536qtxmlpatterns-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z_hash" 56abd417c82d3f1327b8f60d1a7bccdfd1d34c3fea110a91d9d13d7e01fb76e3)
set("5.15.0-0-202005150700d3dcompiler_47-x64.7z_hash" 45b4c38886ef42368b62bdb9cec2e06fc3a68bc94696fdf2f83c9bdf29b0161f)
set("5.15.0-0-202005150700opengl32sw-64-mesa_12_0_rc2.7z_hash" 2f94c5315fccfa51bc547dc5eec7612dbc0646f12e4511bbc81f921066a1c245)
set("5.15.0-0-202005150700qtbase-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 0c2653c5eca256f59c0b48b537cd633b05560e4241c0226856d2ae22ab066df4)
set("5.15.0-0-202005150700qtsvg-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 12a32da7bbca6d1adc8702088205ca96b806337ee7e6a134658c592754b6b468)
set("5.15.0-0-202005150700qttools-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 976d87ede6d03cd0ebd025e5769cf9ce76c625fa2e19de6ea5f9e74d8f11cafd)
set("5.15.0-0-202005150700qtxmlpatterns-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 50e7e7c4c6ad558037bb6561406bca47d16ad56bfbd16219325006a628cc7f14)
set("5.15.0-0-202005140805qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 04d867c81d2431f288c42c9752642759460b9468477de349368dcc8de0c8ddc4)
set("5.15.0-0-202005140805qtsvg-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 578fab3a9b5fd945f30f3d82bdbe8203a904fe4a215fef82997d431680cb3f8f)
set("5.15.0-0-202005140805qttools-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 1858dae8848bc93f943a17b76a45ec3fe0e8c3be41b6ce7f46cdff14addbae78)
set("5.15.0-0-202005140805qtxmlpatterns-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" e083217bd03129d8524c5c3b7d98c2048c6c119f1ba3965fff147357f8e3d7d8)
cmake_minimum_required(VERSION 3.12)
# In order to use a new superbuild, please copy the item from the date stamped
# directory into the `keep` directory. This ensure that new versions will not
# be removed by the uploader script and preserve them for debugging in the
# future.
set(data_host "https://data.kitware.com")
# Determine the tarball to download.
if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos")
# 20200912
set(file_item "5f74716e50a41e3d19bb5ef4")
set(file_hash "26832c678d2c41f247005c0d56736933cbf12a3fed8db9449def49dbce598c8f332f070c2932ceeefeface273e32a4b323a578408fe13c9a64361a14e96d0101")
else ()
message(FATAL_ERROR
"Unknown build to use for the superbuild")
endif ()
# Ensure we have a hash to verify.
if (NOT DEFINED file_item OR NOT DEFINED file_hash)
message(FATAL_ERROR
"Unknown file and hash for the superbuild")
endif ()
# Download the file.
file(DOWNLOAD
"${data_host}/api/v1/item/${file_item}/download"
".gitlab/superbuild.tar.gz"
STATUS download_status
EXPECTED_HASH "SHA512=${file_hash}")
# Check the download status.
list(GET download_status 0 res)
if (res)
list(GET download_status 1 err)
message(FATAL_ERROR
"Failed to download superbuild.tar.gz: ${err}")
endif ()
# Extract the file.
execute_process(
COMMAND
"${CMAKE_COMMAND}"
-E tar
xf ".gitlab/superbuild.tar.gz"
RESULT_VARIABLE res
ERROR_VARIABLE err
ERROR_STRIP_TRAILING_WHITESPACE)
if (res)
message(FATAL_ERROR
"Failed to extract superbuild.tar.gz: ${err}")
endif ()
......@@ -3,13 +3,33 @@
set -e
readonly version="1.10.0"
readonly sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82"
readonly filename="ninja-linux"
case "$( uname -s )" in
Linux)
shatool="sha256sum"
sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82"
platform="linux"
;;
Darwin)
shatool="shasum -a 256"
sha256sum="2ee405c0e205d55666c60cc9c0d8d04c8ede06d3ef2e2c2aabe08fd81c17d22e"
platform="mac"
;;
*)
echo "Unrecognized platform $( uname -s )"
exit 1
;;
esac
readonly shatool
readonly sha256sum
readonly platform
readonly filename="ninja-$platform"
readonly tarball="$filename.zip"
cd .gitlab
echo "$sha256sum $tarball" > ninja.sha256sum
curl -OL "https://github.com/ninja-build/ninja/releases/download/v$version/$tarball"
sha256sum --check ninja.sha256sum
$shatool --check ninja.sha256sum
./cmake/bin/cmake -E tar xf "$tarball"
......@@ -3,14 +3,34 @@
set -e
readonly version="0.2.13"
readonly sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb"
readonly filename="sccache-$version-x86_64-unknown-linux-musl"
case "$( uname -s )" in
Linux)
shatool="sha256sum"
sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb"
platform="x86_64-unknown-linux-musl"
;;
Darwin)
shatool="shasum -a 256"
sha256sum="f564e948abadfc9e409eb1cd7babf24c6784057d5506c3b0a04cdd37cd830ae9"
platform="x86_64-apple-darwin"
;;
*)
echo "Unrecognized platform $( uname -s )"
exit 1
;;
esac
readonly shatool
readonly sha256sum
readonly platform
readonly filename="sccache-$version-$platform"
readonly tarball="$filename.tar.gz"
cd .gitlab
echo "$sha256sum $tarball" > sccache.sha256sum
curl -OL "https://github.com/mozilla/sccache/releases/download/$version/$tarball"
sha256sum --check sccache.sha256sum
$shatool --check sccache.sha256sum
tar xf "$tarball"
mv "$filename/sccache" .
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment