Add support for Linux arm64 (#446)

This commit is contained in:
Michael Telatynski
2023-04-18 11:38:26 +01:00
committed by GitHub
parent 392545a57f
commit 0d0b333f40
9 changed files with 114 additions and 27 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ export default async function buildKeytar(hakEnv: HakEnv, moduleInfo: Dependency
await new Promise<void>((resolve, reject) => {
const proc = childProcess.spawn(
path.join(moduleInfo.nodeModuleBinDir, "node-gyp" + (hakEnv.isWin() ? ".cmd" : "")),
["rebuild"],
["rebuild", "--arch", hakEnv.getTargetArch()],
{
cwd: moduleInfo.moduleBuildDir,
env,
+6 -4
View File
@@ -205,14 +205,15 @@ async function buildSqlCipherUnix(hakEnv: HakEnv, moduleInfo: DependencyInfo): P
const cflags = ["-DSQLITE_HAS_CODEC"];
if (!hakEnv.isHost()) {
// If the caller has specified CFLAGS then we shouldn't specify target
// as their compiler may be incompatible (gcc)
if (!hakEnv.isHost() && !process.env.CFLAGS) {
// `clang` uses more logical option naming.
cflags.push(`--target=${hakEnv.getTargetId()}`);
}
if (cflags.length) {
args.push(`CFLAGS=${cflags.join(" ")}`);
}
if (process.env.CFLAGS) cflags.unshift(process.env.CFLAGS);
args.push(`CFLAGS=${cflags.join(" ")}`);
const ldflags: string[] = [];
@@ -222,6 +223,7 @@ async function buildSqlCipherUnix(hakEnv: HakEnv, moduleInfo: DependencyInfo): P
}
if (ldflags.length) {
if (process.env.LDFLAGS) ldflags.unshift(process.env.LDFLAGS);
args.push(`LDFLAGS=${ldflags.join(" ")}`);
}
+3 -1
View File
@@ -70,7 +70,7 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
await new Promise((resolve, reject) => {
const rustc = childProcess.execFile(
"rustc",
["--target", hakEnv.getTargetId(), "-o", "tmp", "-"],
["--target", hakEnv.getTargetId(), "--emit=obj", "-o", "tmp", "-"],
(err, out) => {
if (err) {
reject(
@@ -86,6 +86,8 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
},
);
rustc.stdin!.write("fn main() {}");
rustc.stdout!.pipe(process.stdout);
rustc.stderr!.pipe(process.stderr);
rustc.stdin!.end();
});
}