blob: d66781d7c42ec49b88e75f98c3151a22f485b13b [file] [log] [blame]
Zachary Ware6b6e6872017-06-10 14:58:42 -05001@echo off
2setlocal
Zachary Ware51599e22017-06-15 22:08:51 -05003rem Simple script to fetch source for external libraries
Zachary Ware6b6e6872017-06-10 14:58:42 -05004
Zachary Ware51599e22017-06-15 22:08:51 -05005set HERE=%~dp0
6if "%PCBUILD%"=="" (set PCBUILD=%HERE%..\..\PCbuild\)
7if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%HERE%..\..\externals\windows-installer)
8if "%NUGET%"=="" (set NUGET=%EXTERNALS_DIR%\..\nuget.exe)
9if "%NUGET_URL%"=="" (set NUGET_URL=https://aka.ms/nugetclidl)
10
11set DO_FETCH=true
12set DO_CLEAN=false
13
14:CheckOpts
Steve Dower68d663c2017-07-17 11:15:48 +020015if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts
Zachary Ware51599e22017-06-15 22:08:51 -050016if "%~1"=="--organization" (set ORG=%2) & shift & shift & goto CheckOpts
17if "%~1"=="-c" (set DO_CLEAN=true) & shift & goto CheckOpts
18if "%~1"=="--clean" (set DO_CLEAN=true) & shift & goto CheckOpts
19if "%~1"=="--clean-only" (set DO_FETCH=false) & goto clean
20if "x%~1" NEQ "x" goto usage
21
22if "%DO_CLEAN%"=="false" goto fetch
23:clean
24echo.Cleaning up external libraries.
25if 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 Ware6b6e6872017-06-10 14:58:42 -050028)
29
Zachary Ware51599e22017-06-15 22:08:51 -050030if "%DO_FETCH%"=="false" goto end
31:fetch
Zachary Ware6b6e6872017-06-10 14:58:42 -050032
Zachary Ware51599e22017-06-15 22:08:51 -050033if "%ORG%"=="" (set ORG=python)
Zachary Ware6b6e6872017-06-10 14:58:42 -050034
Steve Dower68d663c2017-07-17 11:15:48 +020035call "%PCBUILD%\find_python.bat" "%PYTHON%"
Zachary Ware6b6e6872017-06-10 14:58:42 -050036
Zachary Ware51599e22017-06-15 22:08:51 -050037echo.Fetching external libraries...
38
39set libraries=
40
41for %%e in (%libraries%) do (
42 if exist "%EXTERNALS_DIR%\%%e" (
43 echo.%%e already exists, skipping.
44 ) else (
45 echo.Fetching %%e...
Steve Dower68d663c2017-07-17 11:15:48 +020046 %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -O %ORG% %%e
Zachary Ware51599e22017-06-15 22:08:51 -050047 )
48)
49
50echo.Fetching external tools...
51
52set binaries=
53rem We always use whatever's latest in the repo for these
54set binaries=%binaries% binutils
55set binaries=%binaries% gpg
56set binaries=%binaries% htmlhelp
57set binaries=%binaries% nuget
Steve Dowerd135f202018-01-09 19:14:46 +110058set binaries=%binaries% redist-1
Zachary Ware51599e22017-06-15 22:08:51 -050059set binaries=%binaries% wix
60
61for %%b in (%binaries%) do (
62 if exist "%EXTERNALS_DIR%\%%b" (
63 echo.%%b already exists, skipping.
64 ) else (
65 echo.Fetching %%b...
Steve Dower68d663c2017-07-17 11:15:48 +020066 %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -b -O %ORG% %%b
Zachary Ware51599e22017-06-15 22:08:51 -050067 )
68)
69
70echo Finished.
71goto end
72
73:usage
74echo.Valid options: -c, --clean, --clean-only, --organization, --python,
75echo.--no-tkinter, --no-openssl
76echo.
77echo.Pull all sources and binaries necessary for compiling optional extension
78echo.modules that rely on external libraries.
79echo.
80echo.The --organization option determines which github organization to download
81echo.from, the --python option determines which Python 3.6+ interpreter to use
82echo.with PCbuild\get_external.py.
83echo.
84echo.Use the -c or --clean option to remove the entire externals directory.
85echo.
86echo.Use the --clean-only option to do the same cleaning, without pulling in
87echo.anything new.
88echo.
89exit /b -1
90
91:end