package_linux_reh.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. GLIBCXX_VERSION="3.4.22"
  11. NODE_VERSION="16.20.2"
  12. if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  13. GLIBC_VERSION="2.28"
  14. elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
  15. # Unofficial RISC-V nodejs builds doesn't provide v16.x
  16. NODE_VERSION="18.18.1"
  17. fi
  18. export VSCODE_PLATFORM='linux'
  19. export VSCODE_SKIP_NODE_VERSION_CHECK=1
  20. export VSCODE_SYSROOT_PREFIX="-glibc-${GLIBC_VERSION}"
  21. VSCODE_HOST_MOUNT="$( pwd )"
  22. export VSCODE_HOST_MOUNT
  23. if [[ "${VSCODE_ARCH}" == "x64" || "${VSCODE_ARCH}" == "arm64" ]]; then
  24. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:centos7-devtoolset8-${VSCODE_ARCH}"
  25. elif [[ "${VSCODE_ARCH}" == "armhf" ]]; then
  26. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:bionic-devtoolset-arm32v7"
  27. elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  28. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:bionic-devtoolset-ppc64le"
  29. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  30. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  31. export VSCODE_SYSROOT_REPO='VSCodium/vscode-linux-build-agent'
  32. export VSCODE_SYSROOT_VERSION='20240129-253798'
  33. elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
  34. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:focal-devtoolset-riscv64"
  35. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  36. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  37. fi
  38. export VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME
  39. sed -i "/target/s/\"20.*\"/\"${NODE_VERSION}\"/" remote/.yarnrc
  40. if [[ "${NODE_VERSION}" != 16* ]]; then
  41. if [[ -f "../patches/linux/reh/node16.patch" ]]; then
  42. mv "../patches/linux/reh/node16.patch" "../patches/linux/reh/node16.patch.no"
  43. fi
  44. fi
  45. if [[ -d "../patches/linux/reh/" ]]; then
  46. for file in "../patches/linux/reh/"*.patch; do
  47. if [[ -f "${file}" ]]; then
  48. echo applying patch: "${file}";
  49. if ! git apply --ignore-whitespace "${file}"; then
  50. echo failed to apply patch "${file}" >&2
  51. exit 1
  52. fi
  53. fi
  54. done
  55. fi
  56. for i in {1..5}; do # try 5 times
  57. yarn --cwd build --frozen-lockfile --check-files && break
  58. if [[ $i == 3 ]]; then
  59. echo "Yarn failed too many times" >&2
  60. exit 1
  61. fi
  62. echo "Yarn failed $i, trying again..."
  63. done
  64. if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  65. source ./build/azure-pipelines/linux/setup-env.sh
  66. else
  67. ./build/azure-pipelines/linux/setup-env.sh --only-remote
  68. fi
  69. for i in {1..5}; do # try 5 times
  70. yarn --frozen-lockfile --check-files && break
  71. if [ $i -eq 3 ]; then
  72. echo "Yarn failed too many times" >&2
  73. exit 1
  74. fi
  75. echo "Yarn failed $i, trying again..."
  76. done
  77. node build/azure-pipelines/distro/mixin-npm
  78. export VSCODE_NODE_GLIBC="-glibc-${GLIBC_VERSION}"
  79. yarn gulp minify-vscode-reh
  80. yarn gulp "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-min-ci"
  81. EXPECTED_GLIBC_VERSION="${GLIBC_VERSION}" EXPECTED_GLIBCXX_VERSION="${GLIBCXX_VERSION}" SEARCH_PATH="../vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}" ./build/azure-pipelines/linux/verify-glibc-requirements.sh
  82. cd ..
  83. APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
  84. mkdir -p assets
  85. echo "Building and moving REH"
  86. cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
  87. tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  88. cd ..
  89. npm install -g checksum
  90. sum_file() {
  91. if [[ -f "${1}" ]]; then
  92. echo "Calculating checksum for ${1}"
  93. checksum -a sha256 "${1}" > "${1}".sha256
  94. checksum "${1}" > "${1}".sha1
  95. fi
  96. }
  97. cd assets
  98. for FILE in *; do
  99. if [[ -f "${FILE}" ]]; then
  100. sum_file "${FILE}"
  101. fi
  102. done
  103. cd ..