build/llvmPackages: add sysroot generator

This commit is contained in:
2024-07-09 15:12:15 +08:00
parent a95cae429b
commit 84a24f02e0

View File

@@ -16,6 +16,40 @@ export interface LLVMPackageOverrides {
spawnOverrides?: (old: SpawnOptions) => SpawnOptions, spawnOverrides?: (old: SpawnOptions) => SpawnOptions,
} }
/**
* Make sysroot options suitable for LLVM build.
*/
export function llvmBuildSysroot(prefix: string): LLVMPackageOverrides {
return {
cmakeDefinitionOverrides: {
llvm: {
CMAKE_C_COMPILER: path.resolve(prefix, 'usr', 'bin', 'gcc'),
CMAKE_CXX_COMPILER: path.resolve(prefix, 'usr', 'bin', 'g++'),
CMAKE_SYSROOT: prefix,
},
libpgmath: {
CMAKE_SYSROOT: prefix,
},
cflang: {
CMAKE_SYSROOT: prefix,
},
},
spawnOverrides: o => ({
...o,
env: {
...o.env,
LD_LIBRARY_PATH: [
path.resolve(prefix, 'lib'),
path.resolve(prefix, 'usr', 'lib'),
].join(':')
}
}),
};
}
export interface LLVMPackageOptions { export interface LLVMPackageOptions {
src: string; src: string;
installPrefix: string; installPrefix: string;