Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enableextensions enabledelayedexpansion
- REM ### Builds OpenSSL
- REM ###
- REM ### A related blog post that steps through this process:
- REM ### http://developer.covenanteyes.com/building-openssl-for-visual-studio/
- set OD=%CD%
- cd /D %~dp0
- title Open SSL
- if "%1"=="" goto :USAGE
- SET PLATFORM=%1
- REM ### Set up directory structure
- if not exist src mkdir src
- if not exist src\%PLATFORM% mkdir src\%PLATFORM%
- if not exist src\%PLATFORM%\openssl-1.0.1h mkdir src\%PLATFORM%\openssl-1.0.1h
- cd /D src\%PLATFORM%\openssl-1.0.1h
- REM ### Check for currency
- if exist openssl-1.0.1h-%PLATFORM%.touch (
- echo OpenSSL %PLATFORM% is current at version 1.0.1h.
- goto :END
- )
- :DOWNLOAD
- REM ### Download the source code
- IF NOT EXIST openssl-1.0.1h.tar.gz (
- echo retrieving OpenSSL source code
- wget -nv -N https://s3.amazonaws.com/REDACTED/software/openssl/openssl-1.0.1h.tar.gz
- )
- :EXTRACT
- IF NOT EXIST openssl-1.0.1h.tar (
- rm -f 7z.1.log
- 7za.exe x -y openssl-1.0.1h.tar.gz > 7z.1.log || goto :ERROR
- attrib +h 7z.1.log
- )
- REM ### Clean the working directory
- rm -rf openssl-1.0.1h 7z.2.log
- REM ### Extract the source code
- 7za.exe x -y openssl-1.0.1h.tar -o"." > 7z.2.log || goto :ERROR
- attrib +h 7z.2.log
- :INSTALL
- if "%PLATFORM%"=="x86" GOTO :INSTALL_x86
- if "%PLATFORM%"=="x64" GOTO :INSTALL_x64
- echo "ERROR! Platform should be x86 or x64"
- REM ### -- x86 version
- :INSTALL_x86
- rm -rf OpenSSL-x86
- mkdir OpenSSL-x86
- cd /d openssl-1.0.1h
- perl.exe Configure VC-WIN32 --prefix="..\OpenSSL-x86" || goto :ERROR
- call ms\do_nasm || goto :ERROR
- call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" x86
- nmake -f ms\ntdll.mak || goto :ERROR
- nmake -f ms\ntdll.mak install || goto :ERROR
- echo x86 build complete
- touch ..\openssl-1.0.1h-%PLATFORM%.touch
- GOTO :END
- REM ### -- x64 version
- REM ### -- note, no call to "do_nasm" for x64. not sure why
- REM ### -- but the documentation instructs us thusly.
- REM ### -- We must also pass the "no-asm" directive to "Configure"
- REM ### -- and we must ensure that "nasm.exe" is *not* on the system path.
- :INSTALL_x64
- rm -rf OpenSSL-x64
- mkdir OpenSSL-x64
- cd openssl-1.0.1h
- perl.exe Configure VC-WIN64A no-asm --prefix="..\OpenSSL-x64" || goto :ERROR
- call ms\do_win64a || goto :ERROR
- call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" x64
- nmake -f ms\ntdll.mak || goto :ERROR
- nmake -f ms\ntdll.mak install || goto :ERROR
- echo x64 build complete
- touch ..\openssl-1.0.1h-%PLATFORM%.touch
- GOTO :END
- :USAGE
- echo Usage: %0 [platform]
- GOTO :END
- :ERROR
- echo Build FAILED with exit code %ERRORLEVEL%
- exit /b %ERRORLEVEL%
- :END
- cd /d %OD%
- endlocal
- :EOF
Advertisement
Add Comment
Please, Sign In to add comment