2017-06-10 16:58:42 -03:00
|
|
|
@echo off
|
|
|
|
setlocal
|
|
|
|
rem Simple script to fetch source for external libraries
|
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
if "%PCBUILD%"=="" (set PCBUILD=%~dp0)
|
|
|
|
if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals)
|
2017-06-10 16:58:42 -03:00
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
set DO_FETCH=true
|
|
|
|
set DO_CLEAN=false
|
2017-07-17 06:15:48 -03:00
|
|
|
set IncludeTkinterSrc=false
|
|
|
|
set IncludeSSLSrc=false
|
2017-06-10 16:58:42 -03:00
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
:CheckOpts
|
|
|
|
if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts
|
2017-07-17 06:15:48 -03:00
|
|
|
if "%~1"=="--tkinter-src" (set IncludeTkinterSrc=true) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--openssl-src" (set IncludeSSLSrc=true) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts
|
2017-06-16 00:08:51 -03:00
|
|
|
if "%~1"=="--organization" (set ORG=%2) & shift & shift & goto CheckOpts
|
|
|
|
if "%~1"=="-c" (set DO_CLEAN=true) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--clean" (set DO_CLEAN=true) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--clean-only" (set DO_FETCH=false) & goto clean
|
2017-07-17 06:15:48 -03:00
|
|
|
|
|
|
|
rem Include old options for compatibility
|
|
|
|
if "%~1"=="--no-tkinter" shift & goto CheckOpts
|
|
|
|
if "%~1"=="--no-openssl" shift & goto CheckOpts
|
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
if "x%~1" NEQ "x" goto usage
|
2017-06-10 16:58:42 -03:00
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
if "%DO_CLEAN%"=="false" goto fetch
|
2017-06-10 16:58:42 -03:00
|
|
|
:clean
|
|
|
|
echo.Cleaning up external libraries.
|
2017-06-16 00:08:51 -03:00
|
|
|
if exist "%EXTERNALS_DIR%" (
|
|
|
|
rem Sometimes this fails the first time; try it twice
|
|
|
|
rmdir /s /q "%EXTERNALS_DIR%" || rmdir /s /q "%EXTERNALS_DIR%"
|
2017-06-10 16:58:42 -03:00
|
|
|
)
|
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
if "%DO_FETCH%"=="false" goto end
|
2017-06-10 16:58:42 -03:00
|
|
|
:fetch
|
2017-06-16 00:08:51 -03:00
|
|
|
|
|
|
|
if "%ORG%"=="" (set ORG=python)
|
2017-12-30 19:17:36 -04:00
|
|
|
call "%PCBUILD%\find_python.bat" "%PYTHON%"
|
2017-06-10 16:58:42 -03:00
|
|
|
|
2017-07-17 10:43:55 -03:00
|
|
|
if "%PYTHON%"=="" (
|
|
|
|
where /Q git || echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1
|
|
|
|
)
|
|
|
|
|
2017-06-10 16:58:42 -03:00
|
|
|
echo.Fetching external libraries...
|
|
|
|
|
|
|
|
set libraries=
|
2017-07-17 06:15:48 -03:00
|
|
|
set libraries=%libraries% bzip2-1.0.6
|
2018-12-11 00:16:46 -04:00
|
|
|
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.0j
|
2017-11-06 23:31:53 -04:00
|
|
|
set libraries=%libraries% sqlite-3.21.0.0
|
2018-02-23 12:44:27 -04:00
|
|
|
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.8.0
|
|
|
|
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.8.0
|
2017-07-17 06:15:48 -03:00
|
|
|
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tix-8.4.3.6
|
|
|
|
set libraries=%libraries% xz-5.2.2
|
2017-09-06 21:29:37 -03:00
|
|
|
set libraries=%libraries% zlib-1.2.11
|
2017-06-10 16:58:42 -03:00
|
|
|
|
|
|
|
for %%e in (%libraries%) do (
|
2017-06-16 00:08:51 -03:00
|
|
|
if exist "%EXTERNALS_DIR%\%%e" (
|
2017-06-10 16:58:42 -03:00
|
|
|
echo.%%e already exists, skipping.
|
2017-07-17 10:43:55 -03:00
|
|
|
) else if "%PYTHON%"=="" (
|
|
|
|
echo.Fetching %%e with git...
|
|
|
|
git clone --depth 1 https://github.com/%ORG%/cpython-source-deps --branch %%e "%EXTERNALS_DIR%\%%e"
|
2017-06-10 16:58:42 -03:00
|
|
|
) else (
|
|
|
|
echo.Fetching %%e...
|
2018-02-17 23:31:37 -04:00
|
|
|
%PYTHON% -E "%PCBUILD%\get_external.py" -O %ORG% -e "%EXTERNALS_DIR%" %%e
|
2017-06-16 00:08:51 -03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
echo.Fetching external binaries...
|
|
|
|
|
|
|
|
set binaries=
|
2018-12-11 00:16:46 -04:00
|
|
|
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.0j
|
2018-02-23 12:44:27 -04:00
|
|
|
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.8.0
|
2017-07-17 06:15:48 -03:00
|
|
|
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
|
2017-06-16 00:08:51 -03:00
|
|
|
|
|
|
|
for %%b in (%binaries%) do (
|
|
|
|
if exist "%EXTERNALS_DIR%\%%b" (
|
|
|
|
echo.%%b already exists, skipping.
|
2017-07-17 10:43:55 -03:00
|
|
|
) else if "%PYTHON%"=="" (
|
|
|
|
echo.Fetching %%b with git...
|
|
|
|
git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b"
|
2017-06-16 00:08:51 -03:00
|
|
|
) else (
|
|
|
|
echo.Fetching %%b...
|
2018-02-17 23:31:37 -04:00
|
|
|
%PYTHON% -E "%PCBUILD%\get_external.py" -b -O %ORG% -e "%EXTERNALS_DIR%" %%b
|
2017-06-10 16:58:42 -03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2017-06-16 00:08:51 -03:00
|
|
|
echo Finished.
|
2017-06-10 16:58:42 -03:00
|
|
|
goto end
|
|
|
|
|
|
|
|
:usage
|
2017-06-16 00:08:51 -03:00
|
|
|
echo.Valid options: -c, --clean, --clean-only, --organization, --python,
|
|
|
|
echo.--no-tkinter, --no-openssl
|
2017-06-10 16:58:42 -03:00
|
|
|
echo.
|
2017-06-16 00:08:51 -03:00
|
|
|
echo.Pull all sources and binaries necessary for compiling optional extension
|
|
|
|
echo.modules that rely on external libraries.
|
2017-06-10 16:58:42 -03:00
|
|
|
echo.
|
2017-06-16 00:08:51 -03:00
|
|
|
echo.The --organization option determines which github organization to download
|
|
|
|
echo.from, the --python option determines which Python 3.6+ interpreter to use
|
|
|
|
echo.with PCbuild\get_external.py.
|
|
|
|
echo.
|
|
|
|
echo.Use the -c or --clean option to remove the entire externals directory.
|
2017-06-10 16:58:42 -03:00
|
|
|
echo.
|
|
|
|
echo.Use the --clean-only option to do the same cleaning, without pulling in
|
|
|
|
echo.anything new.
|
|
|
|
echo.
|
|
|
|
exit /b -1
|
|
|
|
|
|
|
|
:end
|