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); }