James E. King, III | 4d651ab | 2017-02-19 22:19:55 -0500 | [diff] [blame^] | 1 | :: |
| 2 | :: Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | :: you may not use this file except in compliance with the License. |
| 4 | :: You may obtain a copy of the License at |
| 5 | :: |
| 6 | :: http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | :: |
| 8 | :: Unless required by applicable law or agreed to in writing, software |
| 9 | :: distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | :: See the License for the specific language governing permissions and |
| 12 | :: limitations under the License. |
| 13 | :: |
| 14 | |
| 15 | :: |
| 16 | :: Build script for openssl on windows |
| 17 | :: openssl uses an in-tree build so you have to clean between each one |
| 18 | :: |
| 19 | :: Uses the environment set up by a Visual Studio Command Prompt shortcut |
| 20 | :: to target a specific architecture and compiler |
| 21 | :: |
| 22 | :: If you use Lavasoft Ad-Aware, disable it for this build. It blocks the creation |
| 23 | :: of any file named "clienthellotest.exe" for whatever reason, which breaks the build. |
| 24 | :: |
| 25 | |
| 26 | @ECHO OFF |
| 27 | SETLOCAL EnableDelayedExpansion |
| 28 | |
| 29 | :: Sets variables for third party versions used in build |
| 30 | CALL ..\..\scripts\tpversions.bat || EXIT /B |
| 31 | |
| 32 | :: use "build-openssl.bat /yes" to skip the question part |
| 33 | IF /I "%1" == "/YES" SET NOASK=1 |
| 34 | |
| 35 | IF NOT DEFINED PACKAGE_NAME SET PACKAGE_NAME=openssl |
| 36 | IF NOT DEFINED PACKAGE_VERSION SET PACKAGE_VERSION=%TP_OPENSSL_VERSION% |
| 37 | IF NOT DEFINED SOURCEDIR SET SOURCEDIR=%~dp0%PACKAGE_NAME%-%PACKAGE_VERSION% |
| 38 | IF NOT DEFINED WIN3P_ROOT SET WIN3P_ROOT=%~dp0.. |
| 39 | |
| 40 | :: Set COMPILER to (vc100 - vc140) depending on the current environment |
| 41 | CALL ..\..\scripts\cl_setcompiler.bat || EXIT /B |
| 42 | |
| 43 | :: Set ARCH to either win32 or x64 depending on the current environment |
| 44 | CALL ..\..\scripts\cl_setarch.bat || EXIT /B |
| 45 | |
| 46 | IF "%ARCH%" == "x64" ( |
| 47 | SET TODO=debug-VC-WIN64A VC-WIN64A |
| 48 | ) ELSE ( |
| 49 | SET TODO=debug-VC-WIN32 VC-WIN32 |
| 50 | ) |
| 51 | |
| 52 | FOR %%X IN ( !TODO! ) DO ( |
| 53 | SET BUILDTYPE=%%X |
| 54 | FOR %%Y IN ( |
| 55 | nt |
| 56 | ntdll |
| 57 | ) DO ( |
| 58 | SET LIBTYPE=%%Y |
| 59 | |
| 60 | IF "!BUILDTYPE:~0,6!" == "debug-" ( |
| 61 | SET OUTBUILDTYPE=debug |
| 62 | SET ZLIBLIBSUFFIX=d |
| 63 | ) ELSE ( |
| 64 | SET OUTBUILDTYPE=release |
| 65 | SET ZLIBLIBSUFFIX= |
| 66 | ) |
| 67 | |
| 68 | IF "!LIBTYPE!" == "ntdll" ( |
| 69 | SET BUILD_OPTIONS=shared |
| 70 | SET OUTLIBTYPE=dynamic |
| 71 | SET ZLIBLIB=zlib!ZLIBLIBSUFFIX! |
| 72 | SET ZLIBOPT=zlib-dynamic |
| 73 | ) ELSE ( |
| 74 | SET BUILD_OPTIONS=no-shared |
| 75 | SET OUTLIBTYPE=static |
| 76 | SET ZLIBLIB=zlibstatic!ZLIBLIBSUFFIX!.lib |
| 77 | SET ZLIBOPT=zlib |
| 78 | ) |
| 79 | |
| 80 | SET LIB=%~dp0..\dist\zlib-%TP_ZLIB_VERSION%\!COMPILER!\!ARCH!\lib;!LIB! |
| 81 | SET BUILD_OPTIONS=!BUILD_OPTIONS! no-asm no-unit-test !ZLIBOPT! --openssldir=ssl --with-zlib-include=%~dp0..\dist\zlib-%TP_ZLIB_VERSION%\!COMPILER!\!ARCH!\include --with-zlib-lib=!ZLIBLIB! |
| 82 | SET OUTDIR=%WIN3P_ROOT%\dist\%PACKAGE_NAME%-%PACKAGE_VERSION%\%COMPILER%\%ARCH%\!OUTBUILDTYPE!\!OUTLIBTYPE! |
| 83 | |
| 84 | ECHO/ |
| 85 | ECHO ========================================================================= |
| 86 | ECHO Building: %PACKAGE_NAME% %PACKAGE_VERSION% %COMPILER%:%ARCH%:!OUTBUILDTYPE!:!OUTLIBTYPE! [!BUILDTYPE!] |
| 87 | ECHO Configure Options: !BUILD_OPTIONS! |
| 88 | ECHO Install Directory: !OUTDIR! |
| 89 | ECHO Source Directory: %SOURCEDIR% |
| 90 | ECHO ========================================================================= |
| 91 | ECHO/ |
| 92 | |
| 93 | IF NOT DEFINED NOASK ( |
| 94 | CHOICE /M "Do you want to build this configuration? " /c YN |
| 95 | IF !ERRORLEVEL! NEQ 1 (EXIT /B !ERRORLEVEL!) |
| 96 | ) |
| 97 | |
| 98 | CD %SOURCEDIR% || EXIT /B |
| 99 | perl Configure !BUILDTYPE! --prefix="!OUTDIR!" !BUILD_OPTIONS! || EXIT /B |
| 100 | NMAKE /FMakefile install_sw || EXIT /B |
| 101 | NMAKE /FMakefile clean || EXIT /B |
| 102 | ) |
| 103 | ) |
| 104 | |
| 105 | ENDLOCAL |
| 106 | EXIT /B |