package_linux_bin.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. chown -R root:root vscode
  9. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  10. export VSCODE_SKIP_NODE_VERSION_CHECK=1
  11. export VSCODE_SYSROOT_PREFIX='-glibc-2.17'
  12. if [[ "${VSCODE_ARCH}" == "arm64" || "${VSCODE_ARCH}" == "armhf" ]]; then
  13. export VSCODE_SKIP_SYSROOT=1
  14. export USE_GNUPP2A=1
  15. elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  16. export VSCODE_SYSROOT_REPOSITORY='VSCodium/vscode-linux-build-agent'
  17. export VSCODE_SYSROOT_VERSION='20240129-253798'
  18. export VSCODE_SYSROOT_PREFIX='-glibc-2.28'
  19. export USE_GNUPP2A=1
  20. elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
  21. export VSCODE_ELECTRON_REPOSITORY='riscv-forks/electron-riscv-releases'
  22. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  23. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  24. export VSCODE_SKIP_SETUPENV=1
  25. fi
  26. if [[ -f "../electron_linux_${VSCODE_ARCH}.sh" ]]; then
  27. # shellcheck disable=SC1090
  28. source "../electron_linux_${VSCODE_ARCH}.sh"
  29. if [[ "${ELECTRON_VERSION}" != "$( yarn config get target )" ]]; then
  30. # Fail the pipeline if electron target doesn't match what is used.
  31. echo "Electron ${VSCODE_ARCH} binary version doesn't match target electron version!"
  32. echo "Releases available at: https://github.com/${VSCODE_ELECTRON_REPOSITORY}/releases"
  33. exit 1
  34. fi
  35. fi
  36. if [[ -d "../patches/linux/client/" ]]; then
  37. for file in "../patches/linux/client/"*.patch; do
  38. if [[ -f "${file}" ]]; then
  39. echo applying patch: "${file}";
  40. if ! git apply --ignore-whitespace "${file}"; then
  41. echo failed to apply patch "${file}" >&2
  42. exit 1
  43. fi
  44. fi
  45. done
  46. fi
  47. if [[ -n "${USE_GNUPP2A}" ]]; then
  48. INCLUDES=$(cat <<EOF
  49. {
  50. "target_defaults": {
  51. "conditions": [
  52. ["OS=='linux'", {
  53. 'cflags_cc!': [ '-std=gnu++20' ],
  54. 'cflags_cc': [ '-std=gnu++2a' ],
  55. }]
  56. ]
  57. }
  58. }
  59. EOF
  60. )
  61. if [ ! -d "$HOME/.gyp" ]; then
  62. mkdir -p "$HOME/.gyp"
  63. fi
  64. echo "${INCLUDES}" > "$HOME/.gyp/include.gypi"
  65. fi
  66. for i in {1..5}; do # try 5 times
  67. npm ci --prefix build && break
  68. if [[ $i == 3 ]]; then
  69. echo "Npm install failed too many times" >&2
  70. exit 1
  71. fi
  72. echo "Npm install failed $i, trying again..."
  73. done
  74. if [[ -z "${VSCODE_SKIP_SETUPENV}" ]]; then
  75. if [[ -n "${VSCODE_SKIP_SYSROOT}" ]]; then
  76. source ./build/azure-pipelines/linux/setup-env.sh --skip-sysroot
  77. else
  78. source ./build/azure-pipelines/linux/setup-env.sh
  79. fi
  80. fi
  81. for i in {1..5}; do # try 5 times
  82. npm ci && break
  83. if [[ $i -eq 3 ]]; then
  84. echo "Npm install failed too many times" >&2
  85. exit 1
  86. fi
  87. echo "Npm install failed $i, trying again..."
  88. done
  89. node build/azure-pipelines/distro/mixin-npm
  90. yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci"
  91. find "../VSCode-linux-${VSCODE_ARCH}" -print0 | xargs -0 touch -c
  92. cd ..