From a65a75e9b3cf0f2d5572105ab54a6a0b96f1d71d Mon Sep 17 00:00:00 2001 From: patelvivekv1993 <37296449+patelvivekv1993@users.noreply.github.com> Date: Thu, 5 Apr 2018 16:36:05 +0530 Subject: build-openssl.bat: allow custom paths for VS and perl Fixes #2430 Closes #2457 --- projects/build-openssl.bat | 90 +++++++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 24 deletions(-) (limited to 'projects') diff --git a/projects/build-openssl.bat b/projects/build-openssl.bat index 21709b76b..f5ff12d5e 100644 --- a/projects/build-openssl.bat +++ b/projects/build-openssl.bat @@ -109,6 +109,24 @@ rem *************************************************************************** goto syntax ) else if /i "%~1" == "-help" ( goto syntax + ) else if /i "%~1" == "-VSpath" ( + if "%~2" == "" ( + echo. + echo Error. Please provide VS Path. + goto error + ) else ( + set "ABS_VC_PATH=%~2\VC" + shift + ) + ) else if /i "%~1" == "-perlpath" ( + if "%~2" == "" ( + echo. + echo Error. Please provide Perl root Path. + goto error + ) else ( + set "PERL_PATH=%~2" + shift + ) ) else ( if not defined START_DIR ( set START_DIR=%~1% @@ -126,25 +144,37 @@ rem *************************************************************************** rem Default the start directory if one isn't specified if not defined START_DIR set START_DIR=..\..\openssl - rem Check we have a program files directory - if not defined PF goto nopf - + if not defined ABS_VC_PATH ( + rem Check we have a program files directory + if not defined PF goto nopf + set "ABS_VC_PATH=%PF%\%VC_PATH%" + ) + rem Check we have Visual Studio installed - if not exist "%PF%\%VC_PATH%" goto novc - - rem Check we have Perl in our path - echo %PATH% | findstr /I /C:"\Perl" 1>nul - if errorlevel 1 ( - rem It isn't so check we have it installed and set the path if it is - if exist "%SystemDrive%\Perl" ( - set "PATH=%SystemDrive%\Perl\bin;%PATH%" - ) else ( - if exist "%SystemDrive%\Perl64" ( - set "PATH=%SystemDrive%\Perl64\bin;%PATH%" - ) else ( - goto noperl - ) - ) + if not exist "%ABS_VC_PATH%" goto novc + + + if not defined PERL_PATH ( + rem Check we have Perl in our path + rem using !! below as %% was having \Microsoft was unexecpted error. + echo !PATH! | findstr /I /C:"\Perl" 1>nul + if errorlevel 1 ( + rem It isn't so check we have it installed and set the path if it is + if exist "%SystemDrive%\Perl" ( + set "PATH=%SystemDrive%\Perl\bin;%PATH%" + ) else ( + if exist "%SystemDrive%\Perl64" ( + set "PATH=%SystemDrive%\Perl64\bin;%PATH%" + ) else ( + + + + goto noperl + ) + ) + ) + ) else ( + set "PATH=%PERL_PATH%\Perl\bin;%PATH%" ) rem Check the start directory exists @@ -186,15 +216,15 @@ rem *************************************************************************** set SAVED_PATH=%CD% if "%VC_VER%" == "6.0" ( - call "%PF%\%VC_PATH%\bin\vcvars32" + call "%ABS_VC_PATH%\bin\vcvars32" ) else if "%VC_VER%" == "7.0" ( - call "%PF%\%VC_PATH%\bin\vcvars32" + call "%ABS_VC_PATH%\bin\vcvars32" ) else if "%VC_VER%" == "7.1" ( - call "%PF%\%VC_PATH%\bin\vcvars32" + call "%ABS_VC_PATH%\bin\vcvars32" ) else if "%VC_VER%" == "15.0" ( - call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM% + call "%ABS_VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM% ) else ( - call "%PF%\%VC_PATH%\vcvarsall" %VCVARS_PLATFORM% + call "%ABS_VC_PATH%\vcvarsall" %VCVARS_PLATFORM% ) echo. @@ -351,7 +381,7 @@ rem *************************************************************************** :syntax rem Display the help echo. - echo Usage: build-openssl ^ [platform] [configuration] [directory] + echo Usage: build-openssl ^ [platform] [configuration] [directory] [-VSpath] ["VSpath"] [-perlpath] ["perlpath"] echo. echo Compiler: echo. @@ -379,6 +409,14 @@ rem *************************************************************************** echo Other: echo. echo directory - Specifies the OpenSSL source directory + echo. + echo -VSpath - Specify the custom VS path if Visual Studio is installed at other location + echo then "C://Microsoft Visual Studio[version] + echo For e.g. -VSpath "C:\apps\MVS14" + echo. + echo -perlpath - Specify the custom perl root path if perl is not located at "C:\Perl" and it is a + echo portable copy of perl and not installed on the win system + echo For e.g. -perlpath "D:\strawberry-perl-5.24.3.1-64bit-portable" goto error :unknown @@ -399,11 +437,15 @@ rem *************************************************************************** :novc echo. echo Error: %VC_DESC% is not installed + echo Error: Please check whether Visual compiler is installed at the path "%ABS_VC_PATH%" + echo Error: Please provide proper VS Path by using -VSpath goto error :noperl echo. echo Error: Perl is not installed + echo Error: Please check whether Perl is installed or it is at location "C:\Perl" + echo Error: If Perl is portable please provide perl root path by using -perlpath goto error :nox64 -- cgit v1.2.3