Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 1 | @setlocal
|
| 2 | @echo off
|
| 3 |
|
| 4 | rem This script is intended for building official releases of Python.
|
| 5 | rem To use it to build alternative releases, you should clone this file
|
| 6 | rem and modify the following three URIs.
|
| 7 | rem
|
| 8 | rem The first two will ensure that your release can be installed
|
| 9 | rem alongside an official Python release, while the second specifies
|
| 10 | rem the URL that will be used to download installation files. The
|
| 11 | rem files available from this URL *will* conflict with your installer.
|
| 12 | rem Trust me, you don't want them, even if it seems like a good idea.
|
| 13 |
|
| 14 | set RELEASE_URI_X86=http://www.python.org/win32
|
| 15 | set RELEASE_URI_X64=http://www.python.org/amd64
|
| 16 | set DOWNLOAD_URL_BASE=https://www.python.org/ftp/python
|
| 17 | set DOWNLOAD_URL=
|
| 18 |
|
| 19 | set D=%~dp0
|
| 20 | set PCBUILD=%D%..\..\PCBuild\
|
| 21 |
|
| 22 | set BUILDX86=
|
| 23 | set BUILDX64=
|
| 24 | set TARGET=Rebuild
|
| 25 | set TESTTARGETDIR=
|
| 26 |
|
| 27 |
|
| 28 | :CheckOpts
|
| 29 | if "%1" EQU "-h" goto Help
|
| 30 | if "%1" EQU "-c" (set CERTNAME=%~2) && shift && shift && goto CheckOpts
|
| 31 | if "%1" EQU "--certificate" (set CERTNAME=%~2) && shift && shift && goto CheckOpts
|
| 32 | if "%1" EQU "-o" (set OUTDIR=%~2) && shift && shift && goto CheckOpts
|
| 33 | if "%1" EQU "--out" (set OUTDIR=%~2) && shift && shift && goto CheckOpts
|
| 34 | if "%1" EQU "-D" (set SKIPDOC=1) && shift && goto CheckOpts
|
| 35 | if "%1" EQU "--skip-doc" (set SKIPDOC=1) && shift && goto CheckOpts
|
| 36 | if "%1" EQU "-B" (set SKIPBUILD=1) && shift && goto CheckOpts
|
| 37 | if "%1" EQU "--skip-build" (set SKIPBUILD=1) && shift && goto CheckOpts
|
| 38 | if "%1" EQU "--download" (set DOWNLOAD_URL=%~2) && shift && shift && goto CheckOpts
|
| 39 | if "%1" EQU "--test" (set TESTTARGETDIR=%~2) && shift && shift && goto CheckOpts
|
| 40 | if "%1" EQU "-b" (set TARGET=Build) && shift && goto CheckOpts
|
| 41 | if "%1" EQU "--build" (set TARGET=Build) && shift && goto CheckOpts
|
| 42 | if "%1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
|
| 43 | if "%1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
|
| 44 |
|
| 45 | if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
|
| 46 |
|
| 47 | :builddoc
|
| 48 | if "%SKIPBUILD%" EQU "1" goto skipdoc
|
| 49 | if "%SKIPDOC%" EQU "1" goto skipdoc
|
| 50 |
|
| 51 | if not defined PYTHON where py -q || echo Cannot find py on path and PYTHON is not set. && exit /B 1
|
| 52 | if not defined SPHINXBUILD where sphinx-build -q || echo Cannot find sphinx-build on path and SPHINXBUILD is not set. && exit /B 1
|
| 53 | call "%D%..\..\doc\make.bat" htmlhelp
|
| 54 | if errorlevel 1 goto :eof
|
| 55 | :skipdoc
|
| 56 |
|
| 57 | where hg /q || echo Cannot find Mercurial on PATH && exit /B 1
|
| 58 |
|
| 59 | where dlltool /q && goto skipdlltoolsearch
|
| 60 | set _DLLTOOL_PATH=
|
| 61 | where /R "%D%..\..\externals" dlltool > "%TEMP%\dlltool.loc" 2> nul && set /P _DLLTOOL_PATH= < "%TEMP%\dlltool.loc" & del "%TEMP%\dlltool.loc"
|
| 62 | if not exist "%_DLLTOOL_PATH%" echo Cannot find binutils on PATH or in external && exit /B 1
|
| 63 | for %%f in (%_DLLTOOL_PATH%) do set PATH=%PATH%;%%~dpf
|
| 64 | set _DLLTOOL_PATH=
|
| 65 | :skipdlltoolsearch
|
| 66 |
|
| 67 | if defined BUILDX86 (
|
| 68 | call :build x86
|
| 69 | if errorlevel 1 exit /B
|
| 70 | )
|
| 71 |
|
| 72 | if defined BUILDX64 (
|
| 73 | call :build x64
|
| 74 | if errorlevel 1 exit /B
|
| 75 | )
|
| 76 |
|
| 77 | if defined TESTTARGETDIR (
|
| 78 | call "%D%testrelease.bat" -t "%TESTTARGETDIR%"
|
| 79 | )
|
| 80 |
|
| 81 | exit /B 0
|
| 82 |
|
| 83 | :build
|
| 84 | @setlocal
|
| 85 | @echo off
|
| 86 |
|
| 87 | if "%1" EQU "x86" (
|
| 88 | call "%PCBUILD%env.bat" x86
|
| 89 | set BUILD=%PCBUILD%win32\
|
| 90 | set BUILD_PLAT=Win32
|
| 91 | set OUTDIR_PLAT=win32
|
| 92 | set OBJDIR_PLAT=x86
|
| 93 | set RELEASE_URI=%RELEASE_URI_X86%
|
| 94 | ) ELSE (
|
| 95 | call "%PCBUILD%env.bat" x86_amd64
|
| 96 | set BUILD=%PCBUILD%amd64\
|
| 97 | set BUILD_PLAT=x64
|
| 98 | set OUTDIR_PLAT=amd64
|
| 99 | set OBJDIR_PLAT=x64
|
| 100 | set RELEASE_URI=%RELEASE_URI_X64%
|
| 101 | )
|
| 102 |
|
| 103 | if exist "%BUILD%en-us" (
|
| 104 | echo Deleting %BUILD%en-us
|
| 105 | rmdir /q/s "%BUILD%en-us"
|
| 106 | if errorlevel 1 exit /B
|
| 107 | )
|
| 108 |
|
| 109 | if exist "%D%obj\Release_%OBJDIR_PLAT%" (
|
| 110 | echo Deleting "%D%obj\Release_%OBJDIR_PLAT%"
|
| 111 | rmdir /q/s "%D%obj\Release_%OBJDIR_PLAT%"
|
| 112 | if errorlevel 1 exit /B
|
| 113 | )
|
| 114 |
|
| 115 | if not "%CERTNAME%" EQU "" (
|
| 116 | set CERTOPTS="/p:SigningCertificate=%CERTNAME%"
|
| 117 | ) else (
|
| 118 | set CERTOPTS=
|
| 119 | )
|
| 120 |
|
| 121 | if not "%SKIPBUILD%" EQU "1" (
|
| 122 | call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -d -t %TARGET% %CERTOPTS%
|
| 123 | if errorlevel 1 exit /B
|
| 124 | call "%PCBUILD%build.bat" -p %BUILD_PLAT% -t %TARGET% %CERTOPTS%
|
| 125 | if errorlevel 1 exit /B
|
| 126 | @rem build.bat turns echo back on, so we disable it again
|
| 127 | @echo off
|
| 128 | )
|
| 129 |
|
| 130 | "%BUILD%python.exe" "%D%get_wix.py"
|
| 131 |
|
| 132 | set BUILDOPTS=/p:Platform=%1 /p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI%
|
| 133 | msbuild "%D%bundle\releaselocal.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true
|
| 134 | if errorlevel 1 exit /B
|
| 135 | msbuild "%D%bundle\releaseweb.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false
|
| 136 | if errorlevel 1 exit /B
|
| 137 |
|
| 138 | if not "%OUTDIR%" EQU "" (
|
| 139 | mkdir "%OUTDIR%\%OUTDIR_PLAT%"
|
| 140 | copy /Y "%BUILD%en-us\*.cab" "%OUTDIR%\%OUTDIR_PLAT%"
|
| 141 | copy /Y "%BUILD%en-us\*.exe" "%OUTDIR%\%OUTDIR_PLAT%"
|
| 142 | copy /Y "%BUILD%en-us\*.msi" "%OUTDIR%\%OUTDIR_PLAT%"
|
| 143 | copy /Y "%BUILD%en-us\*.msu" "%OUTDIR%\%OUTDIR_PLAT%"
|
| 144 | )
|
| 145 |
|
| 146 | exit /B 0
|
| 147 |
|
| 148 | :Help
|
| 149 | echo buildrelease.bat [--out DIR] [-x86] [-x64] [--certificate CERTNAME] [--build] [--skip-build]
|
| 150 | echo [--skip-doc] [--download DOWNLOAD URL] [--test TARGETDIR] [-h]
|
| 151 | echo.
|
| 152 | echo --out (-o) Specify an additional output directory for installers
|
| 153 | echo -x86 Build x86 installers
|
| 154 | echo -x64 Build x64 installers
|
| 155 | echo --build (-b) Incrementally build Python rather than rebuilding
|
| 156 | echo --skip-build (-B) Do not build Python (just do the installers)
|
| 157 | echo --skip-doc (-D) Do not build documentation
|
| 158 | echo --download Specify the full download URL for MSIs (should include {2})
|
| 159 | echo --test Specify the test directory to run the installer tests
|
| 160 | echo -h Display this help information
|
| 161 | echo.
|
| 162 | echo If no architecture is specified, all architectures will be built.
|
| 163 | echo If --test is not specified, the installer tests are not run.
|
Steve Dower | 312cef0 | 2015-02-07 22:20:48 -0800 | [diff] [blame] | 164 | echo. |