blob: bfdac54044234817ddfaa43b774141fafee8362c [file] [log] [blame]
Zachary Ware6b6e6872017-06-10 14:58:42 -05001@echo off
Steve Dower68d663c2017-07-17 11:15:48 +02002rem Downloads and build sources for libraries we depend upon
3
4goto Run
5:Usage
6echo.%~nx0 [flags and arguments]
7echo.
8echo.Download and build OpenSSL. This should only be performed in order to
9echo.update the binaries kept online - in most cases, the files downloaded
10echo.by the get_externals.bat script are sufficient for building CPython.
11echo.
12echo.Available flags:
13echo. -h Display this help message
14echo.
15echo.Available arguments:
16echo. --certificate (-c) The signing certificate to use for binaries.
17echo. --organization The github organization to obtain sources from.
18echo.
19exit /b 127
20
21:Run
22setlocal
23if "%PCBUILD%"=="" (set PCBUILD=%~dp0)
24if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals)
25
Steve Dowerb84bcc42017-09-09 06:13:06 -070026set OUT=
27set SRC=
Steve Dower68d663c2017-07-17 11:15:48 +020028set ORG_SETTING=
29
30:CheckOpts
31if "%~1"=="-h" shift & goto Usage
32if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts
33if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts
34if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts
Steve Dowerb84bcc42017-09-09 06:13:06 -070035if "%~1"=="-i" (SET SRC=$~2) && shift && shift && goto CheckOpts
36if "%~1"=="--in" (SET SRC=$~2) && shift && shift && goto CheckOpts
37if "%~1"=="-o" (set OUT=$~2) && shift && shift && goto CheckOpts
38if "%~1"=="--out" (set OUT=$~2) && shift && shift && goto CheckOpts
Steve Dower68d663c2017-07-17 11:15:48 +020039
40if "%~1"=="" goto Build
41echo Unrecognized option: %1
42goto Usage
43
44:Build
Steve Dowerb84bcc42017-09-09 06:13:06 -070045if not defined SRC (echo --in directory is required & exit /b 1)
46if not defined OUT (echo --out directory is required & exit /b 1)
47
Zachary Ware6c6d3a42017-12-30 17:17:36 -060048call "%PCBUILD%\find_msbuild.bat" %MSBUILD%
Steve Dower68d663c2017-07-17 11:15:48 +020049if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
50
Zachary Ware6c6d3a42017-12-30 17:17:36 -060051call "%PCBUILD%\find_python.bat" "%PYTHON%"
Steve Dower68d663c2017-07-17 11:15:48 +020052if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)
53
Zachary Ware6c6d3a42017-12-30 17:17:36 -060054call "%PCBUILD%\get_externals.bat" --openssl-src %ORG_SETTING%
Steve Dower68d663c2017-07-17 11:15:48 +020055
56if "%PERL%" == "" where perl > "%TEMP%\perl.loc" 2> nul && set /P PERL= <"%TEMP%\perl.loc" & del "%TEMP%\perl.loc"
57if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exit /b 4)
58
Zachary Ware6c6d3a42017-12-30 17:17:36 -060059%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32
Steve Dower68d663c2017-07-17 11:15:48 +020060if errorlevel 1 exit /b
Zachary Ware6c6d3a42017-12-30 17:17:36 -060061%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=x64
Steve Dower68d663c2017-07-17 11:15:48 +020062if errorlevel 1 exit /b
Steve Dowerb84bcc42017-09-09 06:13:06 -070063