From eec659c138f3afcd51a25cd8b197d715a47baa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Sat, 24 Mar 2018 22:56:59 +0000 Subject: [PATCH] build, tools, win: add nasm detection for OpenSSL OpenSSL-1.1.0 requires the nasm assembler for building asm files on Windows. This finds nasm at \Program Files\NASM\nasm.exe or \ProgramFiles(x86)\NASM\nasm.exe in vcbuild.bat for users who did not add its path in their enviroments. Fixes: https://github.com/nodejs/build/issues/1190 Fixes: https://github.com/nodejs/node/issues/4270 PR-URL: https://github.com/nodejs/node/pull/19794 Reviewed-By: Shigeki Ohtsu Reviewed-By: James M Snell Reviewed-By: Rod Vagg Reviewed-By: Michael Dawson --- BUILDING.md | 3 +++ tools/msvs/find_nasm.cmd | 19 +++++++++++++++++++ vcbuild.bat | 3 +++ 3 files changed, 25 insertions(+) create mode 100644 tools/msvs/find_nasm.cmd diff --git a/BUILDING.md b/BUILDING.md index 19b227af40..4a93b37efa 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -258,6 +258,9 @@ Prerequisites: * Basic Unix tools required for some tests, [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. +* **Optional** (for OpenSSL assembler modules): the [NetWide Assembler](http://www.nasm.us/), + if not installed in the default location it needs to be manually added + to `PATH`. * **Optional** (to build the MSI): the [WiX Toolset v3.11](http://wixtoolset.org/releases/) and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension). diff --git a/tools/msvs/find_nasm.cmd b/tools/msvs/find_nasm.cmd new file mode 100644 index 0000000000..d30d213116 --- /dev/null +++ b/tools/msvs/find_nasm.cmd @@ -0,0 +1,19 @@ +@IF NOT DEFINED DEBUG_HELPER @ECHO OFF + +ECHO Looking for NASM + +FOR /F "delims=" %%a IN ('where nasm 2^> NUL') DO ( + EXIT /B 0 +) + +IF EXIST "%ProgramFiles%\NASM\nasm.exe" ( + SET "Path=%Path%;%ProgramFiles%\NASM" + EXIT /B 0 +) + +IF EXIST "%ProgramFiles(x86)%\NASM\nasm.exe" ( + SET "Path=%Path%;%ProgramFiles(x86)%\NASM" + EXIT /B 0 +) + +EXIT /B 1 diff --git a/vcbuild.bat b/vcbuild.bat index f1353d114a..19e3d1881c 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -170,6 +170,9 @@ if "%target%"=="Clean" rmdir /S /Q %~dp0deps\icu call tools\msvs\find_python.cmd if errorlevel 1 goto :exit +call tools\msvs\find_nasm.cmd +if errorlevel 1 echo Could not find NASM, it will not be used. + call :getnodeversion || exit /b 1 if defined TAG set configure_flags=%configure_flags% --tag=%TAG%