package_linux_reh.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/usr/bin/env bash
  2. # shellcheck disable=SC1091
  3. set -ex
  4. if [[ "${CI_BUILD}" == "no" ]]; then
  5. exit 1
  6. fi
  7. tar -xzf ./vscode.tar.gz
  8. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  9. GLIBC_VERSION="2.17"
  10. if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  11. GLIBC_VERSION="2.28"
  12. fi
  13. export VSCODE_PLATFORM='linux'
  14. export VSCODE_SKIP_NODE_VERSION_CHECK=1
  15. export VSCODE_SYSROOT_PREFIX="-glibc-${GLIBC_VERSION}"
  16. VSCODE_HOST_MOUNT="$( pwd )"
  17. export VSCODE_HOST_MOUNT
  18. if [[ "${VSCODE_ARCH}" == "x64" || "${VSCODE_ARCH}" == "arm64" ]]; then
  19. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:centos7-devtoolset8-${VSCODE_ARCH}"
  20. elif [[ "${VSCODE_ARCH}" == "armhf" ]]; then
  21. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:bionic-devtoolset-arm32v7"
  22. elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  23. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:bionic-devtoolset-ppc64le"
  24. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  25. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  26. export VSCODE_SYSROOT_REPO='VSCodium/vscode-linux-build-agent'
  27. export VSCODE_SYSROOT_VERSION='20240129-253798'
  28. elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
  29. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:focal-devtoolset-riscv64"
  30. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  31. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  32. # Unofficial RISC-V nodejs builds doesn't provide v16.x
  33. sed -i '/target/s/"16.*"/"18.18.1"/' remote/.yarnrc
  34. fi
  35. export VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME
  36. for i in {1..5}; do # try 5 times
  37. yarn --cwd build --frozen-lockfile --check-files && break
  38. if [[ $i == 3 ]]; then
  39. echo "Yarn failed too many times" >&2
  40. exit 1
  41. fi
  42. echo "Yarn failed $i, trying again..."
  43. done
  44. if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  45. source ./build/azure-pipelines/linux/setup-env.sh
  46. else
  47. ./build/azure-pipelines/linux/setup-env.sh --only-remote
  48. fi
  49. for i in {1..5}; do # try 5 times
  50. yarn --frozen-lockfile --check-files && break
  51. if [ $i -eq 3 ]; then
  52. echo "Yarn failed too many times" >&2
  53. exit 1
  54. fi
  55. echo "Yarn failed $i, trying again..."
  56. done
  57. EXPECTED_GLIBC_VERSION="${GLIBC_VERSION}" EXPECTED_GLIBCXX_VERSION="3.4.22" ./build/azure-pipelines/linux/verify-glibc-requirements.sh
  58. node build/azure-pipelines/distro/mixin-npm
  59. export VSCODE_NODE_GLIBC="-glibc-${GLIBC_VERSION}"
  60. yarn gulp minify-vscode-reh
  61. yarn gulp "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-min-ci"
  62. cd ..
  63. APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
  64. mkdir -p assets
  65. echo "Building and moving REH"
  66. cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
  67. tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  68. cd ..
  69. npm install -g checksum
  70. sum_file() {
  71. if [[ -f "${1}" ]]; then
  72. echo "Calculating checksum for ${1}"
  73. checksum -a sha256 "${1}" > "${1}".sha256
  74. checksum "${1}" > "${1}".sha1
  75. fi
  76. }
  77. cd assets
  78. for FILE in *; do
  79. if [[ -f "${FILE}" ]]; then
  80. sum_file "${FILE}"
  81. fi
  82. done
  83. cd ..