-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use clang and libcxx from chromium
- Loading branch information
1 parent
808f222
commit ee4aaaa
Showing
8 changed files
with
489 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Can be removed once https://github.com/electron/electron-rebuild/pull/703 is available. | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.downloadLibcxxObjects = exports.downloadLibcxxHeaders = void 0; | ||
const debug = require("debug"); | ||
const extract = require("extract-zip"); | ||
const fs = require("fs-extra"); | ||
const path = require("path"); | ||
const packageJSON = require("../../package.json"); | ||
const get_1 = require("@electron/get"); | ||
const d = debug('libcxx-fetcher'); | ||
async function downloadLibcxxHeaders(outDir, electronVersion, lib_name) { | ||
if (await fs.pathExists(path.resolve(outDir, 'include'))) | ||
return; | ||
if (!await fs.pathExists(outDir)) | ||
await fs.mkdirp(outDir); | ||
d(`downloading ${lib_name}_headers`); | ||
const headers = await (0, get_1.downloadArtifact)({ | ||
version: electronVersion, | ||
isGeneric: true, | ||
artifactName: `${lib_name}_headers.zip`, | ||
}); | ||
d(`unpacking ${lib_name}_headers from ${headers}`); | ||
await extract(headers, { dir: outDir }); | ||
} | ||
exports.downloadLibcxxHeaders = downloadLibcxxHeaders; | ||
async function downloadLibcxxObjects(outDir, electronVersion, targetArch = 'x64') { | ||
if (await fs.pathExists(path.resolve(outDir, 'libc++.a'))) | ||
return; | ||
if (!await fs.pathExists(outDir)) | ||
await fs.mkdirp(outDir); | ||
d(`downloading libcxx-objects-linux-${targetArch}`); | ||
const objects = await (0, get_1.downloadArtifact)({ | ||
version: electronVersion, | ||
platform: 'linux', | ||
artifactName: 'libcxx-objects', | ||
arch: targetArch, | ||
}); | ||
d(`unpacking libcxx-objects from ${objects}`); | ||
await extract(objects, { dir: outDir }); | ||
} | ||
exports.downloadLibcxxObjects = downloadLibcxxObjects; | ||
async function main() { | ||
const libcxxObjectsDirPath = process.env['VSCODE_LIBCXX_OBJECTS_DIR']; | ||
const libcxxHeadersDownloadDir = process.env['VSCODE_LIBCXX_HEADERS_DIR']; | ||
const libcxxabiHeadersDownloadDir = process.env['VSCODE_LIBCXXABI_HEADERS_DIR']; | ||
const arch = process.env['VSCODE_ARCH']; | ||
const electronVersion = packageJSON.devDependencies.electron; | ||
if (!libcxxObjectsDirPath || !libcxxHeadersDownloadDir || !libcxxabiHeadersDownloadDir) { | ||
throw new Error('Required build env not set'); | ||
} | ||
await downloadLibcxxObjects(libcxxObjectsDirPath, electronVersion, arch); | ||
await downloadLibcxxHeaders(libcxxHeadersDownloadDir, electronVersion, 'libcxx'); | ||
await downloadLibcxxHeaders(libcxxabiHeadersDownloadDir, electronVersion, 'libcxxabi'); | ||
} | ||
if (require.main === module) { | ||
main().catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Can be removed once https://github.com/electron/electron-rebuild/pull/703 is available. | ||
|
||
'use strict'; | ||
|
||
import * as debug from 'debug'; | ||
import * as extract from 'extract-zip'; | ||
import * as fs from 'fs-extra'; | ||
import * as path from 'path'; | ||
import * as packageJSON from '../../package.json'; | ||
import { downloadArtifact } from '@electron/get'; | ||
|
||
const d = debug('libcxx-fetcher'); | ||
|
||
export async function downloadLibcxxHeaders(outDir: string, electronVersion: string, lib_name: string): Promise<void> { | ||
if (await fs.pathExists(path.resolve(outDir, 'include'))) return; | ||
if (!await fs.pathExists(outDir)) await fs.mkdirp(outDir); | ||
|
||
d(`downloading ${lib_name}_headers`); | ||
const headers = await downloadArtifact({ | ||
version: electronVersion, | ||
isGeneric: true, | ||
artifactName: `${lib_name}_headers.zip`, | ||
}); | ||
|
||
d(`unpacking ${lib_name}_headers from ${headers}`); | ||
await extract(headers, { dir: outDir }); | ||
} | ||
|
||
export async function downloadLibcxxObjects(outDir: string, electronVersion: string, targetArch: string = 'x64'): Promise<void> { | ||
if (await fs.pathExists(path.resolve(outDir, 'libc++.a'))) return; | ||
if (!await fs.pathExists(outDir)) await fs.mkdirp(outDir); | ||
|
||
d(`downloading libcxx-objects-linux-${targetArch}`); | ||
const objects = await downloadArtifact({ | ||
version: electronVersion, | ||
platform: 'linux', | ||
artifactName: 'libcxx-objects', | ||
arch: targetArch, | ||
}); | ||
|
||
d(`unpacking libcxx-objects from ${objects}`); | ||
await extract(objects, { dir: outDir }); | ||
} | ||
|
||
async function main(): Promise<void> { | ||
const libcxxObjectsDirPath = process.env['VSCODE_LIBCXX_OBJECTS_DIR']; | ||
const libcxxHeadersDownloadDir = process.env['VSCODE_LIBCXX_HEADERS_DIR']; | ||
const libcxxabiHeadersDownloadDir = process.env['VSCODE_LIBCXXABI_HEADERS_DIR']; | ||
const arch = process.env['VSCODE_ARCH']; | ||
const electronVersion = packageJSON.devDependencies.electron; | ||
|
||
if (!libcxxObjectsDirPath || !libcxxHeadersDownloadDir || !libcxxabiHeadersDownloadDir) { | ||
throw new Error('Required build env not set'); | ||
} | ||
|
||
await downloadLibcxxObjects(libcxxObjectsDirPath, electronVersion, arch); | ||
await downloadLibcxxHeaders(libcxxHeadersDownloadDir, electronVersion, 'libcxx'); | ||
await downloadLibcxxHeaders(libcxxabiHeadersDownloadDir, electronVersion, 'libcxxabi'); | ||
} | ||
|
||
if (require.main === module) { | ||
main().catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.