feat: loong64 support for reh server (#2087)

This commit is contained in:
darkyzhou 2024-11-05 01:54:40 +08:00 committed by GitHub
parent d736414896
commit a023a24173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 179 additions and 7 deletions

View File

@ -276,6 +276,9 @@ jobs:
- slug: RISCV64
vscode_arch: riscv64
npm_arch: riscv64
- slug: LOONG64
vscode_arch: loong64
npm_arch: loong64
env:
BUILD_SOURCEVERSION: ${{ needs.compile.outputs.BUILD_SOURCEVERSION }}
DISABLED: ${{ vars[format('DISABLE_INSIDER_LINUX_REH_{0}', matrix.slug)] }}

View File

@ -274,6 +274,9 @@ jobs:
- slug: RISCV64
vscode_arch: riscv64
npm_arch: riscv64
- slug: LOONG64
vscode_arch: loong64
npm_arch: loong64
env:
BUILD_SOURCEVERSION: ${{ needs.compile.outputs.BUILD_SOURCEVERSION }}
DISABLED: ${{ vars[format('DISABLE_STABLE_LINUX_REH_{0}', matrix.slug)] }}

View File

@ -59,6 +59,8 @@ elif [[ "${UNAME_ARCH}" == "ppc64le" ]]; then
export VSCODE_ARCH="ppc64le"
elif [[ "${UNAME_ARCH}" == "riscv64" ]]; then
export VSCODE_ARCH="riscv64"
elif [[ "${UNAME_ARCH}" == "loongarch64" ]]; then
export VSCODE_ARCH="loong64"
else
export VSCODE_ARCH="x64"
fi

View File

@ -426,6 +426,32 @@ elif [[ "${ASSETS}" != "null" ]]; then
fi
fi
# linux-loong64
if [[ "${VSCODE_ARCH}" == "loong64" || "${CHECK_ALL}" == "yes" ]]; then
export SHOULD_BUILD_DEB="no"
export SHOULD_BUILD_RPM="no"
export SHOULD_BUILD_APPIMAGE="no"
export SHOULD_BUILD_TAR="no"
if [[ -z $( contains "${APP_NAME_LC}-reh-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then
echo "Building on Linux Loong64 because we have no REH archive"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_REH="no"
fi
if [[ -z $( contains "${APP_NAME_LC}-reh-web-linux-loong64-${RELEASE_VERSION}.tar.gz" ) ]]; then
echo "Building on Linux Loong64 because we have no REH-web archive"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_REH_WEB="no"
fi
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux Loong64 builds"
fi
fi
# linux-x64
if [[ "${VSCODE_ARCH}" == "x64" || "${CHECK_ALL}" == "yes" ]]; then
if [[ -z $( contains "amd64.deb" ) ]]; then
@ -544,6 +570,10 @@ else
elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no"
elif [[ "${VSCODE_ARCH}" == "loong64" ]]; then
SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no"
SHOULD_BUILD_TAR="no"
fi
if [[ "${VSCODE_ARCH}" != "x64" || "${DISABLE_APPIMAGE}" == "yes" ]]; then
export SHOULD_BUILD_APPIMAGE="no"

View File

@ -29,12 +29,15 @@ elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
export VSCODE_SKIP_SETUPENV=1
fi
source ../electron.riscv64.sh
if [[ -f "../electron_linux_${VSCODE_ARCH}.sh" ]]; then
# shellcheck disable=SC1090
source "../electron_linux_${VSCODE_ARCH}.sh"
if [[ "${ELECTRON_VERSION}" != "$(yarn config get target)" ]]; then
if [[ "${ELECTRON_VERSION}" != "$( yarn config get target )" ]]; then
# Fail the pipeline if electron target doesn't match what is used.
echo "Electron RISC-V binary version doesn't match target electron version!"
echo "Electron ${VSCODE_ARCH} binary version doesn't match target electron version!"
echo "Releases available at: https://github.com/${VSCODE_ELECTRON_REPOSITORY}/releases"
exit 1
fi

View File

@ -52,6 +52,15 @@ elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
export VSCODE_NODEJS_SITE='https://unofficial-builds.nodejs.org'
# part of the url before '/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}.tar.gz'
export VSCODE_NODEJS_URLROOT='/download/release'
elif [[ "${VSCODE_ARCH}" == "loong64" ]]; then
NODE_VERSION="20.16.0"
VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:trixie-devtoolset-loong64"
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
export VSCODE_SKIP_SETUPENV=1
export VSCODE_NODEJS_SITE='https://unofficial-builds.nodejs.org'
export VSCODE_NODEJS_URLROOT='/download/release'
fi
export VSCODE_PLATFORM='linux'
@ -142,9 +151,15 @@ if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
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
echo "Archiving REH"
pushd "../vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
if [[ -f "../ripgrep_${VSCODE_PLATFORM}_${VSCODE_ARCH}.sh" ]]; then
exec "../ripgrep_${VSCODE_PLATFORM}_${VSCODE_ARCH}.sh"
fi
echo "Archiving REH"
tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
popd
fi
@ -155,9 +170,15 @@ if [[ "${SHOULD_BUILD_REH_WEB}" != "no" ]]; then
EXPECTED_GLIBC_VERSION="${GLIBC_VERSION}" EXPECTED_GLIBCXX_VERSION="${GLIBCXX_VERSION}" SEARCH_PATH="../vscode-reh-web-${VSCODE_PLATFORM}-${VSCODE_ARCH}" ./build/azure-pipelines/linux/verify-glibc-requirements.sh
echo "Archiving REH-web"
pushd "../vscode-reh-web-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
if [[ -f "../ripgrep_${VSCODE_PLATFORM}_${VSCODE_ARCH}.sh" ]]; then
exec "../ripgrep_${VSCODE_PLATFORM}_${VSCODE_ARCH}.sh"
fi
echo "Archiving REH-web"
tar czf "../assets/${APP_NAME_LC}-reh-web-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
popd
fi

View File

@ -0,0 +1,96 @@
diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js
index df4fda0c898..ce8f21bbc0e 100644
--- a/build/gulpfile.reh.js
+++ b/build/gulpfile.reh.js
@@ -52,2 +52,3 @@ const BUILD_TARGETS = [
{ platform: 'linux', arch: 'riscv64' },
+ { platform: 'linux', arch: 'loong64' },
{ platform: 'alpine', arch: 'arm64' },
diff --git a/build/gulpfile.scan.js b/build/gulpfile.scan.js
index 0eafadc1fff..3c1d6fb5bfc 100644
--- a/build/gulpfile.scan.js
+++ b/build/gulpfile.scan.js
@@ -28,2 +28,3 @@ const BUILD_TARGETS = [
{ platform: 'linux', arch: 'riscv64' },
+ { platform: 'linux', arch: 'loong64' },
];
diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
index b208d700f2c..4be8f93f704 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
@@ -489,2 +489,3 @@ const BUILD_TARGETS = [
{ platform: 'linux', arch: 'riscv64' },
+ { platform: 'linux', arch: 'loong64' },
];
diff --git a/cli/src/update_service.rs b/cli/src/update_service.rs
index 29228cb4235..c1163029377 100644
--- a/cli/src/update_service.rs
+++ b/cli/src/update_service.rs
@@ -220,2 +220,3 @@ pub enum Platform {
LinuxRISCV64,
+ LinuxLoong64,
DarwinX64,
@@ -235,2 +236,3 @@ impl Platform {
Platform::LinuxRISCV64 => Some("linux-riscv64".to_owned()),
+ Platform::LinuxLoong64 => Some("linux-loong64".to_owned()),
Platform::DarwinX64 => Some("darwin".to_owned()),
@@ -256,2 +258,3 @@ impl Platform {
Platform::LinuxRISCV64 => "server-linux-riscv64",
+ Platform::LinuxLoong64 => "server-linux-loong64",
Platform::DarwinX64 => "server-darwin",
@@ -278,2 +281,3 @@ impl Platform {
Platform::LinuxRISCV64 => "cli-linux-riscv64",
+ Platform::LinuxLoong64 => "cli-linux-loong64",
Platform::DarwinX64 => "cli-darwin-x64",
@@ -314,2 +318,4 @@ impl Platform {
Some(Platform::LinuxRISCV64)
+ } else if cfg!(all(target_os = "linux", target_arch = "loongarch64")) {
+ Some(Platform::LinuxLoong64)
} else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
@@ -344,2 +350,3 @@ impl fmt::Display for Platform {
Platform::LinuxRISCV64 => "LinuxRISCV64",
+ Platform::LinuxLoong64 => "LinuxLoong64",
Platform::DarwinX64 => "DarwinX64",
diff --git a/cli/src/util/prereqs.rs b/cli/src/util/prereqs.rs
index 137a2570130..8f1e20c2aa9 100644
--- a/cli/src/util/prereqs.rs
+++ b/cli/src/util/prereqs.rs
@@ -90,2 +90,4 @@ impl PreReqChecker {
Platform::LinuxRISCV64
+ } else if cfg!(target_arch = "loongarch64") {
+ Platform::LinuxLoong64
} else {
diff --git a/resources/server/bin/helpers/check-requirements-linux.sh b/resources/server/bin/helpers/check-requirements-linux.sh
index 91c9d203387..7776dbcbc24 100644
--- a/resources/server/bin/helpers/check-requirements-linux.sh
+++ b/resources/server/bin/helpers/check-requirements-linux.sh
@@ -58,2 +58,3 @@ case $ARCH in
riscv64) LDCONFIG_ARCH="RISC-V";;
+ loongarch64) LDCONFIG_ARCH="double-float";;
esac
diff --git a/src/vs/platform/extensionManagement/common/extensionManagement.ts b/src/vs/platform/extensionManagement/common/extensionManagement.ts
index 03e78ca3116..8e59218d7ad 100644
--- a/src/vs/platform/extensionManagement/common/extensionManagement.ts
+++ b/src/vs/platform/extensionManagement/common/extensionManagement.ts
@@ -44,2 +44,3 @@ export function TargetPlatformToString(targetPlatform: TargetPlatform) {
case TargetPlatform.LINUX_RISCV64: return 'Linux RISC-V 64';
+ case TargetPlatform.LINUX_LOONG64: return 'Linux Loong64';
@@ -69,2 +70,3 @@ export function toTargetPlatform(targetPlatform: string): TargetPlatform {
case TargetPlatform.LINUX_RISCV64: return TargetPlatform.LINUX_RISCV64;
+ case TargetPlatform.LINUX_LOONG64: return TargetPlatform.LINUX_LOONG64;
@@ -113,2 +115,5 @@ export function getTargetPlatform(platform: Platform | 'alpine', arch: string |
}
+ if (arch === 'loong64') {
+ return TargetPlatform.LINUX_LOONG64;
+ }
return TargetPlatform.UNKNOWN;
diff --git a/src/vs/platform/extensions/common/extensions.ts b/src/vs/platform/extensions/common/extensions.ts
index a7aa2bb23bf..a4d076ce596 100644
--- a/src/vs/platform/extensions/common/extensions.ts
+++ b/src/vs/platform/extensions/common/extensions.ts
@@ -296,2 +296,3 @@ export const enum TargetPlatform {
LINUX_RISCV64 = 'linux-riscv64',
+ LINUX_LOONG64 = 'linux-loong64',

View File

@ -1,9 +1,12 @@
diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js
index d45d5bc..81a6449 100644
index 88e3c9e..4cad4f1 100644
--- a/build/npm/postinstall.js
+++ b/build/npm/postinstall.js
@@ -56,3 +56,3 @@ function yarnInstall(dir, opts) {
@@ -55,4 +55,6 @@ function npmInstall(dir, opts) {
opts.cwd = root;
- if (process.env['npm_config_arch'] === 'arm64') {
+ if (process.env['npm_config_arch'] === 'arm64' || process.env['npm_config_arch'] === 'arm' || process.env['npm_config_arch'] === 'ppc64' || process.env['npm_config_arch'] === 'riscv64') {
run('sudo', ['docker', 'run', '--rm', '--privileged', 'multiarch/qemu-user-static', '--reset', '-p', 'yes'], opts);
+ } else if (process.env['npm_config_arch'] === 'loong64') {
+ run('sudo', ['docker', 'run', '--rm', '--privileged', 'loongcr.lcpu.dev/multiarch/archlinux', '--reset', '-p', 'yes'], opts);
}

11
ripgrep_linux_loong64.sh Executable file
View File

@ -0,0 +1,11 @@
# When installing @vscode/ripgrep, it will try to download prebuilt ripgrep binary from https://github.com/microsoft/ripgrep-prebuilt,
# however, loong64 is not a supported architecture and x86 will be picked as fallback, so we need to replace it with a native one.
RG_PATH="node_modules/@vscode/ripgrep/bin/rg"
RG_VERSION="14.1.1"
echo "Replacing ripgrep binary with loong64 one"
rm "${RG_PATH}"
curl --silent --fail -L https://github.com/darkyzhou/ripgrep-loongarch64-musl/releases/download/${RG_VERSION}/rg -o "${RG_PATH}"
chmod +x "${RG_PATH}"