• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2setlocal
3set D=%~dp0
4set PCBUILD=%D%..\..\PCbuild\
5if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD%
6
7set BUILDX86=
8set BUILDX64=
9set BUILDARM32=
10set REBUILD=
11set OUTPUT=
12set PACKAGES=
13set PYTHON_EXE=
14
15:CheckOpts
16if "%~1" EQU "-h" goto Help
17if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
18if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
19if "%~1" EQU "-arm32" (set BUILDARM32=1) && shift && goto CheckOpts
20if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
21if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
22if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
23if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts
24if "%~1" EQU "--python-exe" (set PYTHON_EXE="/p:PythonExe=%~2") && shift && shift && goto CheckOpts
25
26if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM32 (set BUILDX86=1) && (set BUILDX64=1) && (set BUILDARM32=1)
27
28call "%D%..\msi\get_externals.bat"
29call "%PCBUILD%find_msbuild.bat" %MSBUILD%
30if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
31
32if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%"
33
34if defined BUILDX86 (
35    if defined REBUILD ( call "%PCBUILD%build.bat" -e -r
36    ) else if not exist "%Py_OutDir%win32\python.exe" call "%PCBUILD%build.bat" -e
37    if errorlevel 1 goto :eof
38
39    %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% %PYTHON_EXE%
40    if errorlevel 1 goto :eof
41)
42
43if defined BUILDX64 (
44    if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
45    ) else if not exist "%Py_OutDir%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e
46    if errorlevel 1 goto :eof
47
48    %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% %PYTHON_EXE%
49    if errorlevel 1 goto :eof
50)
51
52if defined BUILDARM32 (
53    if defined REBUILD ( call "%PCBUILD%build.bat" -p ARM -e -r --no-tkinter
54    ) else if not exist "%Py_OutDir%arm32\python.exe" call "%PCBUILD%build.bat" -p ARM -e --no-tkinter
55    if errorlevel 1 goto :eof
56
57    %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=ARM %OUTPUT% %PACKAGES% %PYTHON_EXE%
58    if errorlevel 1 goto :eof
59)
60
61exit /B 0
62
63:Help
64echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h]
65echo.
66echo    -x86                Build x86 installers
67echo    -x64                Build x64 installers
68echo    -r                  Rebuild rather than incremental build
69echo    --out [DIR]         Override output directory
70echo    -h                  Show usage
71