diff --git a/hak/matrix-seshat/build.js b/hak/matrix-seshat/build.js index 444b95c..77ac629 100644 --- a/hak/matrix-seshat/build.js +++ b/hak/matrix-seshat/build.js @@ -182,9 +182,36 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) { if (hakEnv.isMac()) { args.push('--with-crypto-lib=commoncrypto'); } - args.push('CFLAGS=-DSQLITE_HAS_CODEC'); + + if (!hakEnv.isHost()) { + // In the nonsense world of `configure`, it is assumed you are building + // a compiler like `gcc`, so the `host` option actually means the target + // the build output runs on. + args.push(`--host=${hakEnv.getTargetId()}`); + } + + const cflags = [ + '-DSQLITE_HAS_CODEC', + ]; + + if (!hakEnv.isHost()) { + // `clang` uses more logical option naming. + cflags.push(`--target=${hakEnv.getTargetId()}`); + } + + if (cflags.length) { + args.push(`CFLAGS=${cflags.join(' ')}`); + } + + const ldflags = []; + if (hakEnv.isMac()) { - args.push('LDFLAGS=-framework Security -framework Foundation'); + ldflags.push('-framework Security'); + ldflags.push('-framework Foundation'); + } + + if (ldflags.length) { + args.push(`LDFLAGS=${ldflags.join(' ')}`); } await new Promise((resolve, reject) => { diff --git a/hak/matrix-seshat/check.js b/hak/matrix-seshat/check.js index c8695dc..4554f5f 100644 --- a/hak/matrix-seshat/check.js +++ b/hak/matrix-seshat/check.js @@ -67,7 +67,7 @@ module.exports = async function(hakEnv, moduleInfo) { if (err) { reject("Can't find rustup"); } - const target = hakEnv.getRustTarget(); + const target = hakEnv.getTargetId(); if (!out.includes(target)) { reject(`Rust target ${target} not installed`); } diff --git a/scripts/hak/hakEnv.js b/scripts/hak/hakEnv.js index 7a4f2e7..5a91bbe 100644 --- a/scripts/hak/hakEnv.js +++ b/scripts/hak/hakEnv.js @@ -80,7 +80,7 @@ module.exports = class HakEnv { return this.getRuntimeAbi() + '-' + this.target.platform + '-' + this.target.arch; } - getRustTarget() { + getTargetId() { return this.target.id; }