Zachary Ware | 5fe8ac6 | 2017-06-11 14:19:39 -0500 | [diff] [blame] | 1 | @echo off |
| 2 | setlocal |
| 3 | rem Simple script to fetch source for external libraries |
| 4 | |
| 5 | if not exist "%~dp0..\externals" mkdir "%~dp0..\externals" |
| 6 | pushd "%~dp0..\externals" |
| 7 | |
| 8 | if "%SVNROOT%"=="" set SVNROOT=http://svn.python.org/projects/external/ |
| 9 | |
| 10 | rem Optionally clean up first. Be warned that this can be very destructive! |
| 11 | if not "%1"=="" ( |
| 12 | for %%c in (-c --clean --clean-only) do ( |
| 13 | if "%1"=="%%c" goto clean |
| 14 | ) |
| 15 | goto usage |
| 16 | ) |
| 17 | goto fetch |
| 18 | |
| 19 | :clean |
| 20 | echo.Cleaning up external libraries. |
| 21 | for /D %%d in ( |
| 22 | bzip2-* |
| 23 | db-* |
| 24 | nasm-* |
| 25 | openssl-* |
| 26 | tcl-* |
| 27 | tcltk* |
| 28 | tk-* |
| 29 | tix-* |
| 30 | sqlite-* |
| 31 | xz-* |
| 32 | ) do ( |
| 33 | echo.Removing %%d |
| 34 | rmdir /s /q %%d |
| 35 | ) |
| 36 | if "%1"=="--clean-only" ( |
| 37 | goto end |
| 38 | ) |
| 39 | |
| 40 | :fetch |
| 41 | rem Fetch current versions |
| 42 | |
| 43 | svn --version > nul 2>&1 |
| 44 | if ERRORLEVEL 9009 ( |
| 45 | echo.svn.exe must be on your PATH. |
| 46 | echo.Try TortoiseSVN (http://tortoisesvn.net/^) and be sure to check the |
| 47 | echo.command line tools option. |
| 48 | popd |
| 49 | exit /b 1 |
| 50 | ) |
| 51 | |
| 52 | echo.Fetching external libraries... |
| 53 | |
| 54 | rem When updating these versions, remember to update the relevant property |
| 55 | rem files in both this dir and PC\VS9.0 |
| 56 | |
| 57 | set libraries= |
| 58 | set libraries=%libraries% bzip2-1.0.6 |
| 59 | if NOT "%IncludeBsddb%"=="false" set libraries=%libraries% db-4.7.25.0 |
| 60 | if NOT "%IncludeSSL%"=="false" set libraries=%libraries% nasm-2.11.06 |
| 61 | if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2k |
| 62 | set libraries=%libraries% sqlite-3.8.11.0 |
| 63 | if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-8.5.15.0 |
| 64 | if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.5.15.0 |
| 65 | if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.5 |
| 66 | |
| 67 | for %%e in (%libraries%) do ( |
| 68 | if exist %%e ( |
| 69 | echo.%%e already exists, skipping. |
| 70 | ) else ( |
| 71 | echo.Fetching %%e... |
| 72 | svn export -q %SVNROOT%%%e |
| 73 | ) |
| 74 | ) |
| 75 | |
| 76 | goto end |
| 77 | |
| 78 | :usage |
| 79 | echo.invalid argument: %1 |
| 80 | echo.usage: %~n0 [[ -c ^| --clean ] ^| --clean-only ] |
| 81 | echo. |
| 82 | echo.Pull all sources necessary for compiling optional extension modules |
| 83 | echo.that rely on external libraries. Requires svn.exe to be on your PATH |
| 84 | echo.and pulls sources from %SVNROOT%. |
| 85 | echo. |
| 86 | echo.Use the -c or --clean option to clean up all external library sources |
| 87 | echo.before pulling in the current versions. |
| 88 | echo. |
| 89 | echo.Use the --clean-only option to do the same cleaning, without pulling in |
| 90 | echo.anything new. |
| 91 | echo. |
| 92 | echo.Only the first argument is checked, all others are ignored. |
| 93 | echo. |
| 94 | echo.**WARNING**: the cleaning options unconditionally remove any directory |
| 95 | echo.that is a child of |
| 96 | echo. %CD% |
| 97 | echo.and matches wildcard patterns beginning with bzip2-, db-, nasm-, openssl-, |
| 98 | echo.tcl-, tcltk, tk-, tix-, sqlite-, or xz-, and as such has the potential |
| 99 | echo.to be very destructive if you are not aware of what it is doing. Use with |
| 100 | echo.caution! |
| 101 | popd |
| 102 | exit /b -1 |
| 103 | |
| 104 | |
| 105 | :end |
| 106 | echo Finished. |
| 107 | popd |