Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 1 | @echo off |
| 2 | setlocal |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 3 | rem Simple script to fetch source for external libraries |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 4 | |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 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 |
Steve Dower | 68d663c | 2017-07-17 11:15:48 +0200 | [diff] [blame] | 15 | if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 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%" |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 28 | ) |
| 29 | |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 30 | if "%DO_FETCH%"=="false" goto end |
| 31 | :fetch |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 32 | |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 33 | if "%ORG%"=="" (set ORG=python) |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 34 | |
Steve Dower | 68d663c | 2017-07-17 11:15:48 +0200 | [diff] [blame] | 35 | call "%PCBUILD%\find_python.bat" "%PYTHON%" |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 36 | |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 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... |
Steve Dower | 68d663c | 2017-07-17 11:15:48 +0200 | [diff] [blame] | 46 | %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -O %ORG% %%e |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 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 |
Steve Dower | d135f20 | 2018-01-09 19:14:46 +1100 | [diff] [blame] | 58 | set binaries=%binaries% redist-1 |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 59 | set binaries=%binaries% wix |
| 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... |
Steve Dower | 68d663c | 2017-07-17 11:15:48 +0200 | [diff] [blame] | 66 | %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -b -O %ORG% %%b |
Zachary Ware | 51599e2 | 2017-06-15 22:08:51 -0500 | [diff] [blame] | 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 |