Skip to content

Commit

Permalink
use VSCODE_SYSROOT_REPO and VSCODE_ELECTRON_REPO variable [skip ci]
Browse files Browse the repository at this point in the history
Co-Authored-By: Alex Garcia <[email protected]>
  • Loading branch information
kxxt and lex-ibm committed Jun 11, 2024
1 parent 4398d41 commit eacdbe7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
7 changes: 7 additions & 0 deletions package_linux_bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ cd vscode || { echo "'vscode' dir not found"; exit 1; }
export VSCODE_SKIP_NODE_VERSION_CHECK=1
export VSCODE_SYSROOT_PREFIX='-glibc-2.17'

if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
export VSCODE_SYSROOT_REPO='VSCodium/vscode-linux-build-agent'
export VSCODE_SYSROOT_VERSION='20240129-253798'
export VSCODE_SYSROOT_PREFIX='-glibc-2.28'
fi

if [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
export VSCODE_ELECTRON_REPO='riscv-forks/electron-riscv-releases'
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
# Official electron doesn't support riscv64, adding the checksums of forked electron here
Expand Down
42 changes: 20 additions & 22 deletions patches/ppc64le-and-riscv64-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ index 6f8144b0954..8a8195e9b66 100644

BUILD_TARGETS.forEach(buildTarget => {
diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
index 3b1aeafd080..c3f93d7a607 100644
index 3b1aeafd080..3774280e44d 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
@@ -339,11 +339,17 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
all = es.merge(all, shortcut);
}

+ const electronOverride = {};
+ if (platform === 'linux' && arch === 'riscv64') {
+ // electron doesn't support riscv64, so a fork is used here.
+ electronOverride.repo = 'riscv-forks/electron-riscv-releases';
+ if (platform === 'linux' && (arch === 'riscv64' || arch === 'ppc64le')) {
+ // electron doesn't support riscv64 and ppc64le, override the repo with `VSCODE_ELECTRON_REPO`.
+ electronOverride.repo = process.env.VSCODE_ELECTRON_REPO;
+ }
+
let result = all
Expand Down Expand Up @@ -382,23 +382,22 @@ index 4028370cd02..e83a5516785 100644
+ ],
};
diff --git a/build/linux/debian/install-sysroot.js b/build/linux/debian/install-sysroot.js
index feca7d3fa9d..d85d64ef067 100644
index feca7d3fa9d..8ef9003e7b1 100644
--- a/build/linux/debian/install-sysroot.js
+++ b/build/linux/debian/install-sysroot.js
@@ -70,7 +70,11 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
@@ -70,7 +70,10 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
const timeout = setTimeout(() => controller.abort(), 30 * 1000);
const version = '20240129-253798';
try {
- const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
+ // If the assetName starts with 'powerpc64le'/'riscv64', we fetch from VSCodium/vscode-linux-build-agent
+ const repo = (options.assetName.startsWith('riscv64') || options.assetName.startsWith('powerpc64le'))
+ ? 'VSCodium/vscode-linux-build-agent'
+ : 'Microsoft/vscode-linux-build-agent';
+ const response = await fetch(`https://api.github.com/repos/${repo}/releases/tags/v${version}`, {
+ // if VSCODE_SYSROOT_REPO and VSCODE_SYSROOT_VERSION are set, use those instead
+ const repo = process.env['VSCODE_SYSROOT_REPO'] ?? 'Microsoft/vscode-linux-build-agent';
+ const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version;
+ const response = await fetch(`https://api.github.com/repos/${repo}/releases/tags/v${actualVersion}`, {
headers: ghApiHeaders,
signal: controller.signal /* Typings issue with lib.dom.d.ts */
});
@@ -79,7 +83,7 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
@@ -79,7 +82,7 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
const contents = Buffer.from(await response.arrayBuffer());
const asset = JSON.parse(contents.toString()).assets.find((a) => a.name === options.assetName);
if (!asset) {
Expand All @@ -407,7 +406,7 @@ index feca7d3fa9d..d85d64ef067 100644
}
console.log(`Found asset ${options.assetName} @ ${asset.url}.`);
const assetResponse = await fetch(asset.url, {
@@ -134,6 +138,14 @@ async function getVSCodeSysroot(arch) {
@@ -134,6 +137,14 @@ async function getVSCodeSysroot(arch) {
expectedName = `arm-rpi-linux-gnueabihf${prefix}.tar.gz`;
triple = 'arm-rpi-linux-gnueabihf';
break;
Expand All @@ -423,23 +422,22 @@ index feca7d3fa9d..d85d64ef067 100644
console.log(`Fetching ${expectedName} for ${triple}`);
const checksumSha256 = getVSCodeSysrootChecksum(expectedName);
diff --git a/build/linux/debian/install-sysroot.ts b/build/linux/debian/install-sysroot.ts
index aa417dcc722..65dbdb5531b 100644
index aa417dcc722..204b290f89b 100644
--- a/build/linux/debian/install-sysroot.ts
+++ b/build/linux/debian/install-sysroot.ts
@@ -82,7 +82,11 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
@@ -82,7 +82,10 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
const timeout = setTimeout(() => controller.abort(), 30 * 1000);
const version = '20240129-253798';
try {
- const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
+ // If the assetName starts with 'powerpc64le'/'riscv64', we fetch from VSCodium/vscode-linux-build-agent
+ const repo = (options.assetName.startsWith('riscv64') || options.assetName.startsWith('powerpc64le'))
+ ? 'VSCodium/vscode-linux-build-agent'
+ : 'Microsoft/vscode-linux-build-agent';
+ const response = await fetch(`https://api.github.com/repos/${repo}/releases/tags/v${version}`, {
+ // if VSCODE_SYSROOT_REPO and VSCODE_SYSROOT_VERSION are set, use those instead
+ const repo = process.env['VSCODE_SYSROOT_REPO'] ?? 'Microsoft/vscode-linux-build-agent';
+ const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version;
+ const response = await fetch(`https://api.github.com/repos/${repo}/releases/tags/v${actualVersion}`, {
headers: ghApiHeaders,
signal: controller.signal as any /* Typings issue with lib.dom.d.ts */
});
@@ -91,7 +95,7 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
@@ -91,7 +94,7 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
const contents = Buffer.from(await response.arrayBuffer());
const asset = JSON.parse(contents.toString()).assets.find((a: { name: string }) => a.name === options.assetName);
if (!asset) {
Expand All @@ -448,7 +446,7 @@ index aa417dcc722..65dbdb5531b 100644
}
console.log(`Found asset ${options.assetName} @ ${asset.url}.`);
const assetResponse = await fetch(asset.url, {
@@ -151,6 +155,14 @@ export async function getVSCodeSysroot(arch: DebianArchString): Promise<string>
@@ -151,6 +154,14 @@ export async function getVSCodeSysroot(arch: DebianArchString): Promise<string>
expectedName = `arm-rpi-linux-gnueabihf${prefix}.tar.gz`;
triple = 'arm-rpi-linux-gnueabihf';
break;
Expand Down

0 comments on commit eacdbe7

Please sign in to comment.