src/bin/build-llvm: add utility to build llvm project
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,2 @@
|
||||
out
|
||||
node_modules
|
||||
|
||||
# Some executable folder that are intended to be invoked on-the-fly.
|
||||
/src/bin
|
||||
|
||||
46
src/bin/build-llvm.ts
Normal file
46
src/bin/build-llvm.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
import { llvmPackages } from '../build/llvmPackages.js';
|
||||
import path from 'path';
|
||||
import { buildPackage } from '../build/build.js';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { arch } from 'os';
|
||||
|
||||
const args = await yargs(hideBin(process.argv))
|
||||
.version("0.0.0")
|
||||
.option("src", {
|
||||
describe: "Source directory to llvm-project",
|
||||
demandOption: true,
|
||||
type: "string",
|
||||
})
|
||||
.option("build", {
|
||||
describe: "Build directory",
|
||||
type: "string",
|
||||
})
|
||||
.option("prefix", {
|
||||
describe: "Install prefix",
|
||||
type: "string",
|
||||
})
|
||||
.help()
|
||||
.parse();
|
||||
|
||||
const src = path.resolve(args.src);
|
||||
const build = args.build ?? path.resolve(src, "build");
|
||||
const prefix = args.prefix ?? path.resolve(src, "install", randomUUID());
|
||||
|
||||
const packages = llvmPackages({
|
||||
src: args.src,
|
||||
buildDir(packageName) {
|
||||
return path.join(build, packageName);
|
||||
},
|
||||
installPrefix: prefix,
|
||||
// FIXME: arguments to platform?
|
||||
platform: {
|
||||
buildPlatform: { arch: arch() },
|
||||
hostPlatform: { arch: arch() },
|
||||
}
|
||||
});
|
||||
|
||||
for (const pkg of packages) {
|
||||
await buildPackage(pkg);
|
||||
}
|
||||
Reference in New Issue
Block a user