1@echo off 2setlocal 3rem Simple script to fetch source for external libraries 4 5if "%PCBUILD%"=="" (set PCBUILD=%~dp0) 6if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) 7 8set DO_FETCH=true 9set DO_CLEAN=false 10 11:CheckOpts 12if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts 13if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts 14if "%~1"=="--python" (set PYTHON_FOR_BUILD=%2) & shift & shift & goto CheckOpts 15if "%~1"=="--organization" (set ORG=%2) & shift & shift & goto CheckOpts 16if "%~1"=="-c" (set DO_CLEAN=true) & shift & goto CheckOpts 17if "%~1"=="--clean" (set DO_CLEAN=true) & shift & goto CheckOpts 18if "%~1"=="--clean-only" (set DO_FETCH=false) & goto clean 19if "x%~1" NEQ "x" goto usage 20 21if "%DO_CLEAN%"=="false" goto fetch 22:clean 23echo.Cleaning up external libraries. 24if exist "%EXTERNALS_DIR%" ( 25 rem Sometimes this fails the first time; try it twice 26 rmdir /s /q "%EXTERNALS_DIR%" || rmdir /s /q "%EXTERNALS_DIR%" 27) 28 29if "%DO_FETCH%"=="false" goto end 30:fetch 31 32if "%ORG%"=="" (set ORG=python) 33call "%PCBUILD%\find_python.bat" "%PYTHON%" 34 35git 2>&1 > nul 36if ERRORLEVEL 9009 ( 37 if "%PYTHON%"=="" ( 38 echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1 39 ) 40) 41 42echo.Fetching external libraries... 43 44rem When updating these versions, remember to update the relevant property 45rem files in both this dir and PC\VS9.0 46 47set libraries= 48set libraries=%libraries% bzip2-1.0.6 49if NOT "%IncludeBsddb%"=="false" set libraries=%libraries% bsddb-4.7.25.0 50if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2p 51set libraries=%libraries% sqlite-3.14.2.0 52if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-8.5.19.0 53if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.5.19.0 54if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.5 55 56for %%e in (%libraries%) do ( 57 if exist "%EXTERNALS_DIR%\%%e" ( 58 echo.%%e already exists, skipping. 59 ) else if "%PYTHON%"=="" ( 60 echo.Fetching %%e with git... 61 git clone --depth 1 https://github.com/%ORG%/cpython-source-deps --branch %%e "%EXTERNALS_DIR%\%%e" 62 ) else ( 63 echo.Fetching %%e... 64 %PYTHON% "%PCBUILD%\get_external.py" -O %ORG% %%e 65 ) 66) 67 68echo.Fetching external binaries... 69 70set binaries= 71set binaries=%binaries% 72if NOT "%IncludeSSL%"=="false" set binaries=%binaries% nasm-2.11.06 73 74for %%b in (%binaries%) do ( 75 if exist "%EXTERNALS_DIR%\%%b" ( 76 echo.%%b already exists, skipping. 77 ) else if "%PYTHON%"=="" ( 78 echo.Fetching %%b with git... 79 git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b" 80 ) else ( 81 echo.Fetching %%b... 82 %PYTHON% "%PCBUILD%\get_external.py" -b -O %ORG% %%b 83 ) 84) 85 86echo Finished. 87goto end 88 89:usage 90echo.Valid options: -c, --clean, --clean-only, --organization, --python, 91echo.--no-tkinter, --no-openssl 92echo. 93echo.Pull all sources and binaries necessary for compiling optional extension 94echo.modules that rely on external libraries. 95echo. 96echo.The --organization option determines which github organization to download 97echo.from, the --python option determines which Python 3.6+ interpreter to use 98echo.with PCbuild\get_external.py. 99echo. 100echo.Use the -c or --clean option to remove the entire externals directory. 101echo. 102echo.Use the --clean-only option to do the same cleaning, without pulling in 103echo.anything new. 104echo. 105exit /b -1 106 107:end 108