2
0

package_bin.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/usr/bin/env bash
  2. # shellcheck disable=SC1091
  3. set -ex
  4. if [[ "${CI_BUILD}" == "no" ]]; then
  5. exit 1
  6. fi
  7. # include common functions
  8. . ./utils.sh
  9. tar -xzf ./vscode.tar.gz
  10. chown -R root:root vscode
  11. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  12. export VSCODE_PLATFORM='linux'
  13. export VSCODE_SKIP_NODE_VERSION_CHECK=1
  14. export VSCODE_SYSROOT_PREFIX='-glibc-2.17'
  15. if [[ "${VSCODE_ARCH}" == "arm64" || "${VSCODE_ARCH}" == "armhf" ]]; then
  16. export VSCODE_SKIP_SYSROOT=1
  17. export USE_GNUPP2A=1
  18. elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  19. export VSCODE_SYSROOT_REPOSITORY='VSCodium/vscode-linux-build-agent'
  20. export VSCODE_SYSROOT_VERSION='20240129-253798'
  21. export VSCODE_SYSROOT_PREFIX='-glibc-2.28'
  22. export USE_GNUPP2A=1
  23. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  24. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  25. export VSCODE_SKIP_SETUPENV=1
  26. export VSCODE_ELECTRON_REPOSITORY='lex-ibm/electron-ppc64le-build-scripts'
  27. elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
  28. export VSCODE_ELECTRON_REPOSITORY='riscv-forks/electron-riscv-releases'
  29. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  30. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  31. export VSCODE_SKIP_SETUPENV=1
  32. elif [[ "${VSCODE_ARCH}" == "loong64" ]]; then
  33. export VSCODE_ELECTRON_REPOSITORY='darkyzhou/electron-loong64'
  34. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  35. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  36. export VSCODE_SKIP_SETUPENV=1
  37. fi
  38. if [[ -f "../build/linux/${VSCODE_ARCH}/electron.sh" ]]; then
  39. # add newline at the end of the file
  40. echo "" >> build/checksums/electron.txt
  41. if [[ -f "../build/linux/${VSCODE_ARCH}/electron.sha256sums" ]]; then
  42. cat "../build/linux/${VSCODE_ARCH}/electron.sha256sums" >> build/checksums/electron.txt
  43. fi
  44. # shellcheck disable=SC1090
  45. source "../build/linux/${VSCODE_ARCH}/electron.sh"
  46. if [[ "${ELECTRON_VERSION}" != "$( yarn config get target )" ]]; then
  47. # Fail the pipeline if electron target doesn't match what is used.
  48. echo "Electron ${VSCODE_ARCH} binary version doesn't match target electron version!"
  49. echo "Releases available at: https://github.com/${VSCODE_ELECTRON_REPOSITORY}/releases"
  50. exit 1
  51. fi
  52. fi
  53. if [[ -d "../patches/linux/client/" ]]; then
  54. for file in "../patches/linux/client/"*.patch; do
  55. if [[ -f "${file}" ]]; then
  56. apply_patch "${file}"
  57. fi
  58. done
  59. fi
  60. if [[ -n "${USE_GNUPP2A}" ]]; then
  61. INCLUDES=$(cat <<EOF
  62. {
  63. "target_defaults": {
  64. "conditions": [
  65. ["OS=='linux'", {
  66. 'cflags_cc!': [ '-std=gnu++20' ],
  67. 'cflags_cc': [ '-std=gnu++2a' ],
  68. }]
  69. ]
  70. }
  71. }
  72. EOF
  73. )
  74. if [ ! -d "$HOME/.gyp" ]; then
  75. mkdir -p "$HOME/.gyp"
  76. fi
  77. echo "${INCLUDES}" > "$HOME/.gyp/include.gypi"
  78. fi
  79. for i in {1..5}; do # try 5 times
  80. npm ci --prefix build && break
  81. if [[ $i == 3 ]]; then
  82. echo "Npm install failed too many times" >&2
  83. exit 1
  84. fi
  85. echo "Npm install failed $i, trying again..."
  86. done
  87. if [[ -z "${VSCODE_SKIP_SETUPENV}" ]]; then
  88. if [[ -n "${VSCODE_SKIP_SYSROOT}" ]]; then
  89. source ./build/azure-pipelines/linux/setup-env.sh --skip-sysroot
  90. else
  91. source ./build/azure-pipelines/linux/setup-env.sh
  92. fi
  93. fi
  94. for i in {1..5}; do # try 5 times
  95. npm ci && break
  96. if [[ $i -eq 3 ]]; then
  97. echo "Npm install failed too many times" >&2
  98. exit 1
  99. fi
  100. echo "Npm install failed $i, trying again..."
  101. done
  102. node build/azure-pipelines/distro/mixin-npm
  103. yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci"
  104. if [[ -f "../build/linux/${VSCODE_ARCH}/ripgrep.sh" ]]; then
  105. bash "../build/linux/${VSCODE_ARCH}/ripgrep.sh" "../VSCode-linux-${VSCODE_ARCH}/resources/app/node_modules"
  106. fi
  107. find "../VSCode-linux-${VSCODE_ARCH}" -print0 | xargs -0 touch -c
  108. cd ..