From 56560864e9cca01645fa19c65db9742d85a3e381 Mon Sep 17 00:00:00 2001 From: Daniel Strommen Date: Sun, 18 Mar 2018 04:31:30 -0700 Subject: Include windows.h before including consoleapi.h (#3050) * Include windows.h before including consoleapi.h Issue: cpython fails to build against Windows Insider Preview SDK 17115 Root Cause: Failure to include windows.h before other Windows headers (consoleapi.h) Solution: Include windows.h before consoleapi.h If you don't include Windows.h before other Windows headers, then your code is likely to break with new versions of the Windows Platform SDK, as headers move around or new intraheader dependencies are added. That is what happened here. * Remove redundant consoleapi.h The documented header for all the console API's is windows.h, which includes wincon.h which includes consoleapi.h. Consoleapi.h used to also include windows.h, but this caused a circular dependency. So, adjusting this to only include windows.h and omit the consoleapi.h which is redundant. * [python3] formatting --- ports/python3/0004-Fix-iomodule-for-RS4-SDK.patch | 12 +++++++++++ ports/python3/portfile.cmake | 25 +++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 ports/python3/0004-Fix-iomodule-for-RS4-SDK.patch (limited to 'ports/python3') diff --git a/ports/python3/0004-Fix-iomodule-for-RS4-SDK.patch b/ports/python3/0004-Fix-iomodule-for-RS4-SDK.patch new file mode 100644 index 000000000..a0efc8d1c --- /dev/null +++ b/ports/python3/0004-Fix-iomodule-for-RS4-SDK.patch @@ -0,0 +1,12 @@ +diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c +--- a/Modules/_io/_iomodule.c ++++ b/Modules/_io/_iomodule.c +@@ -21,7 +21,7 @@ + #endif /* HAVE_SYS_STAT_H */ + + #ifdef MS_WINDOWS +-#include ++#include + #endif + + /* Various interned strings */ diff --git a/ports/python3/portfile.cmake b/ports/python3/portfile.cmake index 9bb50b70c..6285f9a9b 100644 --- a/ports/python3/portfile.cmake +++ b/ports/python3/portfile.cmake @@ -1,17 +1,4 @@ -# Common Ambient Variables: -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} -# PORT = current port name (zlib, etc) -# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) -# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) -# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) -# VCPKG_ROOT_DIR = -# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) -# if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND VCPKG_CRT_LINKAGE STREQUAL static) - # Because the patches patch the same file, they have to be applied in the correct order - # In this scenario, only the second patch needs to be applied, which doesn't work message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.") set(VCPKG_LIBRARY_LINKAGE static) endif() @@ -29,8 +16,16 @@ vcpkg_from_github( REF v${PYTHON_VERSION} SHA512 32cca5e344ee66f08712ab5533e5518f724f978ec98d985f7612d0bd8d7f5cac25625363c9eead192faf1806d4ea3393515f72ba962a2a0bed26261e56d8c637 HEAD_REF master - ) +) + +vcpkg_apply_patches( + SOURCE_PATH ${TEMP_SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0004-Fix-iomodule-for-RS4-SDK.patch +) + # We need per-triplet directories because we need to patch the project files differently based on the linkage +# Because the patches patch the same file, they have to be applied in the correct order file(COPY ${TEMP_SOURCE_PATH} DESTINATION ${SOURCE_PATH}) set(SOURCE_PATH ${SOURCE_PATH}/cpython-${PYTHON_VERSION}) @@ -87,4 +82,4 @@ endif() file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}) file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright) -vcpkg_copy_pdbs() \ No newline at end of file +vcpkg_copy_pdbs() -- cgit v1.2.3 From 5ab4a6f673ccce9796579a4132d397cddafa0916 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 20 Apr 2018 17:53:57 -0700 Subject: [python3] Fix folder handling --- ports/python3/CONTROL | 2 +- ports/python3/portfile.cmake | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'ports/python3') diff --git a/ports/python3/CONTROL b/ports/python3/CONTROL index 0a730e517..c8331f8cf 100644 --- a/ports/python3/CONTROL +++ b/ports/python3/CONTROL @@ -1,3 +1,3 @@ Source: python3 -Version: 3.6.4 +Version: 3.6.4-1 Description: The Python programming language as an embeddable library \ No newline at end of file diff --git a/ports/python3/portfile.cmake b/ports/python3/portfile.cmake index 6285f9a9b..16b3a3db3 100644 --- a/ports/python3/portfile.cmake +++ b/ports/python3/portfile.cmake @@ -9,12 +9,12 @@ set(PYTHON_VERSION_PATCH 4) set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}) include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}) + vcpkg_from_github( OUT_SOURCE_PATH TEMP_SOURCE_PATH REPO python/cpython REF v${PYTHON_VERSION} - SHA512 32cca5e344ee66f08712ab5533e5518f724f978ec98d985f7612d0bd8d7f5cac25625363c9eead192faf1806d4ea3393515f72ba962a2a0bed26261e56d8c637 + SHA512 32cca5e344ee66f08712ab5533e5518f724f978ec98d985f7612d0bd8d7f5cac25625363c9eead192faf1806d4ea3393515f72ba962a2a0bed26261e56d8c637 HEAD_REF master ) @@ -26,8 +26,9 @@ vcpkg_apply_patches( # We need per-triplet directories because we need to patch the project files differently based on the linkage # Because the patches patch the same file, they have to be applied in the correct order -file(COPY ${TEMP_SOURCE_PATH} DESTINATION ${SOURCE_PATH}) -set(SOURCE_PATH ${SOURCE_PATH}/cpython-${PYTHON_VERSION}) +set(SOURCE_PATH "${TEMP_SOURCE_PATH}-Lib-${VCPKG_LIBRARY_LINKAGE}-crt-${VCPKG_CRT_LINKAGE}") +file(REMOVE_RECURSE ${SOURCE_PATH}) +file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH}) if (VCPKG_LIBRARY_LINKAGE STREQUAL static) vcpkg_apply_patches( @@ -57,7 +58,7 @@ endif() vcpkg_build_msbuild( PROJECT_PATH ${SOURCE_PATH}/PCBuild/pythoncore.vcxproj PLATFORM ${BUILD_ARCH}) - + if (VCPKG_LIBRARY_LINKAGE STREQUAL static) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} -- cgit v1.2.3