build-openssl.bat: Perfer the use of if statements rather than goto (where possible)

This commit is contained in:
Steve Holme 2019-04-06 22:07:58 +01:00
parent a4df34294f
commit b1923b90f5

View File

@ -45,99 +45,99 @@ rem ***************************************************************************
) )
:parseArgs :parseArgs
if "%~1" == "" goto prerequisites if not "%~1" == "" (
if /i "%~1" == "vc6" (
set VC_VER=6.0
set VC_DESC=VC6
set "VC_PATH=Microsoft Visual Studio\VC98"
) else if /i "%~1" == "vc7" (
set VC_VER=7.0
set VC_DESC=VC7
set "VC_PATH=Microsoft Visual Studio .NET\Vc7"
) else if /i "%~1" == "vc7.1" (
set VC_VER=7.1
set VC_DESC=VC7.1
set "VC_PATH=Microsoft Visual Studio .NET 2003\Vc7"
) else if /i "%~1" == "vc8" (
set VC_VER=8.0
set VC_DESC=VC8
set "VC_PATH=Microsoft Visual Studio 8\VC"
) else if /i "%~1" == "vc9" (
set VC_VER=9.0
set VC_DESC=VC9
set "VC_PATH=Microsoft Visual Studio 9.0\VC"
) else if /i "%~1" == "vc10" (
set VC_VER=10.0
set VC_DESC=VC10
set "VC_PATH=Microsoft Visual Studio 10.0\VC"
) else if /i "%~1" == "vc11" (
set VC_VER=11.0
set VC_DESC=VC11
set "VC_PATH=Microsoft Visual Studio 11.0\VC"
) else if /i "%~1" == "vc12" (
set VC_VER=12.0
set VC_DESC=VC12
set "VC_PATH=Microsoft Visual Studio 12.0\VC"
) else if /i "%~1" == "vc14" (
set VC_VER=14.0
set VC_DESC=VC14
set "VC_PATH=Microsoft Visual Studio 14.0\VC"
) else if /i "%~1" == "vc14.1" (
set VC_VER=14.1
set VC_DESC=VC14.1
if /i "%~1" == "vc6" ( rem Determine the VC14.1 path based on the installed edition in descending
set VC_VER=6.0 rem order (Enterprise, then Professional and finally Community)
set VC_DESC=VC6 if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\VC98" set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
) else if /i "%~1" == "vc7" ( ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
set VC_VER=7.0 set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
set VC_DESC=VC7 ) else (
set "VC_PATH=Microsoft Visual Studio .NET\Vc7" set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
) else if /i "%~1" == "vc7.1" ( )
set VC_VER=7.1 ) else if /i "%~1%" == "x86" (
set VC_DESC=VC7.1 set BUILD_PLATFORM=x86
set "VC_PATH=Microsoft Visual Studio .NET 2003\Vc7" ) else if /i "%~1%" == "x64" (
) else if /i "%~1" == "vc8" ( set BUILD_PLATFORM=x64
set VC_VER=8.0 ) else if /i "%~1%" == "debug" (
set VC_DESC=VC8 set BUILD_CONFIG=debug
set "VC_PATH=Microsoft Visual Studio 8\VC" ) else if /i "%~1%" == "release" (
) else if /i "%~1" == "vc9" ( set BUILD_CONFIG=release
set VC_VER=9.0 ) else if /i "%~1" == "-?" (
set VC_DESC=VC9 goto syntax
set "VC_PATH=Microsoft Visual Studio 9.0\VC" ) else if /i "%~1" == "-h" (
) else if /i "%~1" == "vc10" ( goto syntax
set VC_VER=10.0 ) else if /i "%~1" == "-help" (
set VC_DESC=VC10 goto syntax
set "VC_PATH=Microsoft Visual Studio 10.0\VC" ) else if /i "%~1" == "-VSpath" (
) else if /i "%~1" == "vc11" ( if "%~2" == "" (
set VC_VER=11.0 echo.
set VC_DESC=VC11 echo Error. Please provide VS Path.
set "VC_PATH=Microsoft Visual Studio 11.0\VC" goto error
) else if /i "%~1" == "vc12" ( ) else (
set VC_VER=12.0 set "ABS_VC_PATH=%~2\VC"
set VC_DESC=VC12 shift
set "VC_PATH=Microsoft Visual Studio 12.0\VC" )
) else if /i "%~1" == "vc14" ( ) else if /i "%~1" == "-perlpath" (
set VC_VER=14.0 if "%~2" == "" (
set VC_DESC=VC14 echo.
set "VC_PATH=Microsoft Visual Studio 14.0\VC" echo Error. Please provide Perl root Path.
) else if /i "%~1" == "vc14.1" ( goto error
set VC_VER=14.1 ) else (
set VC_DESC=VC14.1 set "PERL_PATH=%~2"
shift
)
) else (
if not defined START_DIR (
set START_DIR=%~1%
) else (
goto unknown
)
)
rem Determine the VC14.1 path based on the installed edition in descending shift & goto parseArgs
rem order (Enterprise, then Professional and finally Community)
if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
) else (
set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
)
) else if /i "%~1%" == "x86" (
set BUILD_PLATFORM=x86
) else if /i "%~1%" == "x64" (
set BUILD_PLATFORM=x64
) else if /i "%~1%" == "debug" (
set BUILD_CONFIG=debug
) else if /i "%~1%" == "release" (
set BUILD_CONFIG=release
) else if /i "%~1" == "-?" (
goto syntax
) else if /i "%~1" == "-h" (
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%
) else (
goto unknown
)
) )
shift & goto parseArgs
:prerequisites :prerequisites
rem Compiler is a required parameter rem Compiler is a required parameter
if not defined VC_VER goto syntax if not defined VC_VER goto syntax
@ -233,41 +233,39 @@ rem ***************************************************************************
set OUTDIR=build\Win64\%VC_DESC% set OUTDIR=build\Win64\%VC_DESC%
if not exist %OUTDIR% md %OUTDIR% if not exist %OUTDIR% md %OUTDIR%
if "%BUILD_CONFIG%" == "release" goto x64release if not "%BUILD_CONFIG%" == "release" (
rem Configuring 64-bit Debug Build
call :configure x64 debug
:x64debug rem Perform the static library build
rem Configuring 64-bit Debug Build call :build x64 static
call :configure x64 debug
rem Perform the static library build rem Perform the static library install
call :build x64 static call :install debug static
rem Perform the static library install rem Perform the 64-bit shared library build
call :install debug static call :build x64 shared
rem Perform the 64-bit shared library build rem Perform the shared library install
call :build x64 shared call :install debug shared
)
rem Perform the shared library install if not "%BUILD_CONFIG%" == "debug" (
call :install debug shared rem Configuring 64-bit Release Build
call :configure x64 release
if "%BUILD_CONFIG%" == "debug" goto success rem Perform the static library build
call :build x64 static
:x64release rem Perform the static library install
rem Configuring 64-bit Release Build call :install release static
call :configure x64 release
rem Perform the static library build rem Perform the shared library build
call :build x64 static call :build x64 shared
rem Perform the static library install rem Perform the shared library install
call :install release static call :install release shared
)
rem Perform the shared library build
call :build x64 shared
rem Perform the shared library install
call :install release shared
goto success goto success
@ -276,41 +274,39 @@ rem ***************************************************************************
set OUTDIR=build\Win32\%VC_DESC% set OUTDIR=build\Win32\%VC_DESC%
if not exist %OUTDIR% md %OUTDIR% if not exist %OUTDIR% md %OUTDIR%
if "%BUILD_CONFIG%" == "release" goto x86release if not "%BUILD_CONFIG%" == "release" (
rem Configuring 32-bit Debug Build
call :configure x86 debug
:x86debug rem Perform the static library build
rem Configuring 32-bit Debug Build call :build x86 static
call :configure x86 debug
rem Perform the static library build rem Perform the static library install
call :build x86 static call :install debug static
rem Perform the static library install rem Perform the shared library build
call :install debug static call :build x86 shared
rem Perform the shared library build rem Perform the shared library install
call :build x86 shared call :install debug shared
)
rem Perform the shared library install if not "%BUILD_CONFIG%" == "debug" (
call :install debug shared rem Configuring 32-bit Release Build
call :configure x86 release
if "%BUILD_CONFIG%" == "debug" goto success rem Perform the static library build
call :build x86 static
:x86release rem Perform the static library install
rem Configuring 32-bit Release Build call :install release static
call :configure x86 release
rem Perform the static library build rem Perform the shared library build
call :build x86 static call :build x86 shared
rem Perform the static library install rem Perform the shared library install
call :install release static call :install release shared
)
rem Perform the shared library build
call :build x86 shared
rem Perform the shared library install
call :install release shared
goto success goto success