build-openssl.bat: allow custom paths for VS and perl

Fixes #2430
Closes #2457
This commit is contained in:
patelvivekv1993 2018-04-05 16:36:05 +05:30 committed by Daniel Stenberg
parent 5f3938bc4a
commit a65a75e9b3
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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
if not exist "%ABS_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 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 ^<compiler^> [platform] [configuration] [directory]
echo Usage: build-openssl ^<compiler^> [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:/<ProgramFiles>/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