build: move all build stuff under this directory
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { LLVM_SRC } from "./environment";
|
import { LLVM_SRC } from "./environment";
|
||||||
import { buildLLVMHash } from "./llvmPackages";
|
import { buildLLVMHash } from "./build/llvmPackages";
|
||||||
|
|
||||||
|
|
||||||
buildLLVMHash(LLVM_SRC, "639a757627d1b28fa03b9438083bc3a163b8bbe8");
|
buildLLVMHash(LLVM_SRC, "31c8e21f40ea654f9d49b3a926acc6ef1f2ca5d5");
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { GeneralVariable, LLVMVariable, command, variable } from "./commands/cmake";
|
import { GeneralVariable, LLVMVariable, command, variable } from "commands/cmake";
|
||||||
import { SYSROOT_PREFIX } from "./environment";
|
import { SYSROOT_PREFIX } from "environment";
|
||||||
import { PackageTask, buildPackage } from "./build";
|
import { PackageTask, buildPackage } from "./build";
|
||||||
import { checkedSpawnSync } from "./cli";
|
import { checkedSpawnSync } from "cli";
|
||||||
|
import os from "os";
|
||||||
|
import { SpawnOptions, spawn } from "child_process";
|
||||||
|
|
||||||
export function llvmPackages(src: string, installPrefix: string): PackageTask[] {
|
export function llvmPackages(src: string, installPrefix: string): PackageTask[] {
|
||||||
const LLVM_BUILD = path.join(src, "build-dev");
|
const LLVM_BUILD = path.join(src, "build-dev");
|
||||||
@@ -22,12 +24,27 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
CMAKE_SYSROOT: SYSROOT_PREFIX,
|
CMAKE_SYSROOT: SYSROOT_PREFIX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const env = {
|
||||||
|
...process.env,
|
||||||
|
MAKEFLAGS: ["-j", os.cpus().length].join(" "),
|
||||||
|
LD_LIBRARY_PATH: [
|
||||||
|
path.join(SYSROOT_PREFIX, 'usr', 'lib'),
|
||||||
|
path.join(SYSROOT_PREFIX, 'lib'),
|
||||||
|
].join(':'),
|
||||||
|
};
|
||||||
|
|
||||||
|
const spawnOptions: SpawnOptions = {
|
||||||
|
stdio: "inherit",
|
||||||
|
env,
|
||||||
|
cwd: src,
|
||||||
|
};
|
||||||
|
|
||||||
const mkBuildPhase = (build: string) => {
|
const mkBuildPhase = (build: string) => {
|
||||||
checkedSpawnSync(cmake, ["--build", build], { stdio: 'inherit' });
|
checkedSpawnSync(cmake, ["--build", build], spawnOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
const mkInstallPhase = (build: string) => {
|
const mkInstallPhase = (build: string) => {
|
||||||
checkedSpawnSync(cmake, ["--build", build, "--target", "install"], { stdio: 'inherit' });
|
checkedSpawnSync(cmake, ["--build", build, "--target", "install"], spawnOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
function mkLLVMPackage(): PackageTask {
|
function mkLLVMPackage(): PackageTask {
|
||||||
@@ -39,13 +56,8 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
checkedSpawnSync("git",
|
checkedSpawnSync("git",
|
||||||
[
|
[
|
||||||
"apply",
|
"apply",
|
||||||
path.resolve(__dirname, "..", "assets", "omp.diff"),
|
path.resolve(__dirname, "..", "..", "assets", "omp.diff"),
|
||||||
], { stdio: "inherit", cwd: src });
|
], spawnOptions);
|
||||||
|
|
||||||
process.env.LD_LIBRARY_PATH = [
|
|
||||||
path.join(SYSROOT_PREFIX, 'usr', 'lib'),
|
|
||||||
path.join(SYSROOT_PREFIX, 'lib'),
|
|
||||||
].join(':');
|
|
||||||
},
|
},
|
||||||
configurePhase: () => {
|
configurePhase: () => {
|
||||||
// Configure
|
// Configure
|
||||||
@@ -58,7 +70,7 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
// LLVM cmake root is under /llvm directory
|
// LLVM cmake root is under /llvm directory
|
||||||
pathToSource: path.join(src, "llvm"),
|
pathToSource: path.join(src, "llvm"),
|
||||||
pathToBuild: build,
|
pathToBuild: build,
|
||||||
}), { stdio: "inherit" });
|
}), spawnOptions);
|
||||||
},
|
},
|
||||||
buildPhase: () => mkBuildPhase(build),
|
buildPhase: () => mkBuildPhase(build),
|
||||||
installPhase: () => mkInstallPhase(build),
|
installPhase: () => mkInstallPhase(build),
|
||||||
@@ -70,7 +82,7 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
return {
|
return {
|
||||||
name: "libpgmath",
|
name: "libpgmath",
|
||||||
configurePhase: () => {
|
configurePhase: () => {
|
||||||
checkedSpawnSync(rm, ["-rf", build], { stdio: "inherit" });
|
checkedSpawnSync(rm, ["-rf", build], spawnOptions);
|
||||||
|
|
||||||
// Configure libpgmath.
|
// Configure libpgmath.
|
||||||
checkedSpawnSync(cmake, command({
|
checkedSpawnSync(cmake, command({
|
||||||
@@ -86,7 +98,7 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
generator: "Ninja",
|
generator: "Ninja",
|
||||||
pathToSource: path.join(src, "cflang", "runtime", "libpgmath"),
|
pathToSource: path.join(src, "cflang", "runtime", "libpgmath"),
|
||||||
pathToBuild: build,
|
pathToBuild: build,
|
||||||
}), { stdio: "inherit" });
|
}), spawnOptions);
|
||||||
},
|
},
|
||||||
buildPhase: () => mkBuildPhase(build),
|
buildPhase: () => mkBuildPhase(build),
|
||||||
installPhase: () => mkInstallPhase(build),
|
installPhase: () => mkInstallPhase(build),
|
||||||
@@ -98,7 +110,7 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
return {
|
return {
|
||||||
name: "cflang",
|
name: "cflang",
|
||||||
configurePhase: () => {
|
configurePhase: () => {
|
||||||
checkedSpawnSync(rm, ["-rf", build], { stdio: "inherit" });
|
checkedSpawnSync(rm, ["-rf", build], spawnOptions);
|
||||||
|
|
||||||
// Configure cflang.
|
// Configure cflang.
|
||||||
checkedSpawnSync(cmake, command({
|
checkedSpawnSync(cmake, command({
|
||||||
@@ -120,7 +132,7 @@ export function llvmPackages(src: string, installPrefix: string): PackageTask[]
|
|||||||
generator: "Unix Makefiles",
|
generator: "Unix Makefiles",
|
||||||
pathToSource: path.join(src, "cflang"),
|
pathToSource: path.join(src, "cflang"),
|
||||||
pathToBuild: build,
|
pathToBuild: build,
|
||||||
}), { stdio: "inherit" });
|
}), spawnOptions);
|
||||||
},
|
},
|
||||||
buildPhase: () => mkBuildPhase(build),
|
buildPhase: () => mkBuildPhase(build),
|
||||||
installPhase: () => mkInstallPhase(build),
|
installPhase: () => mkInstallPhase(build),
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"module": "commonjs", /* Specify what module code is generated. */
|
"module": "commonjs", /* Specify what module code is generated. */
|
||||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
|
|||||||
Reference in New Issue
Block a user