mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 15:34:59 +01:00
Merge pull request #23 from vector-im/dbkr/hak_win_x86
Build on 32 bit Windows
This commit is contained in:
commit
050501b322
@ -240,6 +240,12 @@ async function buildMatrixSeshat(hakEnv, moduleInfo) {
|
||||
|
||||
if (hakEnv.isWin()) {
|
||||
env.RUSTFLAGS = '-Ctarget-feature=+crt-static -Clink-args=libcrypto.lib';
|
||||
// Note that in general, you can specify targets in Rust without having to have
|
||||
// the matching toolchain, however for this, cargo gets confused when building
|
||||
// the build scripts since they run on the host, but vcvarsall.bat sets the c
|
||||
// compiler in the path to be the one for the target, so we just use the matching
|
||||
// toolchain for the target architecture which makes everything happy.
|
||||
env.RUSTUP_TOOLCHAIN = hakEnv.arch == 'x64' ? 'stable-x86_64-pc-windows-msvc' : 'stable-i686-pc-windows-msvc';
|
||||
}
|
||||
|
||||
console.log("Running neon with env", env);
|
||||
|
@ -34,9 +34,10 @@ module.exports = async function(hakEnv, moduleInfo) {
|
||||
});
|
||||
}
|
||||
|
||||
const tools = [];
|
||||
const tools = ['python', '--version']; // node-gyp uses python for reasons beyond comprehension
|
||||
if (hakEnv.isWin()) {
|
||||
tools.push(['perl', '--version']); // for openssl configure
|
||||
tools.push(['patch', '--version']); // to patch sqlcipher Makefile.msc
|
||||
tools.push(['nmake', '/?']);
|
||||
} else {
|
||||
tools.push(['make', '--version']);
|
||||
|
@ -42,6 +42,21 @@ function getTarget(packageJson) {
|
||||
}
|
||||
}
|
||||
|
||||
function detectArch() {
|
||||
if (process.platform === 'win32') {
|
||||
// vcvarsall.bat (the script that sets up the environment for
|
||||
// visual studio build tools) sets an env var to tell us what
|
||||
// architecture the active build tools target, so we auto-detect
|
||||
// this.
|
||||
const targetArch = process.env.VSCMD_ARG_TGT_ARCH;
|
||||
if (targetArch === 'x86') {
|
||||
return 'ia32';
|
||||
} else if (targetArch === 'x64') {
|
||||
return 'x64';
|
||||
}
|
||||
}
|
||||
return process.arch;
|
||||
}
|
||||
|
||||
module.exports = class HakEnv {
|
||||
constructor(prefix, packageJson) {
|
||||
@ -50,7 +65,7 @@ module.exports = class HakEnv {
|
||||
runtime: getRuntime(packageJson),
|
||||
target: getTarget(packageJson),
|
||||
platform: process.platform,
|
||||
arch: process.arch,
|
||||
arch: detectArch(),
|
||||
|
||||
// paths
|
||||
projectRoot: prefix,
|
||||
|
Loading…
Reference in New Issue
Block a user