diff options
author | Steve Holme <steve_holme@hotmail.com> | 2018-02-10 15:28:10 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2019-04-08 22:36:23 +0100 |
commit | c4e0be44089408d65220ab0174ad3443724092a0 (patch) | |
tree | 09bd60cdde03269d94742aec03b732a70981dbdf /projects | |
parent | b1923b90f51a3c426ab1ed3105d6c9037e665e83 (diff) |
build-openssl.bat: Fixed support for OpenSSL v1.1.0+
Diffstat (limited to 'projects')
-rw-r--r-- | projects/build-openssl.bat | 357 |
1 files changed, 240 insertions, 117 deletions
diff --git a/projects/build-openssl.bat b/projects/build-openssl.bat index 4d08dca5a..793a63be7 100644 --- a/projects/build-openssl.bat +++ b/projects/build-openssl.bat @@ -176,9 +176,6 @@ rem *************************************************************************** rem Check the start directory exists if not exist "%START_DIR%" goto noopenssl - rem Check that OpenSSL is not unsupported version 1.1.0 - if not exist "%START_DIR%\ms\do_ms.bat" goto unsupported - :setup if "%BUILD_PLATFORM%" == "" ( if "%VC_VER%" == "6.0" ( @@ -207,6 +204,12 @@ rem *************************************************************************** if "%VC_VER%" == "14.1" set VCVARS_PLATFORM=amd64 ) + if exist "%START_DIR%\ms\do_ms.bat" ( + set LEGACY_BUILD=TRUE + ) else ( + set LEGACY_BUILD=FALSE + ) + :start echo. set SAVED_PATH=%CD% @@ -234,37 +237,43 @@ rem *************************************************************************** if not exist %OUTDIR% md %OUTDIR% if not "%BUILD_CONFIG%" == "release" ( - rem Configuring 64-bit Debug Build - call :configure x64 debug + rem Configuring 64-bit Static Library Debug Build + call :configure x64 debug static %LEGACY_BUILD% + + rem Perform the build + call :build x64 static %LEGACY_BUILD% - rem Perform the static library build - call :build x64 static + rem Perform the install + call :install debug static %LEGACY_BUILD% - rem Perform the static library install - call :install debug static + rem Configuring 64-bit Shared Library Debug Build + call :configure x64 debug shared %LEGACY_BUILD% - rem Perform the 64-bit shared library build - call :build x64 shared + rem Perform the build + call :build x64 shared %LEGACY_BUILD% - rem Perform the shared library install - call :install debug shared + rem Perform the install + call :install debug shared %LEGACY_BUILD% ) if not "%BUILD_CONFIG%" == "debug" ( - rem Configuring 64-bit Release Build - call :configure x64 release + rem Configuring 64-bit Static Library Release Build + call :configure x64 release static %LEGACY_BUILD% - rem Perform the static library build - call :build x64 static + rem Perform the build + call :build x64 static %LEGACY_BUILD% - rem Perform the static library install - call :install release static + rem Perform the install + call :install release static %LEGACY_BUILD% - rem Perform the shared library build - call :build x64 shared + rem Configuring 64-bit Shared Library Release Build + call :configure x64 release shared %LEGACY_BUILD% - rem Perform the shared library install - call :install release shared + rem Perform the build + call :build x64 shared %LEGACY_BUILD% + + rem Perform the install + call :install release shared %LEGACY_BUILD% ) goto success @@ -275,37 +284,43 @@ rem *************************************************************************** if not exist %OUTDIR% md %OUTDIR% if not "%BUILD_CONFIG%" == "release" ( - rem Configuring 32-bit Debug Build - call :configure x86 debug + rem Configuring 32-bit Static Library Debug Build + call :configure x86 debug static %LEGACY_BUILD% + + rem Perform the build + call :build x86 static %LEGACY_BUILD% - rem Perform the static library build - call :build x86 static + rem Perform the install + call :install debug static %LEGACY_BUILD% - rem Perform the static library install - call :install debug static + rem Configuring 32-bit Shared Library Debug Build + call :configure x86 debug shared %LEGACY_BUILD% - rem Perform the shared library build - call :build x86 shared + rem Perform the build + call :build x86 shared %LEGACY_BUILD% - rem Perform the shared library install - call :install debug shared + rem Perform the install + call :install debug shared %LEGACY_BUILD% ) if not "%BUILD_CONFIG%" == "debug" ( - rem Configuring 32-bit Release Build - call :configure x86 release + rem Configuring 32-bit Static Library Release Build + call :configure x86 release static %LEGACY_BUILD% + + rem Perform the build + call :build x86 static %LEGACY_BUILD% - rem Perform the static library build - call :build x86 static + rem Perform the install + call :install release static %LEGACY_BUILD% - rem Perform the static library install - call :install release static + rem Configuring 32-bit Shared Library Release Build + call :configure x86 release shared %LEGACY_BUILD% - rem Perform the shared library build - call :build x86 shared + rem Perform the build + call :build x86 shared %LEGACY_BUILD% - rem Perform the shared library install - call :install release shared + rem Perform the install + call :install release shared %LEGACY_BUILD% ) goto success @@ -314,36 +329,85 @@ rem Function to configure the build. rem rem %1 - Platform (x86 or x64) rem %2 - Configuration (release or debug) +rem %3 - Build Type (static or shared) +rem %4 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE) rem :configure setlocal if "%1" == "" exit /B 1 if "%2" == "" exit /B 1 + if "%3" == "" exit /B 1 + if "%4" == "" exit /B 1 + + if "%4" == "TRUE" ( + rem Calculate the build directory + set build_dir=%cd% + + rem Calculate the configure options + if "%1" == "x86" ( + if "%2" == "debug" ( + set options=debug-VC-WIN32 + ) else if "%2" == "release" ( + set options=VC-WIN32 + ) else ( + exit /B 1 + ) - if "%1" == "x86" ( - if "%2" == "debug" ( - set options=debug-VC-WIN32 - ) else if "%2" == "release" ( + set options=!options! no-asm + ) else if "%1" == "x64" ( + if "%2" == "debug" ( + set options=debug-VC-WIN64A + ) else if "%2" == "release" ( + set options=VC-WIN64A + ) else ( + exit /B 1 + ) + ) else ( + exit /B 1 + ) + ) else if "%4" == "FALSE" ( + rem Has configure already been ran? + if exist makefile ( + rem Clean up the previous build + nmake clean + + rem Remove the old makefile + del makefile 1>nul + ) + + rem Calculate the build directory + set build_dir=%cd%\build\tmp + + rem Calculate the configure options + if "%1" == "x86" ( set options=VC-WIN32 + ) else if "%1" == "x64" ( + set options=VC-WIN64A ) else ( exit /B 1 ) - set options=!options! no-asm - ) else if "%1" == "x64" ( if "%2" == "debug" ( - set options=debug-VC-WIN64A + set options=!options! --debug ) else if "%2" == "release" ( - set options=VC-WIN64A + set options=!options! --release ) else ( exit /B 1 ) + + if "%3" == "static" ( + set options=!options! no-shared + ) else if not "%3" == "shared" ( + exit /B 1 + ) + + set options=!options! no-asm ) else ( exit /B 1 ) - set options=%options% --prefix=%CD% + set options=%options% --prefix=%build_dir% rem Run the configure perl Configure %options% @@ -354,25 +418,33 @@ rem Main build function. rem rem %1 - Platform (x86 or x64) rem %2 - Build Type (static or shared) +rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE) rem :build setlocal if "%1" == "" exit /B 1 if "%2" == "" exit /B 1 + if "%3" == "" exit /B 1 - if "%1" == "x86" ( - call ms\do_ms.bat - ) else if "%1" == "x64" ( - call ms\do_win64a.bat - ) else ( - exit /B 1 - ) + if "%3" == "TRUE" ( + if "%1" == "x86" ( + call ms\do_ms.bat + ) else if "%1" == "x64" ( + call ms\do_win64a.bat + ) else ( + exit /B 1 + ) - if "%2" == "static" ( - nmake -f ms\nt.mak - ) else if "%2" == "shared" ( - nmake -f ms\ntdll.mak + if "%2" == "static" ( + nmake -f ms\nt.mak + ) else if "%2" == "shared" ( + nmake -f ms\ntdll.mak + ) else ( + exit /B 1 + ) + ) else if "%2" == "FALSE" ( + nmake ) else ( exit /B 1 ) @@ -383,76 +455,135 @@ rem Main installation function. rem rem %1 - Configuration (release or debug) rem %2 - Build Type (static or shared) +rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE) rem :install setlocal if "%1" == "" exit /B 1 if "%2" == "" exit /B 1 + if "%3" == "" exit /B 1 rem Copy the generated files to our directory structure - if "%1" == "debug" ( - if "%2" == "static" ( - rem Move the output directories - if exist "%OUTDIR%\LIB Debug" ( - copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul - rd out32.dbg /s /q - ) else ( - move out32.dbg "%OUTDIR%\LIB Debug" 1>nul - ) + if "%3" == "TRUE" ( + if "%1" == "debug" ( + if "%2" == "static" ( + rem Move the output directories + if exist "%OUTDIR%\LIB Debug" ( + copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul + rd out32.dbg /s /q + ) else ( + move out32.dbg "%OUTDIR%\LIB Debug" 1>nul + ) - rem Move the PDB files - move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul + rem Move the PDB files + move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul - rem Remove the intermediate directories - rd tmp32.dbg /s /q - ) else if "%2" == "shared" ( - if exist "%OUTDIR%\DLL Debug" ( - copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul - rd out32dll.dbg /s /q + rem Remove the intermediate directories + rd tmp32.dbg /s /q + ) else if "%2" == "shared" ( + if exist "%OUTDIR%\DLL Debug" ( + copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul + rd out32dll.dbg /s /q + ) else ( + move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul + ) + + rem Move the PDB files + move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul + + rem Remove the intermediate directories + rd tmp32dll.dbg /s /q ) else ( - move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul + exit /B 1 ) + ) else if "%1" == "release" ( + if "%2" == "static" ( + rem Move the output directories + if exist "%OUTDIR%\LIB Release" ( + copy /y out32\* "%OUTDIR%\LIB Release" 1>nul + rd out32 /s /q + ) else ( + move out32 "%OUTDIR%\LIB Release" 1>nul + ) - rem Move the PDB files - move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul + rem Move the PDB files + move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul - rem Remove the intermediate directories - rd tmp32dll.dbg /s /q - ) else ( - exit /B 1 - ) - ) else if "%1" == "release" ( - if "%2" == "static" ( - rem Move the output directories - if exist "%OUTDIR%\LIB Release" ( - copy /y out32\* "%OUTDIR%\LIB Release" 1>nul - rd out32 /s /q + rem Remove the intermediate directories + rd tmp32 /s /q + ) else if "%2" == "shared" ( + if exist "%OUTDIR%\DLL Release" ( + copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul + rd out32dll /s /q + ) else ( + move out32dll "%OUTDIR%\DLL Release" 1>nul + ) + + rem Move the PDB files + move tmp32dll\lib.pdb "%OUTDIR%\DLL Release" 1>nul + + rem Remove the intermediate directories + rd tmp32dll /s /q ) else ( - move out32 "%OUTDIR%\LIB Release" 1>nul + exit /B 1 ) + ) + ) else if "%3" == "FALSE" ( + rem Calculate the build directory + set build_dir=%cd%\build\tmp + + rem Perform the installation + nmake install_sw + + rem Move the output directories + if "%1" == "debug" ( + if "%2" == "static" ( + if not exist "%OUTDIR%\LIB Debug" ( + mkdir "%OUTDIR%\LIB Debug" 1>nul + ) - rem Move the PDB files - move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul + move !build_dir!\lib\*.lib "%OUTDIR%\LIB Debug" 1>nul + move !build_dir!\bin\*.exe "%OUTDIR%\LIB Debug" 1>nul + ) else if "%2" == "shared" ( + if not exist "%OUTDIR%\DLL Debug" ( + mkdir "%OUTDIR%\DLL Debug" 1>nul + ) - rem Remove the intermediate directories - rd tmp32 /s /q - ) else if "%2" == "shared" ( - if exist "%OUTDIR%\DLL Release" ( - copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul - rd out32dll /s /q + move !build_dir!\lib\*.lib "%OUTDIR%\DLL Debug" 1>nul + move !build_dir!\bin\*.dll "%OUTDIR%\DLL Debug" 1>nul + move !build_dir!\bin\*.exe "%OUTDIR%\DLL Debug" 1>nul + move !build_dir!\bin\*.pdb "%OUTDIR%\DLL Debug" 1>nul ) else ( - move out32dll "%OUTDIR%\DLL Release" 1>nul + exit /B 1 ) + ) else if "%1" == "release" ( + if "%2" == "static" ( + if not exist "%OUTDIR%\LIB Release" ( + mkdir "%OUTDIR%\LIB Release" 1>nul + ) - rem Move the PDB files - move tmp32dll\lib.pdb "%OUTDIR%\DLL Release" 1>nul - - rem Remove the intermediate directories - rd tmp32dll /s /q + move !build_dir!\lib\*.lib "%OUTDIR%\LIB Release" 1>nul + move !build_dir!\bin\*.exe "%OUTDIR%\LIB Release" 1>nul + ) else if "%2" == "shared" ( + if not exist "%OUTDIR%\DLL Release" ( + mkdir "%OUTDIR%\DLL Release" 1>nul + ) + + move !build_dir!\lib\*.lib "%OUTDIR%\DLL Release" 1>nul + move !build_dir!\bin\*.dll "%OUTDIR%\DLL Release" 1>nul + move !build_dir!\bin\*.exe "%OUTDIR%\DLL Release" 1>nul + ) else ( + exit /B 1 + ) ) else ( exit /B 1 ) + + rem Remove the output directories + rd !build_dir! /s /q + ) else ( + exit /B 1 ) exit /B 0 @@ -537,14 +668,6 @@ rem echo Error: Cannot locate OpenSSL source directory goto error -:unsupported - echo. - echo Error: Unsupported OpenSSL version. - echo The pre-generated project files and this build script only support the - echo LTS version of OpenSSL ^(v1.0.2^). The next version of this build script - echo will support OpenSSL v1.1.0. - goto error - :error if "%OS%" == "Windows_NT" endlocal exit /B 1 |