• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2setlocal
3rem Simple script to fetch source for external libraries
4
5set 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
15if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts
16if "%~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%"
28)
29
30if "%DO_FETCH%"=="false" goto end
31:fetch
32
33if "%ORG%"=="" (set ORG=python)
34
35call "%PCBUILD%\find_python.bat" "%PYTHON%"
36
37echo.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...
46        %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -O %ORG% %%e
47    )
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
58set binaries=%binaries%     redist-1
59set 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...
66        %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -b -O %ORG% %%b
67    )
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
92