| 1 |
@echo off |
| 2 |
setlocal |
| 3 |
rem Simple script to fetch source for external libraries |
| 4 |
|
| 5 |
set HERE=%~dp0 |
| 6 |
if "%PCBUILD%"=="" (set PCBUILD=%HERE%..\..\PCbuild\) |
| 7 |
if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%HERE%..\..\externals\windows-installer) |
| 8 |
if "%NUGET%"=="" (set NUGET=%EXTERNALS_DIR%\..\nuget.exe) |
| 9 |
if "%NUGET_URL%"=="" (set NUGET_URL=https://aka.ms/nugetclidl) |
| 10 |
|
| 11 |
set DO_FETCH=true |
| 12 |
set DO_CLEAN=false |
| 13 |
|
| 14 |
:CheckOpts |
| 15 |
if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts |
| 16 |
if "%~1"=="--organization" (set ORG=%2) & shift & shift & goto CheckOpts |
| 17 |
if "%~1"=="-c" (set DO_CLEAN=true) & shift & goto CheckOpts |
| 18 |
if "%~1"=="--clean" (set DO_CLEAN=true) & shift & goto CheckOpts |
| 19 |
if "%~1"=="--clean-only" (set DO_FETCH=false) & goto clean |
| 20 |
if "x%~1" NEQ "x" goto usage |
| 21 |
|
| 22 |
if "%DO_CLEAN%"=="false" goto fetch |
| 23 |
:clean |
| 24 |
echo.Cleaning up external libraries. |
| 25 |
if exist "%EXTERNALS_DIR%" ( |
| 26 |
rem Sometimes this fails the first time; try it twice |
| 27 |
rmdir /s /q "%EXTERNALS_DIR%" || rmdir /s /q "%EXTERNALS_DIR%" |
| 28 |
) |
| 29 |
|
| 30 |
if "%DO_FETCH%"=="false" goto end |
| 31 |
:fetch |
| 32 |
|
| 33 |
if "%ORG%"=="" (set ORG=python) |
| 34 |
|
| 35 |
call "%PCBUILD%\find_python.bat" "%PYTHON%" |
| 36 |
|
| 37 |
echo.Fetching external libraries... |
| 38 |
|
| 39 |
set libraries= |
| 40 |
|
| 41 |
for %%e in (%libraries%) do ( |
| 42 |
if exist "%EXTERNALS_DIR%\%%e" ( |
| 43 |
echo.%%e already exists, skipping. |
| 44 |
) else ( |
| 45 |
echo.Fetching %%e... |
| 46 |
%PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -O %ORG% %%e |
| 47 |
) |
| 48 |
) |
| 49 |
|
| 50 |
echo.Fetching external tools... |
| 51 |
|
| 52 |
set binaries= |
| 53 |
rem We always use whatever's latest in the repo for these |
| 54 |
set binaries=%binaries% binutils |
| 55 |
set binaries=%binaries% gpg |
| 56 |
set binaries=%binaries% htmlhelp |
| 57 |
set binaries=%binaries% nuget |
| 58 |
set binaries=%binaries% redist-1 |
| 59 |
set binaries=%binaries% wix-314 |
| 60 |
|
| 61 |
for %%b in (%binaries%) do ( |
| 62 |
if exist "%EXTERNALS_DIR%\%%b" ( |
| 63 |
echo.%%b already exists, skipping. |
| 64 |
) else ( |
| 65 |
echo.Fetching %%b... |
| 66 |
%PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -b -O %ORG% %%b |
| 67 |
) |
| 68 |
) |
| 69 |
|
| 70 |
echo Finished. |
| 71 |
goto end |
| 72 |
|
| 73 |
:usage |
| 74 |
echo.Valid options: -c, --clean, --clean-only, --organization, --python, |
| 75 |
echo.--no-tkinter, --no-openssl |
| 76 |
echo. |
| 77 |
echo.Pull all sources and binaries necessary for compiling optional extension |
| 78 |
echo.modules that rely on external libraries. |
| 79 |
echo. |
| 80 |
echo.The --organization option determines which github organization to download |
| 81 |
echo.from, the --python option determines which Python 3.6+ interpreter to use |
| 82 |
echo.with PCbuild\get_external.py. |
| 83 |
echo. |
| 84 |
echo.Use the -c or --clean option to remove the entire externals directory. |
| 85 |
echo. |
| 86 |
echo.Use the --clean-only option to do the same cleaning, without pulling in |
| 87 |
echo.anything new. |
| 88 |
echo. |
| 89 |
exit /b -1 |
| 90 |
|
| 91 |
:end |