From 604842172646c40085d7de1af1c0495531eb63ce Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Mon, 22 Jun 2020 11:22:42 +0200 Subject: [PATCH] build,win: use x64 Node when building for ARM64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses x64 node executable for running .js files in arm64 cross-compilation scenarios. MSI can now be created by running `vcbuild.bat release msi arm64` Refs: https://github.com/nodejs/node/issues/25998 Refs: https://github.com/nodejs/node/issues/32582 PR-URL: https://github.com/nodejs/node/pull/34009 Reviewed-By: James M Snell Reviewed-By: João Reis --- .gitignore | 3 +++ BUILDING.md | 2 ++ vcbuild.bat | 21 ++++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5b07ec4a8e3cdc..75039956cb18b1 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,9 @@ _UpgradeReport_Files/ # Ignore dependencies fetched by deps/v8/tools/node/fetch_deps.py /deps/.cipd +# === Rules for Windows vcbuild.bat === +/temp-vcbuild + # === Global Rules === # Keep last to avoid being excluded *.pyc diff --git a/BUILDING.md b/BUILDING.md index 5c7494a15f1e61..71aedb10f55dd9 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -545,6 +545,8 @@ Optional requirements to build the MSI installer package: * The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension) or the [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension). +* The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if + building for Windows 10 on ARM (ARM64). Optional requirements for compiling for Windows 10 on ARM (ARM64): diff --git a/vcbuild.bat b/vcbuild.bat index 79214217e5bd54..07fc92e4fb9106 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -397,7 +397,26 @@ if errorlevel 1 echo Failed to sign exe&goto exit @rem Skip license.rtf generation if not requested. if not defined licensertf goto stage_package -%node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf +set "use_x64_node_exe=false" +if "%target_arch%"=="arm64" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set "use_x64_node_exe=true" +if "%use_x64_node_exe%"=="true" ( + echo Cross-compilation to ARM64 detected. We'll use the x64 Node executable for license2rtf. + if not defined "%x64_node_exe%" set "x64_node_exe=temp-vcbuild\node-x64-cross-compiling.exe" + if not exist "%x64_node_exe%" ( + echo Downloading x64 node.exe... + if not exist "temp-vcbuild" mkdir temp-vcbuild + powershell -c "Invoke-WebRequest -Uri 'https://nodejs.org/dist/latest/win-x64/node.exe' -OutFile 'temp-vcbuild\node-x64-cross-compiling.exe'" + ) + if not exist "%x64_node_exe%" ( + echo Could not find the Node executable at the given x64_node_exe path. Aborting. + set exit_code=1 + goto exit + ) + %x64_node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf +) else ( + %node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf +) + if errorlevel 1 echo Failed to generate license.rtf&goto exit :stage_package