2017-06-10 19:58:42 +00:00
|
|
|
@echo off
|
|
|
|
setlocal
|
|
|
|
rem Simple script to fetch source for external libraries
|
|
|
|
|
2019-03-27 23:28:41 +00:00
|
|
|
if NOT DEFINED PCBUILD (set PCBUILD=%~dp0)
|
|
|
|
if NOT DEFINED EXTERNALS_DIR (set EXTERNALS_DIR=%PCBUILD%\..\externals)
|
2017-06-10 19:58:42 +00:00
|
|
|
|
2017-06-16 03:08:51 +00:00
|
|
|
set DO_FETCH=true
|
|
|
|
set DO_CLEAN=false
|
2019-03-29 23:30:10 +00:00
|
|
|
set IncludeLibffiSrc=false
|
2017-07-17 09:15:48 +00:00
|
|
|
set IncludeTkinterSrc=false
|
|
|
|
set IncludeSSLSrc=false
|
2017-06-10 19:58:42 +00:00
|
|
|
|
2017-06-16 03:08:51 +00:00
|
|
|
:CheckOpts
|
|
|
|
if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts
|
2019-03-29 23:30:10 +00:00
|
|
|
if "%~1"=="--no-libffi" (set IncludeLibffi=false) & shift & goto CheckOpts
|
2017-07-17 09:15:48 +00:00
|
|
|
if "%~1"=="--tkinter-src" (set IncludeTkinterSrc=true) & shift & goto CheckOpts
|
|
|
|
if "%~1"=="--openssl-src" (set IncludeSSLSrc=true) & shift & goto CheckOpts
|
2019-03-29 23:30:10 +00:00
|
|
|
if "%~1"=="--libffi-src" (set IncludeLibffiSrc=true) & shift & goto CheckOpts
|
2017-07-17 09:15:48 +00:00
|
|
|
if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts
|
2017-06-16 03:08:51 +00: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 09:15:48 +00:00
|
|
|
|
|
|
|
rem Include old options for compatibility
|
|
|
|
if "%~1"=="--no-tkinter" shift & goto CheckOpts
|
|
|
|
if "%~1"=="--no-openssl" shift & goto CheckOpts
|
|
|
|
|
2017-06-16 03:08:51 +00:00
|
|
|
if "x%~1" NEQ "x" goto usage
|
2017-06-10 19:58:42 +00:00
|
|
|
|
2017-06-16 03:08:51 +00:00
|
|
|
if "%DO_CLEAN%"=="false" goto fetch
|
2017-06-10 19:58:42 +00:00
|
|
|
:clean
|
|
|
|
echo.Cleaning up external libraries.
|
2017-06-16 03:08:51 +00: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 19:58:42 +00:00
|
|
|
)
|
|
|
|
|
2017-06-16 03:08:51 +00:00
|
|
|
if "%DO_FETCH%"=="false" goto end
|
2017-06-10 19:58:42 +00:00
|
|
|
:fetch
|
2017-06-16 03:08:51 +00:00
|
|
|
|
|
|
|
if "%ORG%"=="" (set ORG=python)
|
2017-12-30 23:17:36 +00:00
|
|
|
call "%PCBUILD%\find_python.bat" "%PYTHON%"
|
2017-06-10 19:58:42 +00:00
|
|
|
|
2019-03-21 16:02:59 +00:00
|
|
|
if NOT DEFINED PYTHON (
|
2017-07-17 13:43:55 +00:00
|
|
|
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 19:58:42 +00:00
|
|
|
echo.Fetching external libraries...
|
|
|
|
|
|
|
|
set libraries=
|
2017-07-17 09:15:48 +00:00
|
|
|
set libraries=%libraries% bzip2-1.0.6
|
2021-09-03 18:37:31 +00:00
|
|
|
if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries% libffi-3.4.2
|
2021-12-22 02:20:16 +00:00
|
|
|
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.1m
|
2022-01-28 16:29:32 +00:00
|
|
|
set libraries=%libraries% sqlite-3.37.2.0
|
2022-02-28 12:06:43 +00:00
|
|
|
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.12.1
|
|
|
|
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.12.1
|
2017-07-17 09:15:48 +00:00
|
|
|
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tix-8.4.3.6
|
|
|
|
set libraries=%libraries% xz-5.2.2
|
2017-09-07 00:29:37 +00:00
|
|
|
set libraries=%libraries% zlib-1.2.11
|
2017-06-10 19:58:42 +00:00
|
|
|
|
|
|
|
for %%e in (%libraries%) do (
|
2017-06-16 03:08:51 +00:00
|
|
|
if exist "%EXTERNALS_DIR%\%%e" (
|
2017-06-10 19:58:42 +00:00
|
|
|
echo.%%e already exists, skipping.
|
2019-03-21 16:02:59 +00:00
|
|
|
) else if NOT DEFINED PYTHON (
|
2017-07-17 13:43:55 +00:00
|
|
|
echo.Fetching %%e with git...
|
|
|
|
git clone --depth 1 https://github.com/%ORG%/cpython-source-deps --branch %%e "%EXTERNALS_DIR%\%%e"
|
2017-06-10 19:58:42 +00:00
|
|
|
) else (
|
|
|
|
echo.Fetching %%e...
|
2018-02-18 03:58:57 +00:00
|
|
|
%PYTHON% -E "%PCBUILD%\get_external.py" -O %ORG% -e "%EXTERNALS_DIR%" %%e
|
2017-06-16 03:08:51 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
echo.Fetching external binaries...
|
|
|
|
|
|
|
|
set binaries=
|
2021-09-03 18:37:31 +00:00
|
|
|
if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.4.2
|
2021-12-22 02:20:16 +00:00
|
|
|
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.1m
|
2022-02-28 12:06:43 +00:00
|
|
|
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.12.1
|
2017-07-17 09:15:48 +00:00
|
|
|
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
|
2017-06-16 03:08:51 +00:00
|
|
|
|
|
|
|
for %%b in (%binaries%) do (
|
|
|
|
if exist "%EXTERNALS_DIR%\%%b" (
|
|
|
|
echo.%%b already exists, skipping.
|
2019-03-21 16:02:59 +00:00
|
|
|
) else if NOT DEFINED PYTHON (
|
2017-07-17 13:43:55 +00:00
|
|
|
echo.Fetching %%b with git...
|
|
|
|
git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b"
|
2017-06-16 03:08:51 +00:00
|
|
|
) else (
|
|
|
|
echo.Fetching %%b...
|
2018-02-18 03:58:57 +00:00
|
|
|
%PYTHON% -E "%PCBUILD%\get_external.py" -b -O %ORG% -e "%EXTERNALS_DIR%" %%b
|
2017-06-10 19:58:42 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2017-06-16 03:08:51 +00:00
|
|
|
echo Finished.
|
2017-06-10 19:58:42 +00:00
|
|
|
goto end
|
|
|
|
|
|
|
|
:usage
|
2017-06-16 03:08:51 +00:00
|
|
|
echo.Valid options: -c, --clean, --clean-only, --organization, --python,
|
|
|
|
echo.--no-tkinter, --no-openssl
|
2017-06-10 19:58:42 +00:00
|
|
|
echo.
|
2017-06-16 03:08:51 +00:00
|
|
|
echo.Pull all sources and binaries necessary for compiling optional extension
|
|
|
|
echo.modules that rely on external libraries.
|
2017-06-10 19:58:42 +00:00
|
|
|
echo.
|
2017-06-16 03:08:51 +00: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 19:58:42 +00:00
|
|
|
echo.
|
|
|
|
echo.Use the --clean-only option to do the same cleaning, without pulling in
|
|
|
|
echo.anything new.
|
|
|
|
echo.
|
|
|
|
exit /b -1
|
|
|
|
|
|
|
|
:end
|