feat: auto install libtinfo5
Some checks failed
Continuous Integration / GitHub Actions Test (push) Failing after 14s
Check Transpiled JavaScript / Check dist/ (push) Successful in 1m18s
Continuous Integration / TypeScript Tests (push) Successful in 1m18s

This commit is contained in:
2024-11-17 13:21:56 +13:00
parent 6997e8237a
commit b500781bae
6 changed files with 79 additions and 10 deletions

28
dist/index.js generated vendored
View File

@@ -28287,6 +28287,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.download = download;
exports.downloadRequirements = downloadRequirements;
exports.getLatestVersion = getLatestVersion;
const tc = __importStar(__nccwpck_require__(3472));
const core = __importStar(__nccwpck_require__(7484));
@@ -28336,6 +28337,29 @@ async function download(version) {
const cachedPath = await tc.cacheDir(`/tmp/clang-${version}`, 'clang', version);
return cachedPath;
}
async function downloadRequirements() {
if (process.platform == 'linux') {
const url = 'http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb';
core.info(`Downloading libtinfo5 (${process.platform}, ${process.arch}) from ${url} ...`);
const archivePath = await tc.downloadTool(url);
core.info(`Extracting libtinfo5 archive...`);
let exit = await exec.exec('mkdir', ['-p', `/tmp/libtinfo5_6.2`]);
if (exit !== 0) {
throw new Error(`Failed to create directory /tmp/libtinfo5_6.2`);
}
exit = await exec.exec('dpkg-deb', [
'-xv',
archivePath,
'/tmp/libtinfo5_6.2'
]);
if (exit !== 0) {
throw new Error(`Failed to extract libtinfo5`);
}
const cachedPath = await tc.cacheDir(`/tmp/libtinfo5_6.2`, 'libtinfo5', '6.2');
return cachedPath;
}
return '';
}
async function getLatestVersion() {
const http = new httpm.HttpClient('siteorg/setup-clang');
const url = 'https://api.github.com/repos/llvm/llvm-project/releases';
@@ -28403,12 +28427,14 @@ async function run() {
clangVersion = await (0, download_1.getLatestVersion)();
}
const downloadPath = await (0, download_1.download)(clangVersion);
const downloadRequirementsPath = await (0, download_1.downloadRequirements)();
const bin = path.join(downloadPath, 'bin');
const lib = path.join(downloadPath, 'lib');
const requirementsLib = path.join(downloadRequirementsPath, 'lib');
core.addPath(bin);
core.exportVariable('LLVM_PATH', downloadPath);
const ld = process.env.LD_LIBRARY_PATH ?? '';
core.exportVariable('LD_LIBRARY_PATH', `${lib}${path.delimiter}${ld}`);
core.exportVariable('LD_LIBRARY_PATH', `${requirementsLib}${path.delimiter}${lib}${path.delimiter}${ld}`);
// Ensure system libraries are first on ARM64 macOS to avoid issues with Apple's libc++ being weird.
// https://discourse.llvm.org/t/apples-libc-now-provides-std-type-descriptor-t-functionality-not-found-in-upstream-libc/73881/5
const dyld = process.env.DYLD_LIBRARY_PATH;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long