1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

build-openssl.bat: Fixed support for OpenSSL v1.1.0+

This commit is contained in:
Steve Holme 2018-02-10 15:28:10 +00:00
parent b1923b90f5
commit c4e0be4408

View File

@ -176,9 +176,6 @@ rem ***************************************************************************
rem Check the start directory exists rem Check the start directory exists
if not exist "%START_DIR%" goto noopenssl 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 :setup
if "%BUILD_PLATFORM%" == "" ( if "%BUILD_PLATFORM%" == "" (
if "%VC_VER%" == "6.0" ( if "%VC_VER%" == "6.0" (
@ -207,6 +204,12 @@ rem ***************************************************************************
if "%VC_VER%" == "14.1" set VCVARS_PLATFORM=amd64 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 :start
echo. echo.
set SAVED_PATH=%CD% set SAVED_PATH=%CD%
@ -234,37 +237,43 @@ rem ***************************************************************************
if not exist %OUTDIR% md %OUTDIR% if not exist %OUTDIR% md %OUTDIR%
if not "%BUILD_CONFIG%" == "release" ( if not "%BUILD_CONFIG%" == "release" (
rem Configuring 64-bit Debug Build rem Configuring 64-bit Static Library Debug Build
call :configure x64 debug call :configure x64 debug static %LEGACY_BUILD%
rem Perform the static library build rem Perform the build
call :build x64 static call :build x64 static %LEGACY_BUILD%
rem Perform the static library install rem Perform the install
call :install debug static call :install debug static %LEGACY_BUILD%
rem Perform the 64-bit shared library build rem Configuring 64-bit Shared Library Debug Build
call :build x64 shared call :configure x64 debug shared %LEGACY_BUILD%
rem Perform the shared library install rem Perform the build
call :install debug shared call :build x64 shared %LEGACY_BUILD%
rem Perform the install
call :install debug shared %LEGACY_BUILD%
) )
if not "%BUILD_CONFIG%" == "debug" ( if not "%BUILD_CONFIG%" == "debug" (
rem Configuring 64-bit Release Build rem Configuring 64-bit Static Library Release Build
call :configure x64 release call :configure x64 release static %LEGACY_BUILD%
rem Perform the static library build rem Perform the build
call :build x64 static call :build x64 static %LEGACY_BUILD%
rem Perform the static library install rem Perform the install
call :install release static call :install release static %LEGACY_BUILD%
rem Perform the shared library build rem Configuring 64-bit Shared Library Release Build
call :build x64 shared call :configure x64 release shared %LEGACY_BUILD%
rem Perform the shared library install rem Perform the build
call :install release shared call :build x64 shared %LEGACY_BUILD%
rem Perform the install
call :install release shared %LEGACY_BUILD%
) )
goto success goto success
@ -275,37 +284,43 @@ rem ***************************************************************************
if not exist %OUTDIR% md %OUTDIR% if not exist %OUTDIR% md %OUTDIR%
if not "%BUILD_CONFIG%" == "release" ( if not "%BUILD_CONFIG%" == "release" (
rem Configuring 32-bit Debug Build rem Configuring 32-bit Static Library Debug Build
call :configure x86 debug call :configure x86 debug static %LEGACY_BUILD%
rem Perform the static library build rem Perform the build
call :build x86 static call :build x86 static %LEGACY_BUILD%
rem Perform the static library install rem Perform the install
call :install debug static call :install debug static %LEGACY_BUILD%
rem Perform the shared library build rem Configuring 32-bit Shared Library Debug Build
call :build x86 shared call :configure x86 debug shared %LEGACY_BUILD%
rem Perform the shared library install rem Perform the build
call :install debug shared call :build x86 shared %LEGACY_BUILD%
rem Perform the install
call :install debug shared %LEGACY_BUILD%
) )
if not "%BUILD_CONFIG%" == "debug" ( if not "%BUILD_CONFIG%" == "debug" (
rem Configuring 32-bit Release Build rem Configuring 32-bit Static Library Release Build
call :configure x86 release call :configure x86 release static %LEGACY_BUILD%
rem Perform the static library build rem Perform the build
call :build x86 static call :build x86 static %LEGACY_BUILD%
rem Perform the static library install rem Perform the install
call :install release static call :install release static %LEGACY_BUILD%
rem Perform the shared library build rem Configuring 32-bit Shared Library Release Build
call :build x86 shared call :configure x86 release shared %LEGACY_BUILD%
rem Perform the shared library install rem Perform the build
call :install release shared call :build x86 shared %LEGACY_BUILD%
rem Perform the install
call :install release shared %LEGACY_BUILD%
) )
goto success goto success
@ -314,36 +329,85 @@ rem Function to configure the build.
rem rem
rem %1 - Platform (x86 or x64) rem %1 - Platform (x86 or x64)
rem %2 - Configuration (release or debug) 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 rem
:configure :configure
setlocal setlocal
if "%1" == "" exit /B 1 if "%1" == "" exit /B 1
if "%2" == "" exit /B 1 if "%2" == "" exit /B 1
if "%3" == "" exit /B 1
if "%4" == "" exit /B 1
if "%1" == "x86" ( if "%4" == "TRUE" (
if "%2" == "debug" ( rem Calculate the build directory
set options=debug-VC-WIN32 set build_dir=%cd%
) else if "%2" == "release" (
set options=VC-WIN32 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
)
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 ( ) else (
exit /B 1 exit /B 1
) )
) else if "%4" == "FALSE" (
rem Has configure already been ran?
if exist makefile (
rem Clean up the previous build
nmake clean
set options=!options! no-asm rem Remove the old makefile
) else if "%1" == "x64" ( del makefile 1>nul
if "%2" == "debug" ( )
set options=debug-VC-WIN64A
) else if "%2" == "release" ( 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 set options=VC-WIN64A
) else ( ) else (
exit /B 1 exit /B 1
) )
if "%2" == "debug" (
set options=!options! --debug
) else if "%2" == "release" (
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 ( ) else (
exit /B 1 exit /B 1
) )
set options=%options% --prefix=%CD% set options=%options% --prefix=%build_dir%
rem Run the configure rem Run the configure
perl Configure %options% perl Configure %options%
@ -354,25 +418,33 @@ rem Main build function.
rem rem
rem %1 - Platform (x86 or x64) rem %1 - Platform (x86 or x64)
rem %2 - Build Type (static or shared) rem %2 - Build Type (static or shared)
rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
rem rem
:build :build
setlocal setlocal
if "%1" == "" exit /B 1 if "%1" == "" exit /B 1
if "%2" == "" exit /B 1 if "%2" == "" exit /B 1
if "%3" == "" exit /B 1
if "%1" == "x86" ( if "%3" == "TRUE" (
call ms\do_ms.bat if "%1" == "x86" (
) else if "%1" == "x64" ( call ms\do_ms.bat
call ms\do_win64a.bat ) else if "%1" == "x64" (
) else ( call ms\do_win64a.bat
exit /B 1 ) else (
) exit /B 1
)
if "%2" == "static" ( if "%2" == "static" (
nmake -f ms\nt.mak nmake -f ms\nt.mak
) else if "%2" == "shared" ( ) else if "%2" == "shared" (
nmake -f ms\ntdll.mak nmake -f ms\ntdll.mak
) else (
exit /B 1
)
) else if "%2" == "FALSE" (
nmake
) else ( ) else (
exit /B 1 exit /B 1
) )
@ -383,76 +455,135 @@ rem Main installation function.
rem rem
rem %1 - Configuration (release or debug) rem %1 - Configuration (release or debug)
rem %2 - Build Type (static or shared) rem %2 - Build Type (static or shared)
rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
rem rem
:install :install
setlocal setlocal
if "%1" == "" exit /B 1 if "%1" == "" exit /B 1
if "%2" == "" exit /B 1 if "%2" == "" exit /B 1
if "%3" == "" exit /B 1
rem Copy the generated files to our directory structure rem Copy the generated files to our directory structure
if "%1" == "debug" ( if "%3" == "TRUE" (
if "%2" == "static" ( if "%1" == "debug" (
rem Move the output directories if "%2" == "static" (
if exist "%OUTDIR%\LIB Debug" ( rem Move the output directories
copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul if exist "%OUTDIR%\LIB Debug" (
rd out32.dbg /s /q 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 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 ( ) else (
move out32.dbg "%OUTDIR%\LIB 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 rem Move the PDB files
move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul
rem Remove the intermediate directories rem Remove the intermediate directories
rd tmp32.dbg /s /q rd tmp32 /s /q
) else if "%2" == "shared" ( ) else if "%2" == "shared" (
if exist "%OUTDIR%\DLL Debug" ( if exist "%OUTDIR%\DLL Release" (
copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul
rd out32dll.dbg /s /q 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 ( ) else (
move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul exit /B 1
) )
)
) else if "%3" == "FALSE" (
rem Calculate the build directory
set build_dir=%cd%\build\tmp
rem Move the PDB files rem Perform the installation
move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul nmake install_sw
rem Remove the intermediate directories rem Move the output directories
rd tmp32dll.dbg /s /q if "%1" == "debug" (
if "%2" == "static" (
if not exist "%OUTDIR%\LIB Debug" (
mkdir "%OUTDIR%\LIB Debug" 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
)
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 (
exit /B 1
)
) else if "%1" == "release" (
if "%2" == "static" (
if not exist "%OUTDIR%\LIB Release" (
mkdir "%OUTDIR%\LIB Release" 1>nul
)
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 ( ) else (
exit /B 1 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 rem Remove the output directories
move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul rd !build_dir! /s /q
) else (
rem Remove the intermediate directories exit /B 1
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 (
exit /B 1
)
) )
exit /B 0 exit /B 0
@ -537,14 +668,6 @@ rem
echo Error: Cannot locate OpenSSL source directory echo Error: Cannot locate OpenSSL source directory
goto error 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 :error
if "%OS%" == "Windows_NT" endlocal if "%OS%" == "Windows_NT" endlocal
exit /B 1 exit /B 1