From 515388a30e16b8b4442293bbfcd5b9f28e2d2bba Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 12 Jul 2017 18:29:12 +0200 Subject: [PATCH 01/10] Adds find_python.bat Updates build files to use find_python.bat Updates ssl and tkinter projects to use pre-built externals --- Doc/make.bat | 13 +- PCbuild/_hashlib.vcxproj | 11 +- PCbuild/_ssl.vcxproj | 21 +- PCbuild/_tkinter.vcxproj | 6 - PCbuild/externals.proj | 78 ++++ PCbuild/find_python.bat | 58 +++ PCbuild/get_externals.bat | 36 +- PCbuild/libeay.vcxproj | 907 ------------------------------------- PCbuild/openssl.props | 77 ---- PCbuild/openssl.vcxproj | 112 +++++ PCbuild/pcbuild.proj | 2 +- PCbuild/prepare_ssl.bat | 44 +- PCbuild/prepare_ssl.py | 20 +- PCbuild/prepare_tcltk.bat | 35 ++ PCbuild/python.props | 6 +- PCbuild/ssleay.vcxproj | 119 ----- PCbuild/tcl.vcxproj | 14 - PCbuild/tcltk.props | 5 +- PCbuild/tix.vcxproj | 8 - PCbuild/tk.vcxproj | 12 - Tools/msi/buildrelease.bat | 3 - 21 files changed, 375 insertions(+), 1212 deletions(-) create mode 100644 PCbuild/externals.proj create mode 100644 PCbuild/find_python.bat delete mode 100644 PCbuild/libeay.vcxproj delete mode 100644 PCbuild/openssl.props create mode 100644 PCbuild/openssl.vcxproj create mode 100644 PCbuild/prepare_tcltk.bat delete mode 100644 PCbuild/ssleay.vcxproj diff --git a/Doc/make.bat b/Doc/make.bat index d9c0ad0adecfe6..b9e8a759c51a72 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -5,8 +5,19 @@ pushd %~dp0 set this=%~n0 -if "%SPHINXBUILD%" EQU "" set SPHINXBUILD=sphinx-build +call ..\PCBuild\find_python.bat %PYTHON% +if "%SPHINXBUILD%" EQU "" if "%PYTHON%" NEQ "" ( + set SPHINXBUILD=%PYTHON%\..\Scripts\sphinx-build.exe + rem Cannot use %SPHINXBUILD% in the same block where we set it + if not exist "%PYTHON%\..\Scripts\sphinx-build.exe" ( + echo Installing sphinx with %PYTHON% + "%PYTHON%" -m pip install sphinx + if errorlevel 1 exit /B + ) +) + if "%PYTHON%" EQU "" set PYTHON=py +if "%SPHINXBUILD%" EQU "" set SPHINXBUILD=sphinx-build if "%1" NEQ "htmlhelp" goto :skiphhcsearch if exist "%HTMLHELP%" goto :skiphhcsearch diff --git a/PCbuild/_hashlib.vcxproj b/PCbuild/_hashlib.vcxproj index b1300cb8c9d55e..566e1ffc4bec80 100644 --- a/PCbuild/_hashlib.vcxproj +++ b/PCbuild/_hashlib.vcxproj @@ -64,7 +64,8 @@ $(opensslIncludeDir);%(AdditionalIncludeDirectories) - ws2_32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) + $(opensslOutDir);%(AdditionalLibraryDirectories) + ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) @@ -78,14 +79,6 @@ {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} false - - {10615b24-73bf-4efa-93aa-236916321317} - false - - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj index d75ebd656a7f08..979936d14b5bd1 100644 --- a/PCbuild/_ssl.vcxproj +++ b/PCbuild/_ssl.vcxproj @@ -64,7 +64,8 @@ $(opensslIncludeDir);%(AdditionalIncludeDirectories) - ws2_32.lib;crypt32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) + $(opensslOutDir);%(AdditionalLibraryDirectories) + ws2_32.lib;crypt32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) @@ -73,19 +74,15 @@ + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} false - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - - - {10615b24-73bf-4efa-93aa-236916321317} - false - {86937f53-c189-40ef-8ce8-8759d8e7d480} false @@ -94,4 +91,10 @@ + + + + + + diff --git a/PCbuild/_tkinter.vcxproj b/PCbuild/_tkinter.vcxproj index 67931067d3bcf7..6e5e2dca046665 100644 --- a/PCbuild/_tkinter.vcxproj +++ b/PCbuild/_tkinter.vcxproj @@ -81,12 +81,6 @@ {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} false - - {b5fd6f1d-129e-4bff-9340-03606fac7283} - - - {7e85eccf-a72c-4da4-9e52-884508e80ba1} - diff --git a/PCbuild/externals.proj b/PCbuild/externals.proj new file mode 100644 index 00000000000000..c0a2c2d04b4bb7 --- /dev/null +++ b/PCbuild/externals.proj @@ -0,0 +1,78 @@ + + + + {CC9B93A2-439D-4058-9D29-6DCF43774405} + Win32 + Release + + + + + $(Platform) + $(Configuration) + + Build + Clean + CleanAll + true + + + $(Platform) + $(Configuration) + + Build + Clean + CleanAll + false + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat new file mode 100644 index 00000000000000..4e1dbca414e758 --- /dev/null +++ b/PCbuild/find_python.bat @@ -0,0 +1,58 @@ +@rem +@rem Searches for python.exe and may download a private copy from nuget. +@rem +@rem This file is supposed to modify the state of the caller (specifically +@rem the MSBUILD variable), so we do not use setlocal or echo, and avoid +@rem changing any other persistent state. +@rem + +@rem No arguments provided means do full search +@if '%1' EQU '' goto :begin_search + +@rem One argument may be the full path. Use a goto so we don't try to +@rem parse the next if statement - incorrect quoting in the multi-arg +@rem case can cause us to break immediately. +@if '%2' EQU '' goto :one_arg + +@rem Entire command line may represent the full path if quoting failed. +@if exist "%*" (set PYTHON="%*") & (set _Py_Python_Source=from environment) & goto :found +@goto :begin_search + +:one_arg +@if exist "%~1" (set PYTHON="%~1") & (set _Py_Python_Source=from environment) & goto :found + +:begin_search +@set PYTHON= + +@set _Py_EXTERNALS_DIR=%EXTERNAL_DIR% +@if "%_Py_EXTERNALS_DIR%"=="" (set _Py_EXTERNALS_DIR=%~dp0\..\externals) + +@rem If we have Python in externals, use that one +@if exist "%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe" (set PYTHON="%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe") & (set _Py_Python_Source=found in externals directory) & goto :found + +@rem If py.exe finds a recent enough version, use that one +@py -3.6 -V >nul 2>&1 && (set PYTHON=py -3.6) & (set _Py_Python_Source=found with py.exe) & goto :found +) + +@if NOT exist "%_Py_EXTERNALS_DIR%" mkdir "%_Py_EXTERNALS_DIR%" +@set _Py_NUGET=%NUGET% +@set _Py_NUGET_URL=%NUGET_URL% +@if "%_Py_NUGET%"=="" (set _Py_NUGET=%EXTERNALS_DIR%\nuget.exe) +@if "%_Py_NUGET_URL%"=="" (set _Py_NUGET_URL=https://aka.ms/nugetclidl) +@if NOT exist "%_Py_NUGET%" ( + @echo Downloading nuget... + @rem NB: Must use single quotes around NUGET here, NOT double! + @rem Otherwise, a space in the path would break things + @powershell.exe -Command Invoke-WebRequest %_Py_NUGET_URL% -OutFile '%_Py_NUGET%' +) +@echo Installing Python via nuget... +@"%_Py_NUGET%" install pythonx86 -ExcludeVersion -OutputDirectory "%_Py_EXTERNALS_DIR%" +@rem Quote it here; it's not quoted later because "py -3.6" wouldn't work +@if not errorlevel 1 (set PYTHON="%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe") & (set _Py_Python_Source=found on nuget.org) & goto :found + + +@exit /b 1 + +:found +@echo Using %PYTHON% (%_Py_Python_Source%) +@set _Py_Python_Source= diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index 6e466a34484d77..e0a338dd40c35e 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -4,20 +4,25 @@ rem Simple script to fetch source for external libraries if "%PCBUILD%"=="" (set PCBUILD=%~dp0) if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) -if "%NUGET%"=="" (set NUGET=%EXTERNALS_DIR%\nuget.exe) -if "%NUGET_URL%"=="" (set NUGET_URL=https://aka.ms/nugetclidl) set DO_FETCH=true set DO_CLEAN=false +set IncludeTkinter=false +set IncludeSSL=false :CheckOpts -if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts -if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts +if "%~1"=="--tkinter" (set IncludeTkinter=true) & shift & goto CheckOpts +if "%~1"=="--openssl" (set IncludeSSL=true) & shift & goto CheckOpts if "%~1"=="--python" (set PYTHON_FOR_BUILD=%2) & shift & shift & goto CheckOpts 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 + +rem Include old options for compatibility +if "%~1"=="--no-tkinter" shift & goto CheckOpts +if "%~1"=="--no-openssl" shift & goto CheckOpts + if "x%~1" NEQ "x" goto usage if "%DO_CLEAN%"=="false" goto fetch @@ -32,24 +37,7 @@ if "%DO_FETCH%"=="false" goto end :fetch if "%ORG%"=="" (set ORG=python) - -if "%PYTHON_FOR_BUILD%"=="" ( - echo Checking for installed python... - py -3.6 -V >nul 2>&1 && (set PYTHON_FOR_BUILD=py -3.6) -) -if "%PYTHON_FOR_BUILD%"=="" ( - if NOT exist "%EXTERNALS_DIR%" mkdir "%EXTERNALS_DIR%" - if NOT exist "%NUGET%" ( - echo Downloading nuget... - rem NB: Must use single quotes around NUGET here, NOT double! - rem Otherwise, a space in the path would break things - powershell.exe -Command Invoke-WebRequest %NUGET_URL% -OutFile '%NUGET%' - ) - echo Installing Python via nuget... - "%NUGET%" install pythonx86 -ExcludeVersion -OutputDirectory "%EXTERNALS_DIR%" - rem Quote it here; it's not quoted later because "py -3.6" wouldn't work - set PYTHON_FOR_BUILD="%EXTERNALS_DIR%\pythonx86\tools\python.exe" -) +call "%PCBUILD%find_python.bat" "%PYTHON%" echo.Fetching external libraries... @@ -67,7 +55,7 @@ for %%e in (%libraries%) do ( echo.%%e already exists, skipping. ) else ( echo.Fetching %%e... - %PYTHON_FOR_BUILD% "%PCBUILD%get_external.py" -O %ORG% %%e + %PYTHON% "%PCBUILD%get_external.py" -O %ORG% %%e ) ) @@ -82,7 +70,7 @@ for %%b in (%binaries%) do ( echo.%%b already exists, skipping. ) else ( echo.Fetching %%b... - %PYTHON_FOR_BUILD% "%PCBUILD%get_external.py" -b -O %ORG% %%b + %PYTHON% "%PCBUILD%get_external.py" -b -O %ORG% %%b ) ) diff --git a/PCbuild/libeay.vcxproj b/PCbuild/libeay.vcxproj deleted file mode 100644 index 9662cd4b71509a..00000000000000 --- a/PCbuild/libeay.vcxproj +++ /dev/null @@ -1,907 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0} - libeay - - - - - - - StaticLibrary - - - - - - - - <_DATEValue>#define DATE "$([System.DateTime]::Now.ToString(`ddd MMM dd HH':'mm':'ss yyyy`))" - <_CFLAGSValue>#define CFLAGS "cl /MD /Ox -W3 -Gs0 -Gy -nologo @(PreprocessorDefinitions->'-D%(Identity)',' ')" - <_PLATFORMValue Condition="$(Platform)=='Win32'">#define PLATFORM "VC-WIN32" - <_PLATFORMValue Condition="$(Platform)=='x64'">#define PLATFORM "VC-WIN64A" - - - - - - - - - - - - $(IntDir);%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props deleted file mode 100644 index 0fc8adc9702ddf..00000000000000 --- a/PCbuild/openssl.props +++ /dev/null @@ -1,77 +0,0 @@ - - - - $(opensslDir)tmp\ - - - - - - StaticLibrary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_PreprocessorDefinitionList>@(PreprocessorDefinitions) - - - - - - 4244;4267 - $(opensslDir);$(opensslIncludeDir);$(opensslDir)crypto;$(opensslDir)crypto\asn1;$(opensslDir)crypto\evp;$(opensslDir)crypto\modes - $(_PreprocessorDefinitionList);%(PreprocessorDefinitions) - - - - - - nasm.exe -f win32 - nasm.exe -f win64 -DNEAR -Ox -g - - - - - - - - - - - diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj new file mode 100644 index 00000000000000..50793056b69fe5 --- /dev/null +++ b/PCbuild/openssl.vcxproj @@ -0,0 +1,112 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Debug + x64 + + + Release + x64 + + + + {B5FD6F1D-129E-4BFF-9340-03606FAC7283} + + + + + + + Makefile + 32 + 64 + out$(Bitness)dll + x86 + amd64 + + + + + + + + + + + ms\ntdll$(Bitness).mak + LIB_D="$(opensslOutDir.TrimEnd(`\`))" OUT_D=out$(Bitness)dll TMP_D=tmp$(Bitness)dll INC_D=inc$(Bitness) INCO_D=inc$(Bitness)\openssl + setlocal +set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';') +set VCINSTALLDIR=$(VCInstallDir) +cd /D "$(opensslDir)" +if not exist $(MakeFile) $(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) +if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" +if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" +nmake -f $(MakeFile) $(NMakeOptions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(Temp)\nmake.loc + + + <_NMakeExe Include="$(VC_ExecutablePath_x86_x86)\nmake.exe" Condition="$(VC_ExecutablePath_x86_x86) != ''" /> + + + + + + + \ No newline at end of file diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index c6b8487c0a2d9b..8d30e0895cf33c 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -55,7 +55,7 @@ - + diff --git a/PCbuild/prepare_ssl.bat b/PCbuild/prepare_ssl.bat index ef8f7ad884c52a..86185948b5d2ad 100644 --- a/PCbuild/prepare_ssl.bat +++ b/PCbuild/prepare_ssl.bat @@ -1,12 +1,34 @@ @echo off -if not defined HOST_PYTHON ( - if "%1" EQU "Debug" ( - shift - set HOST_PYTHON=python_d.exe - if not exist python37_d.dll exit 1 - ) ELSE ( - set HOST_PYTHON=python.exe - if not exist python37.dll exit 1 - ) -) -%HOST_PYTHON% "%~dp0prepare_ssl.py" %1 +setlocal +rem Downloads and build sources for libraries we depend upon + +if "%PCBUILD%"=="" (set PCBUILD=%~dp0) +if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) + +set ORG_SETTING= + +:CheckOpts +if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts +if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts +if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts + +if "%~1"=="" goto Build +echo Unrecognized option: %1 +exit /B 1 + +:Build +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) + +call "%PCBUILD%find_python.bat" "%PYTHON%" +if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3) + +call "%PCBUILD%get_externals.bat" --openssl %ORG_SETTING% + +if "%PERL%" == "" where perl > "%TEMP%\perl.loc" 2> nul && set /P PERL= <"%TEMP%\perl.loc" & del "%TEMP%\perl.loc" +if "%PERL%" == "" (echo Cannot locate perl.exe on PATH & exit /b 4) + +%MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32 +if errorlevel 1 exit /b +%MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=x64 +if errorlevel 1 exit /b diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py index 34292545192098..321badeb21e561 100644 --- a/PCbuild/prepare_ssl.py +++ b/PCbuild/prepare_ssl.py @@ -89,7 +89,7 @@ def create_asms(makefile, tmp_d): def copy_includes(makefile, suffix): - dir = 'include'+suffix+'\\openssl' + dir = 'inc'+suffix+'\\openssl' try: os.makedirs(dir) except OSError: @@ -116,7 +116,7 @@ def run_configure(configure, do_script): def prep(arch): - makefile_template = "ms\\nt{}.mak" + makefile_template = "ms\\ntdll{}.mak" generated_makefile = makefile_template.format('') if arch == "x86": configure = "VC-WIN32" @@ -143,7 +143,7 @@ def prep(arch): copy_includes(makefile, suffix) print('creating asms...') - create_asms(makefile, 'tmp'+suffix) + create_asms(makefile, 'tmp{}dll'.format(suffix)) def main(): @@ -152,12 +152,17 @@ def main(): "sources must be supplied") sys.exit(1) - if len(sys.argv) > 2: + if len(sys.argv) == 3 and sys.argv[2] not in ('x86', 'amd64'): + print("Second argument must be x86 or amd64") + sys.exit(1) + + if len(sys.argv) > 3: print("Too many arguments supplied, all we need is the directory", - "containing OpenSSL sources") + "containing OpenSSL sources and optionally the architecture") sys.exit(1) ssl_dir = sys.argv[1] + arch = sys.argv[2] if len(sys.argv) >= 3 else None if not os.path.isdir(ssl_dir): print(ssl_dir, "is not an existing directory!") @@ -191,8 +196,11 @@ def main(): old_cwd = os.getcwd() try: os.chdir(ssl_dir) - for arch in ['amd64', 'x86']: + if arch: prep(arch) + else: + for arch in ['amd64', 'x86']: + prep(arch) finally: os.chdir(old_cwd) diff --git a/PCbuild/prepare_tcltk.bat b/PCbuild/prepare_tcltk.bat new file mode 100644 index 00000000000000..276d8c117541cb --- /dev/null +++ b/PCbuild/prepare_tcltk.bat @@ -0,0 +1,35 @@ +@echo off +setlocal +rem Downloads and build sources for libraries we depend upon + +if "%PCBUILD%"=="" (set PCBUILD=%~dp0) +if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) + +set CERT_SETTING= +set ORG_SETTING= + +:CheckOpts +if "%~1"=="--certificate" (set CERT_SETTING=/p:SigningCertificate="%~2") && shift && shift & goto CheckOpts +if "%~1"=="-c" (set CERT_SETTING=/p:SigningCertificate="%~2") && shift && shift & goto CheckOpts +if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts + +if "%~1"=="" goto Build +echo Unrecognized option: %1 +exit /B 1 + +:Build +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) + +rem call "%PCBUILD%find_python.bat" "%PYTHON%" +rem if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3) + +call "%PCBUILD%get_externals.bat" --tkinter %ORG_SETTING% + +%MSBUILD% "%PCBUILD%tcl.vcxproj" /p:Configuration=Release /p:Platform=Win32 +%MSBUILD% "%PCBUILD%tk.vcxproj" /p:Configuration=Release /p:Platform=Win32 +%MSBUILD% "%PCBUILD%tix.vcxproj" /p:Configuration=Release /p:Platform=Win32 + +%MSBUILD% "%PCBUILD%tcl.vcxproj" /p:Configuration=Release /p:Platform=x64 +%MSBUILD% "%PCBUILD%tk.vcxproj" /p:Configuration=Release /p:Platform=x64 +%MSBUILD% "%PCBUILD%tix.vcxproj" /p:Configuration=Release /p:Platform=x64 diff --git a/PCbuild/python.props b/PCbuild/python.props index 563487e0c366ff..c81cd94fe40b21 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -46,8 +46,8 @@ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.2.2\ $(ExternalsDir)openssl-1.0.2k\ - $(opensslDir)include32 - $(opensslDir)include64 + $(ExternalsDir)openssl-bin-1.0.2k\$(ArchName)\ + $(opensslOutDir)include $(ExternalsDir)\nasm-2.11.06\ @@ -72,6 +72,8 @@ --> 10.0.15063.0 10.0.15063.0 + 10.0.14393.0 + 10.0.14393.0 10.0.10586.0 10.0.10586.0 10.0.10240.0 diff --git a/PCbuild/ssleay.vcxproj b/PCbuild/ssleay.vcxproj deleted file mode 100644 index 439e3ac674526a..00000000000000 --- a/PCbuild/ssleay.vcxproj +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {10615B24-73BF-4EFA-93AA-236916321317} - ssleay - - - - - - - StaticLibrary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PCbuild/tcl.vcxproj b/PCbuild/tcl.vcxproj index 3dfd155810ff7b..18137cf579fc72 100644 --- a/PCbuild/tcl.vcxproj +++ b/PCbuild/tcl.vcxproj @@ -48,16 +48,6 @@ $(OutDir)bin\$(tclDLLName) - - - - @@ -66,10 +56,6 @@ INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" setlocal -@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' -') -goto :eof -:build set VCINSTALLDIR=$(VCInstallDir) cd /D "$(tclDir)win" nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) core shell dlls diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props index 57bb98aeebede4..b913d34b0bd32a 100644 --- a/PCbuild/tcltk.props +++ b/PCbuild/tcltk.props @@ -17,9 +17,8 @@ $(ExternalsDir)tcl-core-$(TclMajorVersion).$(TclMinorVersion).$(TclPatchLevel).$(TclRevision)\ $(ExternalsDir)tk-$(TkMajorVersion).$(TkMinorVersion).$(TkPatchLevel).$(TkRevision)\ $(ExternalsDir)tix-$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel).$(TixRevision)\ - $(ExternalsDir)tcltk\ - $(ExternalsDir)tcltk64\ - g + $(ExternalsDir)tcltk-$(TclMajorVersion).$(TclMinorVersion).$(TclPatchLevel).$(TclRevision)\$(ArchName)\ + tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).dll tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib tclsh$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).exe diff --git a/PCbuild/tix.vcxproj b/PCbuild/tix.vcxproj index 7d6d8ca8a65cb9..74e6dffe31dfbc 100644 --- a/PCbuild/tix.vcxproj +++ b/PCbuild/tix.vcxproj @@ -49,10 +49,6 @@ $(tixDLLPath) - - - - @@ -61,10 +57,6 @@ DEBUG=0 NODEBUG=1 -c -W3 -nologo -MD -wd4028 -wd4090 setlocal -@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' -') -goto :eof -:build set VCINSTALLDIR=$(VCInstallDir) cd /D "$(tixDir)win" nmake /nologo -f makefile.vc MACHINE=$(TclMachine) cflags="$(CFlags)" $(DebugFlags) $(TclShortVersions) $(TixDirs) all install diff --git a/PCbuild/tk.vcxproj b/PCbuild/tk.vcxproj index a26318bbe786b8..67df4a63dff534 100644 --- a/PCbuild/tk.vcxproj +++ b/PCbuild/tk.vcxproj @@ -49,14 +49,6 @@ $(OutDir)bin\$(tkDLLName) - - - - @@ -65,10 +57,6 @@ TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" setlocal -@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' -') -goto :eof -:build set VCINSTALLDIR=$(VCInstallDir) cd /D "$(tkDir)win" nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) all diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat index e55d81a7f70199..7f9a81b33d4c9c 100644 --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -76,9 +76,6 @@ if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & if "%SKIPBUILD%" EQU "1" goto skipdoc if "%SKIPDOC%" EQU "1" goto skipdoc -if not defined PYTHON where py -q || echo Cannot find py on path and PYTHON is not set. && exit /B 1 -if not defined SPHINXBUILD where sphinx-build -q || echo Cannot find sphinx-build on path and SPHINXBUILD is not set. && exit /B 1 - call "%D%..\..\doc\make.bat" htmlhelp if errorlevel 1 goto :eof :skipdoc From 78f4ad47efbd97b31254da7b690933e761635fe6 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Jul 2017 00:33:24 +0200 Subject: [PATCH 02/10] Update build system for better options Ensure prepared builds can be signed Fix download options Update installer --- PCbuild/_hashlib.vcxproj | 7 +-- PCbuild/_ssl.vcxproj | 17 +----- PCbuild/_tkinter.vcxproj | 10 ++++ PCbuild/build.bat | 2 - PCbuild/get_externals.bat | 31 ++++++----- PCbuild/openssl.props | 24 +++++++++ PCbuild/openssl.vcxproj | 10 ++-- PCbuild/pcbuild.sln | 95 ++------------------------------- PCbuild/prepare_ssl.bat | 27 ++++++++-- PCbuild/prepare_tcltk.bat | 30 +++++++++-- PCbuild/pyproject.props | 2 +- PCbuild/tcl.vcxproj | 10 +--- PCbuild/tix.vcxproj | 9 ++++ PCbuild/tk.vcxproj | 8 --- Tools/msi/lib/lib_files.wxs | 12 +++++ Tools/msi/tcltk/tcltk.wixproj | 8 --- Tools/msi/tcltk/tcltk_files.wxs | 6 +++ 17 files changed, 143 insertions(+), 165 deletions(-) create mode 100644 PCbuild/openssl.props diff --git a/PCbuild/_hashlib.vcxproj b/PCbuild/_hashlib.vcxproj index 566e1ffc4bec80..d6d88029d71341 100644 --- a/PCbuild/_hashlib.vcxproj +++ b/PCbuild/_hashlib.vcxproj @@ -54,18 +54,15 @@ + <_ProjectFileVersion>10.0.30319.1 - - $(opensslIncludeDir);%(AdditionalIncludeDirectories) - - $(opensslOutDir);%(AdditionalLibraryDirectories) - ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) + ws2_32.lib;%(AdditionalDependencies) diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj index 979936d14b5bd1..63bac98588c099 100644 --- a/PCbuild/_ssl.vcxproj +++ b/PCbuild/_ssl.vcxproj @@ -54,18 +54,15 @@ + <_ProjectFileVersion>10.0.30319.1 - - $(opensslIncludeDir);%(AdditionalIncludeDirectories) - - $(opensslOutDir);%(AdditionalLibraryDirectories) - ws2_32.lib;crypt32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) + ws2_32.lib;crypt32.lib;%(AdditionalDependencies) @@ -74,10 +71,6 @@ - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} @@ -91,10 +84,4 @@ - - - - - - diff --git a/PCbuild/_tkinter.vcxproj b/PCbuild/_tkinter.vcxproj index 6e5e2dca046665..95e3cd50eca5af 100644 --- a/PCbuild/_tkinter.vcxproj +++ b/PCbuild/_tkinter.vcxproj @@ -76,6 +76,10 @@ + + <_TclTkDLL Include="$(tcltkdir)\bin\$(tclDllName)" /> + <_TclTkDLL Include="$(tcltkdir)\bin\$(tkDllName)" /> + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} @@ -85,4 +89,10 @@ + + + + + + \ No newline at end of file diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 713810e5b4b509..3826c664adf2f0 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -5,8 +5,6 @@ echo.%~nx0 [flags and arguments] [quoted MSBuild options] echo. echo.Build CPython from the command line. Requires the appropriate echo.version(s) of Microsoft Visual Studio to be installed (see readme.txt). -echo.Also requires Subversion (svn.exe) to be on PATH if the '-e' flag is -echo.given. echo. echo.After the flags recognized by this script, up to 9 arguments to be passed echo.directly to MSBuild may be passed. If the argument contains an '=', the diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index e0a338dd40c35e..01eeb84ac0f8f6 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -7,13 +7,15 @@ if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) set DO_FETCH=true set DO_CLEAN=false -set IncludeTkinter=false -set IncludeSSL=false +set IncludeTkinterSrc=false +set IncludeSSLSrc=false :CheckOpts -if "%~1"=="--tkinter" (set IncludeTkinter=true) & shift & goto CheckOpts -if "%~1"=="--openssl" (set IncludeSSL=true) & shift & goto CheckOpts -if "%~1"=="--python" (set PYTHON_FOR_BUILD=%2) & shift & shift & goto CheckOpts +if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts +if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts +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 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 @@ -42,13 +44,13 @@ call "%PCBUILD%find_python.bat" "%PYTHON%" echo.Fetching external libraries... set libraries= -set libraries=%libraries% bzip2-1.0.6 -if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2k -set libraries=%libraries% sqlite-3.14.2.0 -if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.6.0 -if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.6.0 -if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.6 -set libraries=%libraries% xz-5.2.2 +set libraries=%libraries% bzip2-1.0.6 +if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.0.2k +set libraries=%libraries% sqlite-3.14.2.0 +if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.6.0 +if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.6.0 +if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tix-8.4.3.6 +set libraries=%libraries% xz-5.2.2 for %%e in (%libraries%) do ( if exist "%EXTERNALS_DIR%\%%e" ( @@ -62,8 +64,9 @@ for %%e in (%libraries%) do ( echo.Fetching external binaries... set binaries= -set binaries=%binaries% -if NOT "%IncludeSSL%"=="false" set binaries=%binaries% nasm-2.11.06 +if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.0.2k +if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.6.0 +if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06 for %%b in (%binaries%) do ( if exist "%EXTERNALS_DIR%\%%b" ( diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props new file mode 100644 index 00000000000000..9ebe8a645f659e --- /dev/null +++ b/PCbuild/openssl.props @@ -0,0 +1,24 @@ + + + + + $(opensslIncludeDir);%(AdditionalIncludeDirectories) + + + $(opensslOutDir);%(AdditionalLibraryDirectories) + ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) + + + + <_SSLDLL Include="$(opensslOutDir)\libeay32.dll" /> + <_SSLDLL Include="$(opensslOutDir)\libeay32.pdb" /> + <_SSLDLL Include="$(opensslOutDir)\ssleay32.dll" /> + <_SSLDLL Include="$(opensslOutDir)\ssleay32.pdb" /> + + + + + + + + \ No newline at end of file diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index 50793056b69fe5..e4a348525a4f37 100644 --- a/PCbuild/openssl.vcxproj +++ b/PCbuild/openssl.vcxproj @@ -45,9 +45,9 @@ Makefile 32 64 - out$(Bitness)dll x86 amd64 + true @@ -56,16 +56,20 @@ + + $(opensslDir)\tmp$(Bitness)dll + $(opensslDir)\out$(Bitness)dll ms\ntdll$(Bitness).mak LIB_D="$(opensslOutDir.TrimEnd(`\`))" OUT_D=out$(Bitness)dll TMP_D=tmp$(Bitness)dll INC_D=inc$(Bitness) INCO_D=inc$(Bitness)\openssl setlocal set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';') set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(opensslDir)" -if not exist $(MakeFile) $(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) +cd /D "$(opensslDir.TrimEnd(`\`))" +if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" +if not exist $(MakeFile) $(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" nmake -f $(MakeFile) $(NMakeOptions) diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln index 280c486703d331..82cfaf249d739a 100644 --- a/PCbuild/pcbuild.sln +++ b/PCbuild/pcbuild.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26621.2 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{553EC33E-9816-4996-A660-5D6186A0B0B3}" ProjectSection(SolutionItems) = preProject @@ -83,16 +83,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testembed", "_testembed.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testmultiphase", "_testmultiphase.vcxproj", "{16BFE6F0-22EF-40B5-B831-7E937119EF10}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcl", "tcl.vcxproj", "{B5FD6F1D-129E-4BFF-9340-03606FAC7283}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tix", "tix.vcxproj", "{C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tk", "tk.vcxproj", "{7E85ECCF-A72C-4DA4-9E52-884508E80BA1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeay", "libeay.vcxproj", "{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay", "ssleay.vcxproj", "{10615B24-73BF-4EFA-93AA-236916321317}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyshellext", "pyshellext.vcxproj", "{0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testconsole", "_testconsole.vcxproj", "{B244E787-C445-441C-BDF4-5A4F1A3A1E51}" @@ -621,86 +611,6 @@ Global {16BFE6F0-22EF-40B5-B831-7E937119EF10}.Release|Win32.Build.0 = Release|Win32 {16BFE6F0-22EF-40B5-B831-7E937119EF10}.Release|x64.ActiveCfg = Release|x64 {16BFE6F0-22EF-40B5-B831-7E937119EF10}.Release|x64.Build.0 = Release|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Debug|Win32.Build.0 = Debug|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Debug|x64.ActiveCfg = Debug|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Debug|x64.Build.0 = Debug|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGInstrument|Win32.Build.0 = Release|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGInstrument|x64.ActiveCfg = Release|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGInstrument|x64.Build.0 = Release|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGUpdate|Win32.Build.0 = Release|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGUpdate|x64.ActiveCfg = Release|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.PGUpdate|x64.Build.0 = Release|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Release|Win32.ActiveCfg = Release|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Release|Win32.Build.0 = Release|Win32 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Release|x64.ActiveCfg = Release|x64 - {B5FD6F1D-129E-4BFF-9340-03606FAC7283}.Release|x64.Build.0 = Release|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Debug|Win32.ActiveCfg = Debug|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Debug|Win32.Build.0 = Debug|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Debug|x64.ActiveCfg = Debug|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Debug|x64.Build.0 = Debug|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGInstrument|Win32.Build.0 = Release|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGInstrument|x64.ActiveCfg = Release|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGInstrument|x64.Build.0 = Release|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGUpdate|Win32.Build.0 = Release|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGUpdate|x64.ActiveCfg = Release|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.PGUpdate|x64.Build.0 = Release|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Release|Win32.ActiveCfg = Release|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Release|Win32.Build.0 = Release|Win32 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Release|x64.ActiveCfg = Release|x64 - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}.Release|x64.Build.0 = Release|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Debug|Win32.ActiveCfg = Debug|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Debug|Win32.Build.0 = Debug|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Debug|x64.ActiveCfg = Debug|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Debug|x64.Build.0 = Debug|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGInstrument|Win32.Build.0 = Release|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGInstrument|x64.ActiveCfg = Release|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGInstrument|x64.Build.0 = Release|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGUpdate|Win32.Build.0 = Release|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGUpdate|x64.ActiveCfg = Release|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.PGUpdate|x64.Build.0 = Release|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Release|Win32.ActiveCfg = Release|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Release|Win32.Build.0 = Release|Win32 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Release|x64.ActiveCfg = Release|x64 - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1}.Release|x64.Build.0 = Release|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|Win32.ActiveCfg = Debug|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|Win32.Build.0 = Debug|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|x64.ActiveCfg = Debug|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|x64.Build.0 = Debug|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|Win32.Build.0 = Release|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|x64.ActiveCfg = Release|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|x64.Build.0 = Release|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|Win32.Build.0 = Release|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|x64.ActiveCfg = Release|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|x64.Build.0 = Release|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|Win32.ActiveCfg = Release|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|Win32.Build.0 = Release|Win32 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|x64.ActiveCfg = Release|x64 - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|x64.Build.0 = Release|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.Debug|Win32.ActiveCfg = Debug|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.Debug|Win32.Build.0 = Debug|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.Debug|x64.ActiveCfg = Debug|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.Debug|x64.Build.0 = Debug|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.PGInstrument|Win32.Build.0 = Release|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.PGInstrument|x64.ActiveCfg = Release|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.PGInstrument|x64.Build.0 = Release|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.PGUpdate|Win32.Build.0 = Release|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.PGUpdate|x64.ActiveCfg = Release|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.PGUpdate|x64.Build.0 = Release|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.Release|Win32.ActiveCfg = Release|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.Release|Win32.Build.0 = Release|Win32 - {10615B24-73BF-4EFA-93AA-236916321317}.Release|x64.ActiveCfg = Release|x64 - {10615B24-73BF-4EFA-93AA-236916321317}.Release|x64.Build.0 = Release|x64 {0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782}.Debug|Win32.ActiveCfg = Debug|Win32 {0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782}.Debug|Win32.Build.0 = Debug|Win32 {0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782}.Debug|x64.ActiveCfg = Debug|x64 @@ -769,4 +679,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5C33FFD3-C8DC-4A54-B842-8BA9846BDFFE} + EndGlobalSection EndGlobal diff --git a/PCbuild/prepare_ssl.bat b/PCbuild/prepare_ssl.bat index 86185948b5d2ad..1df5b8d9f52a15 100644 --- a/PCbuild/prepare_ssl.bat +++ b/PCbuild/prepare_ssl.bat @@ -1,20 +1,39 @@ @echo off -setlocal rem Downloads and build sources for libraries we depend upon +goto Run +:Usage +echo.%~nx0 [flags and arguments] +echo. +echo.Download and build OpenSSL. This should only be performed in order to +echo.update the binaries kept online - in most cases, the files downloaded +echo.by the get_externals.bat script are sufficient for building CPython. +echo. +echo.Available flags: +echo. -h Display this help message +echo. +echo.Available arguments: +echo. --certificate (-c) The signing certificate to use for binaries. +echo. --organization The github organization to obtain sources from. +echo. +exit /b 127 + +:Run +setlocal if "%PCBUILD%"=="" (set PCBUILD=%~dp0) if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) set ORG_SETTING= :CheckOpts +if "%~1"=="-h" shift & goto Usage if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts if "%~1"=="" goto Build echo Unrecognized option: %1 -exit /B 1 +goto Usage :Build call "%PCBUILD%find_msbuild.bat" %MSBUILD% @@ -23,10 +42,10 @@ if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & call "%PCBUILD%find_python.bat" "%PYTHON%" if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3) -call "%PCBUILD%get_externals.bat" --openssl %ORG_SETTING% +call "%PCBUILD%get_externals.bat" --openssl-src %ORG_SETTING% if "%PERL%" == "" where perl > "%TEMP%\perl.loc" 2> nul && set /P PERL= <"%TEMP%\perl.loc" & del "%TEMP%\perl.loc" -if "%PERL%" == "" (echo Cannot locate perl.exe on PATH & exit /b 4) +if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exit /b 4) %MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32 if errorlevel 1 exit /b diff --git a/PCbuild/prepare_tcltk.bat b/PCbuild/prepare_tcltk.bat index 276d8c117541cb..7e6d43e994987b 100644 --- a/PCbuild/prepare_tcltk.bat +++ b/PCbuild/prepare_tcltk.bat @@ -1,7 +1,26 @@ @echo off -setlocal rem Downloads and build sources for libraries we depend upon +goto Run +:Usage +echo.%~nx0 [flags and arguments] +echo. +echo.Download and build Tcl/Tk. This should only be performed in order to +echo.update the binaries kept online - in most cases, the files downloaded +echo.by the get_externals.bat script are sufficient for building CPython. +echo. +echo.Available flags: +echo. -h Display this help message +echo. +echo.Available arguments: +echo. --certificate (-c) The signing certificate to use for binaries. +echo. --organization The github organization to obtain sources from. +echo. +exit /b 127 + +:Run +setlocal + if "%PCBUILD%"=="" (set PCBUILD=%~dp0) if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) @@ -9,13 +28,14 @@ set CERT_SETTING= set ORG_SETTING= :CheckOpts -if "%~1"=="--certificate" (set CERT_SETTING=/p:SigningCertificate="%~2") && shift && shift & goto CheckOpts -if "%~1"=="-c" (set CERT_SETTING=/p:SigningCertificate="%~2") && shift && shift & goto CheckOpts +if "%~1"=="-h" shift & goto Usage +if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts +if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts if "%~1"=="" goto Build echo Unrecognized option: %1 -exit /B 1 +goto Usage :Build call "%PCBUILD%find_msbuild.bat" %MSBUILD% @@ -24,7 +44,7 @@ if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & rem call "%PCBUILD%find_python.bat" "%PYTHON%" rem if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3) -call "%PCBUILD%get_externals.bat" --tkinter %ORG_SETTING% +call "%PCBUILD%get_externals.bat" --tkinter-src %ORG_SETTING% %MSBUILD% "%PCBUILD%tcl.vcxproj" /p:Configuration=Release /p:Platform=Win32 %MSBUILD% "%PCBUILD%tk.vcxproj" /p:Configuration=Release /p:Platform=Win32 diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 7012170e0c7aa4..6ab9b6533f2041 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -152,7 +152,7 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\ - <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" + <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /a /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe" diff --git a/PCbuild/tcl.vcxproj b/PCbuild/tcl.vcxproj index 18137cf579fc72..dda32ecc8e1ebd 100644 --- a/PCbuild/tcl.vcxproj +++ b/PCbuild/tcl.vcxproj @@ -64,16 +64,8 @@ nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFla - - - - - + - - - - \ No newline at end of file diff --git a/PCbuild/tix.vcxproj b/PCbuild/tix.vcxproj index 74e6dffe31dfbc..ab75361db9f5a6 100644 --- a/PCbuild/tix.vcxproj +++ b/PCbuild/tix.vcxproj @@ -37,6 +37,7 @@ {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555} tix + true @@ -64,6 +65,14 @@ nmake /nologo -f makefile.vc MACHINE=$(TclMachine) cflags="$(CFlags)" $(DebugFla rmdir /q/s "$(OutDir.TrimEnd(`\`))" + + + + + + + + {b5fd6f1d-129e-4bff-9340-03606fac7283} diff --git a/PCbuild/tk.vcxproj b/PCbuild/tk.vcxproj index 67df4a63dff534..d125361810ad5a 100644 --- a/PCbuild/tk.vcxproj +++ b/PCbuild/tk.vcxproj @@ -71,15 +71,7 @@ nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs - - - - - - - - \ No newline at end of file diff --git a/Tools/msi/lib/lib_files.wxs b/Tools/msi/lib/lib_files.wxs index a83f544db634bd..0b8a3ee89d95bc 100644 --- a/Tools/msi/lib/lib_files.wxs +++ b/Tools/msi/lib/lib_files.wxs @@ -14,6 +14,12 @@ + + + + + + @@ -30,6 +36,12 @@ + + + + + + diff --git a/Tools/msi/tcltk/tcltk.wixproj b/Tools/msi/tcltk/tcltk.wixproj index f66fc149884f40..fae353f5f50a7d 100644 --- a/Tools/msi/tcltk/tcltk.wixproj +++ b/Tools/msi/tcltk/tcltk.wixproj @@ -20,14 +20,6 @@ - - $(tcltkDir) - !(bindpath.tcltk) - $(tcltkDir)bin - DLLs\ - tcltk_dlls - - $(tcltkDir) !(bindpath.tcltk) diff --git a/Tools/msi/tcltk/tcltk_files.wxs b/Tools/msi/tcltk/tcltk_files.wxs index 0d1b4a93a3a41e..e6950050e7a58d 100644 --- a/Tools/msi/tcltk/tcltk_files.wxs +++ b/Tools/msi/tcltk/tcltk_files.wxs @@ -8,6 +8,12 @@ + + + + + + From 0853802774e785c269b23b21b0e72aa40eb8f43b Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Jul 2017 08:54:55 +0200 Subject: [PATCH 03/10] Fixes use of & in batch files. Prefer MSBuild 14.0 over 15.0 in case the latter is missing install files. --- PCbuild/find_msbuild.bat | 15 ++++++++------- PCbuild/find_python.bat | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat index 1877906e00a55d..2b7413fbcde870 100644 --- a/PCbuild/find_msbuild.bat +++ b/PCbuild/find_msbuild.bat @@ -29,20 +29,21 @@ @where msbuild > "%TEMP%\msbuild.loc" 2> nul && set /P MSBUILD= < "%TEMP%\msbuild.loc" & del "%TEMP%\msbuild.loc" @if exist "%MSBUILD%" set MSBUILD="%MSBUILD%" & (set _Py_MSBuild_Source=PATH) & goto :found -@rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there. -@reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul -@if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @( - @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe") -) -@if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found - @rem VS 2015 and earlier register MSBuild separately, so we can find it. +@rem Prefer MSBuild 14.0 over MSBuild 15.0, since the latter may not be able to find a VC14 install. @reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32 >nul 2>nul @if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32') DO @( @if "%%i"=="MSBuildToolsPath" @if exist "%%k\msbuild.exe" @(set MSBUILD="%%k\msbuild.exe") ) @if exist %MSBUILD% (set _Py_MSBuild_Source=registry) & goto :found +@rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there. +@reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul +@if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @( + @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe") +) +@if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found + @exit /b 1 diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat index 4e1dbca414e758..53330988a21804 100644 --- a/PCbuild/find_python.bat +++ b/PCbuild/find_python.bat @@ -31,7 +31,7 @@ @if exist "%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe" (set PYTHON="%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe") & (set _Py_Python_Source=found in externals directory) & goto :found @rem If py.exe finds a recent enough version, use that one -@py -3.6 -V >nul 2>&1 && (set PYTHON=py -3.6) & (set _Py_Python_Source=found with py.exe) & goto :found +@py -3.6 -V >nul 2>&1 && (set PYTHON=py -3.6) && (set _Py_Python_Source=found with py.exe) && goto :found ) @if NOT exist "%_Py_EXTERNALS_DIR%" mkdir "%_Py_EXTERNALS_DIR%" From e385212a47d22b8976fc7c29d9ee9374c9412d6a Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Jul 2017 09:48:33 +0200 Subject: [PATCH 04/10] Fix references to tcltk DLLs are in installer Remove stray parenthesis --- PCbuild/find_python.bat | 1 - Tools/msi/tcltk/tcltk_d.wxs | 1 - Tools/msi/tcltk/tcltk_files.wxs | 2 ++ 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat index 53330988a21804..4629c610387833 100644 --- a/PCbuild/find_python.bat +++ b/PCbuild/find_python.bat @@ -32,7 +32,6 @@ @rem If py.exe finds a recent enough version, use that one @py -3.6 -V >nul 2>&1 && (set PYTHON=py -3.6) && (set _Py_Python_Source=found with py.exe) && goto :found -) @if NOT exist "%_Py_EXTERNALS_DIR%" mkdir "%_Py_EXTERNALS_DIR%" @set _Py_NUGET=%NUGET% diff --git a/Tools/msi/tcltk/tcltk_d.wxs b/Tools/msi/tcltk/tcltk_d.wxs index 01d0d2439ddc75..391b3af5713d24 100644 --- a/Tools/msi/tcltk/tcltk_d.wxs +++ b/Tools/msi/tcltk/tcltk_d.wxs @@ -8,7 +8,6 @@ - diff --git a/Tools/msi/tcltk/tcltk_files.wxs b/Tools/msi/tcltk/tcltk_files.wxs index e6950050e7a58d..119451078096c4 100644 --- a/Tools/msi/tcltk/tcltk_files.wxs +++ b/Tools/msi/tcltk/tcltk_files.wxs @@ -5,6 +5,8 @@ + + From 7c06e7190685311220435a593a25338ef767a299 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Jul 2017 10:29:36 +0200 Subject: [PATCH 05/10] Switch msi/get_externals.bat to use find_python.bat Prepare scripts copy licenses into bin folder and installer picks them up from the right place --- PCbuild/openssl.vcxproj | 1 + PCbuild/tcl.vcxproj | 1 + PCbuild/tix.vcxproj | 1 + PCbuild/tk.vcxproj | 1 + Tools/msi/exe/exe.wixproj | 8 ++++---- Tools/msi/get_externals.bat | 24 ++++-------------------- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index e4a348525a4f37..16b4512e9e765f 100644 --- a/PCbuild/openssl.vcxproj +++ b/PCbuild/openssl.vcxproj @@ -72,6 +72,7 @@ if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" if not exist $(MakeFile) $(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" nmake -f $(MakeFile) $(NMakeOptions) +copy /y LICENSE "$(opensslOutDir)\LICENSE" diff --git a/PCbuild/tcl.vcxproj b/PCbuild/tcl.vcxproj index dda32ecc8e1ebd..28a0ee90994b6a 100644 --- a/PCbuild/tcl.vcxproj +++ b/PCbuild/tcl.vcxproj @@ -60,6 +60,7 @@ set VCINSTALLDIR=$(VCInstallDir) cd /D "$(tclDir)win" nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) core shell dlls nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) install-binaries install-libraries +copy /Y ..\license.terms "$(OutDir)\tcllicense.terms" diff --git a/PCbuild/tix.vcxproj b/PCbuild/tix.vcxproj index ab75361db9f5a6..525758c1c61d84 100644 --- a/PCbuild/tix.vcxproj +++ b/PCbuild/tix.vcxproj @@ -61,6 +61,7 @@ set VCINSTALLDIR=$(VCInstallDir) cd /D "$(tixDir)win" nmake /nologo -f makefile.vc MACHINE=$(TclMachine) cflags="$(CFlags)" $(DebugFlags) $(TclShortVersions) $(TixDirs) all install +copy /Y ..\license.terms "$(OutDir)\tixlicense.terms" rmdir /q/s "$(OutDir.TrimEnd(`\`))" diff --git a/PCbuild/tk.vcxproj b/PCbuild/tk.vcxproj index d125361810ad5a..f90e482130e982 100644 --- a/PCbuild/tk.vcxproj +++ b/PCbuild/tk.vcxproj @@ -61,6 +61,7 @@ set VCINSTALLDIR=$(VCInstallDir) cd /D "$(tkDir)win" nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) all nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) install-binaries install-libraries +copy /Y ..\license.terms "$(OutDir)\tklicense.terms" diff --git a/Tools/msi/exe/exe.wixproj b/Tools/msi/exe/exe.wixproj index 24df0f5f7a3011..50f6f88246044c 100644 --- a/Tools/msi/exe/exe.wixproj +++ b/Tools/msi/exe/exe.wixproj @@ -26,10 +26,10 @@ + $(opensslOutDir)LICENSE; + $(tcltkDir)tcllicense.terms; + $(tcltkDir)tklicense.terms; + $(tcltkDir)tixlicense.terms" /> <_LicenseFiles Include="@(LicenseFiles)"> $([System.IO.File]::ReadAllText(%(FullPath))) diff --git a/Tools/msi/get_externals.bat b/Tools/msi/get_externals.bat index aece81fbb1cf3e..913512a778fa6b 100644 --- a/Tools/msi/get_externals.bat +++ b/Tools/msi/get_externals.bat @@ -12,7 +12,7 @@ set DO_FETCH=true set DO_CLEAN=false :CheckOpts -if "%~1"=="--python" (set PYTHON_FOR_BUILD=%2) & shift & shift & goto CheckOpts +if "%~1"=="--python" (set PYTHON=%2) & shift & shift & goto CheckOpts 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 @@ -32,23 +32,7 @@ if "%DO_FETCH%"=="false" goto end if "%ORG%"=="" (set ORG=python) -if "%PYTHON_FOR_BUILD%"=="" ( - echo Checking for installed python... - py -3.6 -V >nul 2>&1 && (set PYTHON_FOR_BUILD=py -3.6) -) -if "%PYTHON_FOR_BUILD%"=="" ( - if NOT exist "%EXTERNALS_DIR%" mkdir "%EXTERNALS_DIR%" - if NOT exist "%NUGET%" ( - echo Downloading nuget... - rem NB: Must use single quotes around NUGET here, NOT double! - rem Otherwise, a space in the path would break things - powershell.exe -Command Invoke-WebRequest %NUGET_URL% -OutFile '%NUGET%' - ) - echo Installing Python via nuget... - "%NUGET%" install pythonx86 -ExcludeVersion -OutputDirectory "%EXTERNALS_DIR%" - rem Quote it here; it's not quoted later because "py -3.6" wouldn't work - set PYTHON_FOR_BUILD="%EXTERNALS_DIR%\pythonx86\tools\python.exe" -) +call "%PCBUILD%\find_python.bat" "%PYTHON%" echo.Fetching external libraries... @@ -59,7 +43,7 @@ for %%e in (%libraries%) do ( echo.%%e already exists, skipping. ) else ( echo.Fetching %%e... - %PYTHON_FOR_BUILD% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -O %ORG% %%e + %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -O %ORG% %%e ) ) @@ -79,7 +63,7 @@ for %%b in (%binaries%) do ( echo.%%b already exists, skipping. ) else ( echo.Fetching %%b... - %PYTHON_FOR_BUILD% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -b -O %ORG% %%b + %PYTHON% "%PCBUILD%get_external.py" -e "%EXTERNALS_DIR%" -b -O %ORG% %%b ) ) From 53b022799aae78d0e30fcbbc0eafe049593d95aa Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Jul 2017 15:11:06 +0200 Subject: [PATCH 06/10] Adds least-horrible fix for using release OpenSSL in debug CPython Simplifies prepare_ssl.py --- Modules/_ssl.c | 38 +++++++++++++++++++++++++- PCbuild/_ssl.vcxproj | 5 +++- PCbuild/_ssl.vcxproj.filters | 6 ++++ PCbuild/openssl.vcxproj | 5 ++-- PCbuild/prepare_ssl.py | 53 ++++++++++++++++-------------------- 5 files changed, 74 insertions(+), 33 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index a79a7470d20a3a..3e873bf5ec0902 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -21,11 +21,13 @@ #ifdef WITH_THREAD #include "pythread.h" +/* Potentially redefined below for Windows, after important #includes */ +#define _PySSL_FIX_ERRNO #define PySSL_BEGIN_ALLOW_THREADS_S(save) \ do { if (_ssl_locks_count>0) { (save) = PyEval_SaveThread(); } } while (0) #define PySSL_END_ALLOW_THREADS_S(save) \ - do { if (_ssl_locks_count>0) { PyEval_RestoreThread(save); } } while (0) + do { if (_ssl_locks_count>0) { PyEval_RestoreThread(save); } _PySSL_FIX_ERRNO; } while (0) #define PySSL_BEGIN_ALLOW_THREADS { \ PyThreadState *_save = NULL; \ PySSL_BEGIN_ALLOW_THREADS_S(_save); @@ -96,6 +98,40 @@ struct py_ssl_library_code { int code; }; +#if defined(MS_WINDOWS) && defined(Py_DEBUG) +/* Debug builds on Windows rely on getting errno directly from OpenSSL. + * However, because it uses a different CRT, we need to transfer the + * value of errno from OpenSSL into our debug CRT. + * + * Don't be fooled - this is horribly ugly code. The only reasonable + * alternative is to do both debug and release builds of OpenSSL, which + * requires much uglier code to transform their automatically generated + * makefile. This is the lesser of all the evils. + */ + +static void _PySSLFixErrno(void) { + HMODULE ucrtbase = GetModuleHandleW(L"ucrtbase.dll"); + if (!ucrtbase) { + /* If ucrtbase.dll is not loaded but the SSL DLLs are, we likely + * have a catastrophic failure, but this function is not the + * place to raise it. */ + return; + } + + typedef int *(__stdcall *errno_func)(void); + errno_func ssl_errno = (errno_func)GetProcAddress(ucrtbase, "_errno"); + if (ssl_errno) { + errno = *ssl_errno(); + *ssl_errno() = 0; + } else { + errno = ENOTRECOVERABLE; + } +} + +#undef _PySSL_FIX_ERRNO +#define _PySSL_FIX_ERRNO _PySSLFixErrno() +#endif + /* Include generated data (error codes) */ #include "_ssl_data.h" diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj index 63bac98588c099..aaf95a361c589f 100644 --- a/PCbuild/_ssl.vcxproj +++ b/PCbuild/_ssl.vcxproj @@ -67,6 +67,9 @@ + + _CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions) + @@ -84,4 +87,4 @@ - + \ No newline at end of file diff --git a/PCbuild/_ssl.vcxproj.filters b/PCbuild/_ssl.vcxproj.filters index 78b1459923dc5c..bd46b609840b2d 100644 --- a/PCbuild/_ssl.vcxproj.filters +++ b/PCbuild/_ssl.vcxproj.filters @@ -9,5 +9,11 @@ Source Files + + Source Files + + + + \ No newline at end of file diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index 16b4512e9e765f..2d42b1268180c5 100644 --- a/PCbuild/openssl.vcxproj +++ b/PCbuild/openssl.vcxproj @@ -69,9 +69,9 @@ set VCINSTALLDIR=$(VCInstallDir) cd /D "$(opensslDir.TrimEnd(`\`))" if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" -if not exist $(MakeFile) $(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" -nmake -f $(MakeFile) $(NMakeOptions) +$(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) +nmake -f $(MakeFile) $(NMakeOptions) headers lib copy /y LICENSE "$(opensslOutDir)\LICENSE" @@ -85,6 +85,7 @@ copy /y LICENSE "$(opensslOutDir)\LICENSE" + diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py index 321badeb21e561..0f3c63ee24ffba 100644 --- a/PCbuild/prepare_ssl.py +++ b/PCbuild/prepare_ssl.py @@ -21,6 +21,7 @@ from __future__ import print_function import os +import re import sys import subprocess from shutil import copy @@ -64,30 +65,6 @@ def find_working_perl(perls): print(" Please install ActivePerl and ensure it appears on your path") -def create_asms(makefile, tmp_d): - #create a custom makefile out of the provided one - asm_makefile = os.path.splitext(makefile)[0] + '.asm.mak' - with open(makefile) as fin, open(asm_makefile, 'w') as fout: - for line in fin: - # Keep everything up to the install target (it's convenient) - if line.startswith('install: all'): - break - fout.write(line) - asms = [] - for line in fin: - if '.asm' in line and line.strip().endswith('.pl'): - asms.append(line.split(':')[0]) - while line.strip(): - fout.write(line) - line = next(fin) - fout.write('\n') - - fout.write('asms: $(TMP_D) ') - fout.write(' '.join(asms)) - fout.write('\n') - os.system('nmake /f {} PERL=perl TMP_D={} asms'.format(asm_makefile, tmp_d)) - - def copy_includes(makefile, suffix): dir = 'inc'+suffix+'\\openssl' try: @@ -114,6 +91,26 @@ def run_configure(configure, do_script): print(do_script) os.system(do_script) +def fix_uplink(): + # uplink.c tries to find the OPENSSL_Applink function exported from the current + # executable. However, we export it from _ssl[_d].pyd instead. So we update the + # module name here before building. + with open('ms\\uplink.c', 'r', encoding='utf-8') as f1: + code = list(f1) + os.replace('ms\\uplink.c', 'ms\\uplink.c.orig') + already_patched = False + with open('ms\\uplink.c', 'w', encoding='utf-8') as f2: + for line in code: + if not already_patched: + if re.search('MODIFIED FOR CPYTHON _ssl MODULE', line): + already_patched = True + elif re.match(r'^\s+if\s*\(\(h\s*=\s*GetModuleHandle[AW]?\(NULL\)\)\s*==\s*NULL\)', line): + f2.write("/* MODIFIED FOR CPYTHON _ssl MODULE */\n") + f2.write('if ((h = GetModuleHandleW(L"_ssl.pyd")) == NULL) if ((h = GetModuleHandleW(L"_ssl_d.pyd")) == NULL)\n') + already_patched = True + f2.write(line) + if not already_patched: + print("WARN: failed to patch ms\\uplink.c") def prep(arch): makefile_template = "ms\\ntdll{}.mak" @@ -126,13 +123,12 @@ def prep(arch): configure = "VC-WIN64A" do_script = "ms\\do_win64a" suffix = "64" - #os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON" else: raise ValueError('Unrecognized platform: %s' % arch) print("Creating the makefiles...") sys.stdout.flush() - # run configure, copy includes, create asms + # run configure, copy includes, patch files run_configure(configure, do_script) makefile = makefile_template.format(suffix) try: @@ -142,9 +138,8 @@ def prep(arch): os.rename(generated_makefile, makefile) copy_includes(makefile, suffix) - print('creating asms...') - create_asms(makefile, 'tmp{}dll'.format(suffix)) - + print('patching ms\\uplink.c...') + fix_uplink() def main(): if len(sys.argv) == 1: From 8483625e524cb084f734793fd2ea3e070c75a66c Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 13 Jul 2017 16:18:07 +0200 Subject: [PATCH 07/10] Skip test that does not work in debug build with non-debug OpenSSL --- Lib/test/test_ssl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index fdaf1c52046f15..d960d8206509d7 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1244,6 +1244,7 @@ def test_load_default_certs_env(self): self.assertEqual(ctx.cert_store_stats(), {"crl": 0, "x509": 1, "x509_ca": 0}) @unittest.skipUnless(sys.platform == "win32", "Windows specific") + @unittest.skipIf(hasattr(sys, "gettotalrefcount"), "Debug build does not share environment between CRTs") def test_load_default_certs_env_windows(self): ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) ctx.load_default_certs() From d53d37edef1520c84744726380b2e4bffb1dd962 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 14 Jul 2017 10:35:25 +0200 Subject: [PATCH 08/10] Remove unused externals.proj file --- PCbuild/externals.proj | 78 ------------------------------------------ 1 file changed, 78 deletions(-) delete mode 100644 PCbuild/externals.proj diff --git a/PCbuild/externals.proj b/PCbuild/externals.proj deleted file mode 100644 index c0a2c2d04b4bb7..00000000000000 --- a/PCbuild/externals.proj +++ /dev/null @@ -1,78 +0,0 @@ - - - - {CC9B93A2-439D-4058-9D29-6DCF43774405} - Win32 - Release - - - - - $(Platform) - $(Configuration) - - Build - Clean - CleanAll - true - - - $(Platform) - $(Configuration) - - Build - Clean - CleanAll - false - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 635e0b4400b97332549741bdd1222ad7b9bcd101 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 15 Jul 2017 00:43:11 +0200 Subject: [PATCH 09/10] Add NEWS.d entry --- .../NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst diff --git a/Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst b/Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst new file mode 100644 index 00000000000000..c91fd881825f7b --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst @@ -0,0 +1 @@ +Pre-build OpenSSL, Tcl and Tk and include the binaries in the build. From 81c2b5611ec6bc09c34e42942fa65836fb14d1ce Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 15 Jul 2017 00:45:59 +0200 Subject: [PATCH 10/10] Trivial change to trigger a rebuild --- Modules/_ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 3e873bf5ec0902..458d2e7fd60b6e 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -21,7 +21,7 @@ #ifdef WITH_THREAD #include "pythread.h" -/* Potentially redefined below for Windows, after important #includes */ +/* Redefined below for Windows debug builds after important #includes */ #define _PySSL_FIX_ERRNO #define PySSL_BEGIN_ALLOW_THREADS_S(save) \