diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cabf83cf..bdc7fd58f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,25 @@ else() set(BUILD_WININST_ALWAYS OFF) endif() +if(APPLE) + option(BUILD_FRAMEWORK "Build a Mac OSX Framework" OFF) + if(BUILD_FRAMEWORK) + set(BUILD_LIBPYTHON_SHARED ON CACHE BOOL "Forced to ON because of BUILD_FRAMEWORK=ON" FORCE) + endif() +else() + set(BUILD_FRAMEWORK OFF) +endif() +if(BUILD_FRAMEWORK) + set(FRAMEWORK_NAME Python) + set(FRAMEWORK_PREFIX ${CMAKE_INSTALL_PREFIX}) + set(FRAMEWORK_DIR_ROOT ${FRAMEWORK_NAME}.framework) + set(FRAMEWORK_DIR_PREFIX ${FRAMEWORK_DIR_ROOT}/Versions/${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}) +else() + set(FRAMEWORK_NAME "") + set(FRAMEWORK_PREFIX "") + set(FRAMEWORK_DIR_ROOT "no-framework") + set(FRAMEWORK_DIR_PREFIX "") +endif() option(INSTALL_DEVELOPMENT "Install files required to develop C extensions" ON) option(INSTALL_MANUAL "Install man files" ON) option(INSTALL_TEST "Install test files" ON) @@ -524,18 +543,25 @@ if(USE_LIB64) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) set(LIBDIR "lib64") endif() -set(PYTHONHOME "${LIBDIR}") -if(UNIX) - set(PYTHONHOME "${PYTHONHOME}/${LIBPYTHON}") +if(BUILD_FRAMEWORK) + set(LIBDIR ${FRAMEWORK_DIR_PREFIX}/lib) endif() +set(PYTHONHOME "${LIBDIR}/${LIBPYTHON}") # Install tree directory set(BIN_INSTALL_DIR bin) # Contains the python executable if(INSTALL_WINDOWS_TRADITIONAL) set(BIN_INSTALL_DIR .) # Contains the python executable endif() +if(BUILD_FRAMEWORK) + set(BIN_INSTALL_DIR ${FRAMEWORK_DIR_PREFIX}/bin) +endif() +set(SHARE_INSTALL_DIR share) +if(BUILD_FRAMEWORK) + set(SHARE_INSTALL_DIR ${FRAMEWORK_DIR_PREFIX}/share) +endif() set(LD_VERSION ${LIBPYTHON_VERSION}${ABIFLAGS}) -set(CONFIG_INSTALL_DIR share/${LIBPYTHON}) +set(CONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/${LIBPYTHON}) set(EXTENSION_INSTALL_DIR ${PYTHONHOME}/lib-dynload) if (${LIBPYTHON_VERSION} GREATER 3.1) @@ -549,7 +575,11 @@ if(INSTALL_WINDOWS_TRADITIONAL) endif() set(INCLUDE_INSTALL_DIR include/python${LD_VERSION}) if(MSVC) - set(INCLUDE_INSTALL_DIR include) + set(INCLUDE_INSTALL_DIR include/python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}) +endif() +if(BUILD_FRAMEWORK) + set(REL_INCLUDE_INSTALL_DIR include/python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}) + set(INCLUDE_INSTALL_DIR ${FRAMEWORK_DIR_PREFIX}/include/python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}) endif() # Build tree directory set(BIN_BUILD_DIR ${PROJECT_BINARY_DIR}/bin) @@ -557,7 +587,7 @@ set(CONFIG_BUILD_DIR ${PROJECT_BINARY_DIR}/${CONFIG_INSTALL_DIR}) set(EXTENSION_BUILD_DIR ${PROJECT_BINARY_DIR}/${PYTHONHOME}/lib-dynload) set(INCLUDE_BUILD_DIR ${SRC_DIR}/Include) -set(ARCHIVEDIR "libs") # Contains the static (*.a) and import libraries (*.lib) +set(ARCHIVEDIR "lib") # Contains the static (*.a) and import libraries (*.lib) # Directories specific to 'libpython' set(LIBPYTHON_LIBDIR ${LIBDIR}) @@ -577,6 +607,9 @@ if(UNIX) set(PYCONFIG_BUILD_DIR ${BIN_BUILD_DIR}) configure_file(cmake/config-unix/pyconfig.h.in ${PYCONFIG_BUILD_DIR}/pyconfig.h) + file(GENERATE + OUTPUT $/pyconfig.h + INPUT ${PYCONFIG_BUILD_DIR}/pyconfig.h) elseif(WIN32) set(PYCONFIG_BUILD_DIR ${SRC_DIR}/PC) # In a windows build tree, 'pyconfig.h' is NOT required to # live along side the python executable. @@ -647,7 +680,11 @@ if(BUILD_LIBPYTHON_SHARED AND UNIX) if(APPLE) set(_envvar DYLD_LIBRARY_PATH) endif() - set(PYTHON_WRAPPER_COMMAND env ${_envvar}=${PROJECT_BINARY_DIR}/${LIBPYTHON_LIBDIR}) + set(PYTHON_HOME_PATH ) + if(BUILD_FRAMEWORK) + set(PYTHON_HOME_PATH PYTHONHOME=${PROJECT_BINARY_DIR}/${PYTHONHOME} PYTHONPATH=${PROJECT_BINARY_DIR}/${PYTHONHOME}) + endif() + set(PYTHON_WRAPPER_COMMAND env ${_envvar}=${PROJECT_BINARY_DIR}/${LIBPYTHON_LIBDIR} ${PYTHON_HOME_PATH}) endif() # Add extension modules @@ -680,7 +717,7 @@ endif() # Add target to run "Argument Clinic" over all source files add_custom_target(clinic - COMMAND python ${SRC_DIR}/Tools/clinic/clinic.py --make + COMMAND python -B ${SRC_DIR}/Tools/clinic/clinic.py --make DEPENDS python WORKING_DIRECTORY ${SRC_DIR} COMMENT "Running 'Argument Clinic' over all source files" @@ -748,7 +785,7 @@ endif() # Add target to generate 'opcode.h' header file add_custom_target(generate_opcode_h - COMMAND python ${SRC_DIR}/Tools/scripts/generate_opcode_h.py + COMMAND python -B ${SRC_DIR}/Tools/scripts/generate_opcode_h.py ${SRC_DIR}/Lib/opcode.py ${PROJECT_BINARY_DIR}/CMakeFiles/opcode.h COMMAND ${CMAKE_COMMAND} -E copy_if_different @@ -762,7 +799,7 @@ add_custom_target(generate_opcode_h # Add target to generate 'Include/Python-ast.h' from 'Python.asdl' add_custom_target(generate_python_ast_h - COMMAND python ${SRC_DIR}/Parser/asdl_c.py + COMMAND python -B ${SRC_DIR}/Parser/asdl_c.py -h ${SRC_DIR}/Include ${SRC_DIR}/Parser/Python.asdl DEPENDS python @@ -773,7 +810,7 @@ add_custom_target(generate_python_ast_h # Add target to generate 'Python/Python-ast.c' from 'Python.asdl' add_custom_target(generate_python_ast_c - COMMAND python ${SRC_DIR}/Parser/asdl_c.py + COMMAND python -B ${SRC_DIR}/Parser/asdl_c.py -c ${SRC_DIR}/Python ${SRC_DIR}/Parser/Python.asdl DEPENDS python @@ -815,7 +852,7 @@ if(UNIX) ${PROJECT_BINARY_DIR}/Misc/python-${LIBPYTHON_VERSION}.pc ${PROJECT_BINARY_DIR}/Misc/python-${PY_VERSION_MAJOR}.pc ${PROJECT_BINARY_DIR}/Misc/python.pc - DESTINATION lib/pkgconfig + DESTINATION ${LIBDIR}/pkgconfig COMPONENT Development) endif() @@ -825,9 +862,12 @@ if(UNIX) set(MAKEFILE_LDSHARED_FLAGS "-dynamiclib -headerpad_max_install_names -undefined dynamic_lookup") endif() configure_file(cmake/makefile-variables.in - ${BIN_BUILD_DIR}/Makefile @ONLY) + ${BIN_BUILD_DIR}/Makefile.in @ONLY) + file(GENERATE + OUTPUT $/Makefile + INPUT ${BIN_BUILD_DIR}/Makefile.in) if(INSTALL_DEVELOPMENT) - install(FILES ${BIN_BUILD_DIR}/Makefile + install(FILES $/Makefile DESTINATION ${LIB_CONFIG_INSTALL_DIR} RENAME Makefile COMPONENT Development) @@ -842,7 +882,7 @@ if(UNIX) # Install manual if(INSTALL_MANUAL) - set(_install_man FILES ${SRC_DIR}/Misc/python.man DESTINATION share/man/man1 COMPONENT Runtime) + set(_install_man FILES ${SRC_DIR}/Misc/python.man DESTINATION ${SHARE_INSTALL_DIR}/man/man1 COMPONENT Runtime) install(${_install_man} RENAME python${LIBPYTHON_VERSION}.1) install(${_install_man} RENAME python${PY_VERSION_MAJOR}.1) endif() @@ -870,7 +910,7 @@ if(BUILD_TESTING) ) set(TESTPROG ${PROJECT_BINARY_DIR}/${PYTHONHOME}/test/regrtest.py) set(TESTPYTHONOPTS ) - set(TESTPYTHON $ ${TESTPYTHONOPTS}) + set(TESTPYTHON $ -B ${TESTPYTHONOPTS}) set(TESTPYTHON ${CMAKE_CROSSCOMPILING_EMULATOR} ${TESTPYTHON}) include(cmake/UnitTests.cmake) foreach(unittest ${unittests}) @@ -941,18 +981,6 @@ write_basic_package_version_file( COMPATIBILITY SameMajorVersion ) -if(INSTALL_DEVELOPMENT) - # Install 'PythonTargets.cmake', 'PythonConfig.cmake' and 'PythonConfigVersion.cmake - install(EXPORT PythonTargets - FILE PythonTargets.cmake - DESTINATION ${CONFIG_INSTALL_DIR} COMPONENT Development) - - install( - FILES ${python_install_config} ${python_config_version} - DESTINATION ${CONFIG_INSTALL_DIR} COMPONENT Development - ) -endif() - # Install License set(license_destination ${PYTHONHOME}) if(INSTALL_WINDOWS_TRADITIONAL) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index ecde8b91d..0371dbd57 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -911,7 +911,9 @@ set(WITH_DYLD 0) set(WITH_NEXT_FRAMEWORK 0) if(APPLE) set(WITH_DYLD 1) - set(WITH_NEXT_FRAMEWORK 0) # TODO: See --enable-framework option. + if(BUILD_FRAMEWORK) + set(WITH_NEXT_FRAMEWORK 1) # TODO: See --enable-framework option. + endif() endif() set(PYTHONFRAMEWORK "") diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 10f3245dd..c5d74b198 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -373,7 +373,7 @@ add_python_extension(_xxtestfuzz _xxtestfuzz/fuzzer.c ) -if (NOT ANDROID) +if (NOT ANDROID AND NOT WIN32) # Python 3.8 set(_wide_char_modifier "L") add_python_extension(_testinternalcapi diff --git a/cmake/include/CMakeLists.txt b/cmake/include/CMakeLists.txt index f75ede6e1..e14bb19f3 100644 --- a/cmake/include/CMakeLists.txt +++ b/cmake/include/CMakeLists.txt @@ -12,3 +12,21 @@ foreach(file ${hfiles}) install(FILES ${includedir}/${file} DESTINATION ${INCLUDE_INSTALL_DIR}/${path} COMPONENT Development) endif() endforeach() +if(BUILD_FRAMEWORK) + install(CODE " + message(STATUS \"Creating Python header framework symlinks...\") + execute_process( + COMMAND + \${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers Headers + WORKING_DIRECTORY + \"${CMAKE_INSTALL_PREFIX}/${FRAMEWORK_DIR_ROOT}\" + ) + + execute_process( + COMMAND + \${CMAKE_COMMAND} -E create_symlink \"${REL_INCLUDE_INSTALL_DIR}\" Headers + WORKING_DIRECTORY + \"${CMAKE_INSTALL_PREFIX}/${FRAMEWORK_DIR_PREFIX}\" + ) + ") +endif() diff --git a/cmake/lib/CMakeLists.txt b/cmake/lib/CMakeLists.txt index 5f62ecab3..5a7f58081 100644 --- a/cmake/lib/CMakeLists.txt +++ b/cmake/lib/CMakeLists.txt @@ -7,6 +7,10 @@ if(UNIX) set(plat_subdir "plat-linux") endif() +if(APPLE) + set(plat_subdir "plat-darwin") +endif() + foreach(file ${libfiles}) # Don't install files for other platforms string(REGEX MATCH "^plat-" is_platform_file "${file}") diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index b7124d3e5..07a781f2d 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -222,6 +222,9 @@ elseif(WIN32) PROPERTY COMPILE_DEFINITIONS "PY3_DLLNAME=${_wide_char_modifier}\"python3$<$:_d>\"" # Python 3.11 ) + if(MSVC) + add_compile_options(/wd4101 /wd4018 /wd4244 /wd4996) + endif() endif() set(PYTHON_COMMON_SOURCES @@ -895,7 +898,6 @@ function(add_libpython name type install component) OUTPUT_NAME ${LIBPYTHON}${ABIFLAGS} LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${LIBPYTHON_LIBDIR} RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${LIBPYTHON_LIBDIR} - INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${LIBPYTHON_LIBDIR} ) set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -911,13 +913,41 @@ function(add_libpython name type install component) # Export target set_property(GLOBAL APPEND PROPERTY PYTHON_TARGETS ${name}) + if(BUILD_FRAMEWORK) + set_target_properties(${name} PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" + MACOSX_FRAMEWORK_IDENTIFIER org.python.python + MACOSX_FRAMEWORK_SHORT_VERSION_STRING "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" + MACOSX_FRAMEWORK_BUNDLE_VERSION "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" + MACOSX_RPATH ON + OUTPUT_NAME ${FRAMEWORK_NAME} + ) + else() + set_target_properties(${name} PROPERTIES + INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${LIBPYTHON_LIBDIR} + ) + endif() + if(install) - install(TARGETS ${name} EXPORT PythonTargets + install(TARGETS ${name} ARCHIVE DESTINATION ${LIBPYTHON_ARCHIVEDIR} LIBRARY DESTINATION ${LIBPYTHON_LIBDIR} RUNTIME DESTINATION ${LIBPYTHON_LIBDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT ${component} ) + if(BUILD_FRAMEWORK) + install(CODE " + message(STATUS \"Creating Python library framework symlinks...\") + execute_process( + COMMAND + \${CMAKE_COMMAND} -E create_symlink \"../${FRAMEWORK_NAME}\" libpython${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}.dylib + WORKING_DIRECTORY + \"${CMAKE_INSTALL_PREFIX}/${FRAMEWORK_DIR_PREFIX}/lib\" + ) + ") + endif() endif() endfunction() @@ -926,6 +956,15 @@ if(BUILD_LIBPYTHON_SHARED) set_target_properties(libpython-shared PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${LIBPYTHON_ARCHIVEDIR} ) + + if((MSVC_VERSION GREATER 1500) AND (NOT CMAKE_VERSION VERSION_LESS "3.1")) + install( + FILES $ + DESTINATION ${LIBPYTHON_ARCHIVEDIR} + CONFIGURATIONS Debug RelWithDebInfo + ) + endif() + if(APPLE) # HACK For python <= 2.7.3, this fix link error related to undefined _environ symbol and # is equivalent to solution implemented in commit http://hg.python.org/cpython/rev/864b983 @@ -1003,6 +1042,14 @@ if(BUILD_LIBPYTHON_SHARED) "PYTHON_DLL_NAME=\"python${PY_VERSION_MAJOR}${PY_VERSION_MINOR}$<$:_d>\"" ) endif() + + if((MSVC_VERSION GREATER 1500) AND (NOT CMAKE_VERSION VERSION_LESS "3.1")) + install( + FILES $ + DESTINATION ${LIBPYTHON_ARCHIVEDIR} + CONFIGURATIONS Debug RelWithDebInfo + ) + endif() endif() if(UNIX AND NOT APPLE) diff --git a/cmake/makefile-variables.in b/cmake/makefile-variables.in index 5dd942cbb..a899a7cbe 100644 --- a/cmake/makefile-variables.in +++ b/cmake/makefile-variables.in @@ -103,11 +103,11 @@ EXE= @CMAKE_EXECUTABLE_SUFFIX@ BUILDEXE= @CMAKE_EXECUTABLE_SUFFIX@ # Short name and location for Mac OS X Python framework -UNIVERSALSDK= -PYTHONFRAMEWORK= -PYTHONFRAMEWORKDIR= no-framework -PYTHONFRAMEWORKPREFIX= -PYTHONFRAMEWORKINSTALLDIR= +UNIVERSALSDK= @CMAKE_OSX_SYSROOT@ +PYTHONFRAMEWORK= @FRAMEWORK_NAME@ +PYTHONFRAMEWORKDIR= @FRAMEWORK_DIR_ROOT@ +PYTHONFRAMEWORKPREFIX= @FRAMEWORK_PREFIX@ +PYTHONFRAMEWORKINSTALLDIR= @FRAMEWORK_DIR_PREFIX@ # Deployment target selected during configure, to be checked # by distutils. The export statement is needed to ensure that the # deployment target is active during build. diff --git a/cmake/python/CMakeLists.txt b/cmake/python/CMakeLists.txt index 60cda177a..f5aa5dc1b 100644 --- a/cmake/python/CMakeLists.txt +++ b/cmake/python/CMakeLists.txt @@ -3,9 +3,11 @@ set(PYTHON_SOURCES ) add_executable(python ${PYTHON_SOURCES}) -set_property( - TARGET python - PROPERTY RUNTIME_OUTPUT_DIRECTORY ${BIN_BUILD_DIR} +set_target_properties( + python + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${BIN_BUILD_DIR} + OUTPUT_NAME python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR} ) target_compile_definitions(python PRIVATE Py_BUILD_CORE) add_definitions(-DPy_BUILD_CORE) @@ -26,10 +28,16 @@ if(MSVC) set_target_properties(python PROPERTIES LINK_FLAGS /STACK:2000000) endif() +if(BUILD_FRAMEWORK) + set_target_properties(python PROPERTIES + INSTALL_RPATH "@loader_path/../../../.." + ) +endif() + # Export target set_property(GLOBAL APPEND PROPERTY PYTHON_TARGETS python) -install(TARGETS python EXPORT PythonTargets RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime) +install(TARGETS python RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime) # See "is_python_build()" in sysconfig.py add_custom_command(TARGET python PRE_BUILD @@ -58,7 +66,7 @@ if(UNIX AND NOT ANDROID) add_custom_command( OUTPUT ${BIN_BUILD_DIR}/pybuilddir.txt ${EXTENSION_BUILD_DIR}/${_sysconfigdata_py} COMMAND ${PYTHON_WRAPPER_COMMAND} - ${CMAKE_CROSSCOMPILING_EMULATOR} $ -E -S -m sysconfig --generate-posix-vars + ${CMAKE_CROSSCOMPILING_EMULATOR} $ -B -S -m sysconfig --generate-posix-vars COMMAND ${CMAKE_COMMAND} -DBIN_BUILD_DIR:PATH=${BIN_BUILD_DIR} -DSYSCONFIGDATA_PY:STRING=${_sysconfigdata_py} @@ -80,10 +88,10 @@ if(UNIX AND NOT CMAKE_CROSSCOMPILING) install(CODE "message(STATUS \"Creating Python executable symlinks...\") execute_process( - COMMAND \${CMAKE_COMMAND} -E create_symlink python + COMMAND \${CMAKE_COMMAND} -E create_symlink python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR} python${PY_VERSION_MAJOR} - COMMAND \${CMAKE_COMMAND} -E create_symlink python - python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR} + COMMAND \${CMAKE_COMMAND} -E create_symlink python${PY_VERSION_MAJOR} + python WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR} )" diff --git a/patches/3.10/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch b/patches/3.10/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch new file mode 100644 index 000000000..4071d4c86 --- /dev/null +++ b/patches/3.10/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch @@ -0,0 +1,35 @@ +From 3c373cfd1c38b0ab69f5f268dc67cf45ae8933b1 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 21:44:29 -0500 +Subject: [PATCH 1/3] Prevent incorrect include of "io.h" found in libmpdec + directory + +This commit improves support for building python with built-in extensions +on windows where the header provided by libmpdec would be included instead +of the system one. +--- + Modules/_decimal/libmpdec/io.c | 2 +- + Modules/_decimal/libmpdec/{io.h => mpd_io.h} | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename Modules/_decimal/libmpdec/{io.h => mpd_io.h} (100%) + +diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c +index e7bd6ae..ecebe82 100644 +--- a/Modules/_decimal/libmpdec/io.c ++++ b/Modules/_decimal/libmpdec/io.c +@@ -37,7 +37,7 @@ + #include + #include + +-#include "io.h" ++#include "mpd_io.h" + #include "typearith.h" + + +diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpd_io.h +similarity index 100% +rename from Modules/_decimal/libmpdec/io.h +rename to Modules/_decimal/libmpdec/mpd_io.h +-- +2.47.2 + diff --git a/patches/3.10/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch b/patches/3.10/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch new file mode 100644 index 000000000..7e20b4a9f --- /dev/null +++ b/patches/3.10/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch @@ -0,0 +1,43 @@ +From de2c387f6734745b5b5d0df0ee9291c2821174a9 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 10:37:50 -0500 +Subject: [PATCH 2/3] Prevent duplicated OverlappedType symbols with built-in + extension on windows + +This commit improves support for building python with built-in extensions +on windows where the symbol from overlapped.c would clash with the one +from _winapi.c +--- + Modules/_winapi.c | 2 +- + Modules/overlapped.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Modules/_winapi.c b/Modules/_winapi.c +index f6bb07f..5164899 100644 +--- a/Modules/_winapi.c ++++ b/Modules/_winapi.c +@@ -175,7 +175,7 @@ overlapped_dealloc(OverlappedObject *self) + + /*[clinic input] + module _winapi +-class _winapi.Overlapped "OverlappedObject *" "&OverlappedType" ++class _winapi.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c13d3f5fd1dabb84]*/ + +diff --git a/Modules/overlapped.c b/Modules/overlapped.c +index b9ca86c..ae0d96c 100644 +--- a/Modules/overlapped.c ++++ b/Modules/overlapped.c +@@ -62,7 +62,7 @@ class BOOL_converter(CConverter): + + /*[clinic input] + module _overlapped +-class _overlapped.Overlapped "OverlappedObject *" "&OverlappedType" ++class _overlapped.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=92e5a799db35b96c]*/ + +-- +2.47.2 + diff --git a/patches/3.10/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch b/patches/3.10/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch new file mode 100644 index 000000000..51da27794 --- /dev/null +++ b/patches/3.10/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch @@ -0,0 +1,45 @@ +From f5f464c478f754a8f25c7fa4ddf37e7b41540885 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 11:27:32 -0500 +Subject: [PATCH 3/3] mpdecimal: Export inlined functions to support extension + built-in on windows + +This commit ensures that symbols are available when building _freeze_importlib +with all extensions built-in on windows. + +It addresses the following link error associated +with CMakeBuild\libpython\_freeze_importlib.vcxproj: + + 3>_decimal.obj : error LNK2019: unresolved external symbol _mpd_del referenced in function _PyDec_AsTuple + 3>io.obj : error LNK2001: unresolved external symbol _mpd_del + 3>basearith.obj : error LNK2019: unresolved external symbol _mpd_uint_zero referenced in function __mpd_baseshiftl + 3>io.obj : error LNK2019: unresolved external symbol _mpd_qresize referenced in function _mpd_qset_string +--- + Modules/_decimal/libmpdec/mpdecimal.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c +index f1626df..1dbc85b 100644 +--- a/Modules/_decimal/libmpdec/mpdecimal.c ++++ b/Modules/_decimal/libmpdec/mpdecimal.c +@@ -63,7 +63,7 @@ + + + #if defined(_MSC_VER) +- #define ALWAYS_INLINE __forceinline ++ #define ALWAYS_INLINE extern __forceinline + #elif defined (__IBMC__) || defined(LEGACY_COMPILER) + #define ALWAYS_INLINE + #undef inline +@@ -517,7 +517,7 @@ mpd_qresize(mpd_t *result, mpd_ssize_t nwords, uint32_t *status) + } + + /* Same as mpd_qresize, but do not set the result no NaN on failure. */ +-static ALWAYS_INLINE int ++static inline int + mpd_qresize_cxx(mpd_t *result, mpd_ssize_t nwords) + { + assert(!mpd_isconst_data(result)); /* illegal operation for a const */ +-- +2.47.2 + diff --git a/patches/3.10/README.rst b/patches/3.10/README.rst new file mode 100644 index 000000000..783b640a2 --- /dev/null +++ b/patches/3.10/README.rst @@ -0,0 +1,8 @@ +* ``0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch``: Rename header files found in + ``Modules/_decimal/libmpdec`` directory to avoid conflicts with system headers of the same name. + +* ``0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch``: Prevent duplicated OverlappedType + symbols with built-in extension on Windows. + +* ``0003-mpdecimal-Export-inlined-functions-to-support-extens.patch``: Export inlined functions to + support extension built-in on Windows. diff --git a/patches/3.11/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch b/patches/3.11/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch new file mode 100644 index 000000000..4071d4c86 --- /dev/null +++ b/patches/3.11/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch @@ -0,0 +1,35 @@ +From 3c373cfd1c38b0ab69f5f268dc67cf45ae8933b1 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 21:44:29 -0500 +Subject: [PATCH 1/3] Prevent incorrect include of "io.h" found in libmpdec + directory + +This commit improves support for building python with built-in extensions +on windows where the header provided by libmpdec would be included instead +of the system one. +--- + Modules/_decimal/libmpdec/io.c | 2 +- + Modules/_decimal/libmpdec/{io.h => mpd_io.h} | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename Modules/_decimal/libmpdec/{io.h => mpd_io.h} (100%) + +diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c +index e7bd6ae..ecebe82 100644 +--- a/Modules/_decimal/libmpdec/io.c ++++ b/Modules/_decimal/libmpdec/io.c +@@ -37,7 +37,7 @@ + #include + #include + +-#include "io.h" ++#include "mpd_io.h" + #include "typearith.h" + + +diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpd_io.h +similarity index 100% +rename from Modules/_decimal/libmpdec/io.h +rename to Modules/_decimal/libmpdec/mpd_io.h +-- +2.47.2 + diff --git a/patches/3.11/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch b/patches/3.11/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch new file mode 100644 index 000000000..7e20b4a9f --- /dev/null +++ b/patches/3.11/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch @@ -0,0 +1,43 @@ +From de2c387f6734745b5b5d0df0ee9291c2821174a9 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 10:37:50 -0500 +Subject: [PATCH 2/3] Prevent duplicated OverlappedType symbols with built-in + extension on windows + +This commit improves support for building python with built-in extensions +on windows where the symbol from overlapped.c would clash with the one +from _winapi.c +--- + Modules/_winapi.c | 2 +- + Modules/overlapped.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Modules/_winapi.c b/Modules/_winapi.c +index f6bb07f..5164899 100644 +--- a/Modules/_winapi.c ++++ b/Modules/_winapi.c +@@ -175,7 +175,7 @@ overlapped_dealloc(OverlappedObject *self) + + /*[clinic input] + module _winapi +-class _winapi.Overlapped "OverlappedObject *" "&OverlappedType" ++class _winapi.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c13d3f5fd1dabb84]*/ + +diff --git a/Modules/overlapped.c b/Modules/overlapped.c +index b9ca86c..ae0d96c 100644 +--- a/Modules/overlapped.c ++++ b/Modules/overlapped.c +@@ -62,7 +62,7 @@ class BOOL_converter(CConverter): + + /*[clinic input] + module _overlapped +-class _overlapped.Overlapped "OverlappedObject *" "&OverlappedType" ++class _overlapped.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=92e5a799db35b96c]*/ + +-- +2.47.2 + diff --git a/patches/3.11/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch b/patches/3.11/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch new file mode 100644 index 000000000..51da27794 --- /dev/null +++ b/patches/3.11/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch @@ -0,0 +1,45 @@ +From f5f464c478f754a8f25c7fa4ddf37e7b41540885 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 11:27:32 -0500 +Subject: [PATCH 3/3] mpdecimal: Export inlined functions to support extension + built-in on windows + +This commit ensures that symbols are available when building _freeze_importlib +with all extensions built-in on windows. + +It addresses the following link error associated +with CMakeBuild\libpython\_freeze_importlib.vcxproj: + + 3>_decimal.obj : error LNK2019: unresolved external symbol _mpd_del referenced in function _PyDec_AsTuple + 3>io.obj : error LNK2001: unresolved external symbol _mpd_del + 3>basearith.obj : error LNK2019: unresolved external symbol _mpd_uint_zero referenced in function __mpd_baseshiftl + 3>io.obj : error LNK2019: unresolved external symbol _mpd_qresize referenced in function _mpd_qset_string +--- + Modules/_decimal/libmpdec/mpdecimal.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c +index f1626df..1dbc85b 100644 +--- a/Modules/_decimal/libmpdec/mpdecimal.c ++++ b/Modules/_decimal/libmpdec/mpdecimal.c +@@ -63,7 +63,7 @@ + + + #if defined(_MSC_VER) +- #define ALWAYS_INLINE __forceinline ++ #define ALWAYS_INLINE extern __forceinline + #elif defined (__IBMC__) || defined(LEGACY_COMPILER) + #define ALWAYS_INLINE + #undef inline +@@ -517,7 +517,7 @@ mpd_qresize(mpd_t *result, mpd_ssize_t nwords, uint32_t *status) + } + + /* Same as mpd_qresize, but do not set the result no NaN on failure. */ +-static ALWAYS_INLINE int ++static inline int + mpd_qresize_cxx(mpd_t *result, mpd_ssize_t nwords) + { + assert(!mpd_isconst_data(result)); /* illegal operation for a const */ +-- +2.47.2 + diff --git a/patches/3.11/README.rst b/patches/3.11/README.rst index 5aea2bea7..7be318eb0 100644 --- a/patches/3.11/README.rst +++ b/patches/3.11/README.rst @@ -1 +1,9 @@ * ``0001-_bootstrap_python-Fix-execution-on-windows-disabling.patch``: _bootstrap_python: Fix execution on windows disabling site import. +* ``0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch``: Rename header files found in + ``Modules/_decimal/libmpdec`` directory to avoid conflicts with system headers of the same name. + +* ``0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch``: Prevent duplicated OverlappedType + symbols with built-in extension on Windows. + +* ``0003-mpdecimal-Export-inlined-functions-to-support-extens.patch``: Export inlined functions to + support extension built-in on Windows. diff --git a/patches/3.7/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch b/patches/3.7/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch new file mode 100644 index 000000000..0e37554fd --- /dev/null +++ b/patches/3.7/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch @@ -0,0 +1,35 @@ +From 9ec49ea39b57e69722d82b41594479a896c65ae2 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 21:44:29 -0500 +Subject: [PATCH 1/3] Prevent incorrect include of "io.h" found in libmpdec + directory + +This commit improves support for building python with built-in extensions +on windows where the header provided by libmpdec would be included instead +of the system one. +--- + Modules/_decimal/libmpdec/io.c | 2 +- + Modules/_decimal/libmpdec/{io.h => mpd_io.h} | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename Modules/_decimal/libmpdec/{io.h => mpd_io.h} (100%) + +diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c +index 3aadfb0..1cc719a 100644 +--- a/Modules/_decimal/libmpdec/io.c ++++ b/Modules/_decimal/libmpdec/io.c +@@ -38,7 +38,7 @@ + #include "bits.h" + #include "constants.h" + #include "typearith.h" +-#include "io.h" ++#include "mpd_io.h" + + + /* This file contains functions for decimal <-> string conversions, including +diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpd_io.h +similarity index 100% +rename from Modules/_decimal/libmpdec/io.h +rename to Modules/_decimal/libmpdec/mpd_io.h +-- +2.5.0 + diff --git a/patches/3.7/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch b/patches/3.7/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch new file mode 100644 index 000000000..6fd360a54 --- /dev/null +++ b/patches/3.7/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch @@ -0,0 +1,65 @@ +From d96bfdc9f531eaefdab931f6b2830278c2dc0226 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 10:37:50 -0500 +Subject: [PATCH 2/3] Prevent duplicated OverlappedType symbols with built-in + extension on windows + +This commit improves support for building python with built-in extensions +on windows where the symbol from overlapped.c would clash with the one +from _winapi.c +--- + Modules/_winapi.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Modules/_winapi.c b/Modules/_winapi.c +index 1606f0d..d81215f 100644 +--- a/Modules/_winapi.c ++++ b/Modules/_winapi.c +@@ -147,7 +147,7 @@ overlapped_dealloc(OverlappedObject *self) + + /*[clinic input] + module _winapi +-class _winapi.Overlapped "OverlappedObject *" "&OverlappedType" ++class _winapi.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c13d3f5fd1dabb84]*/ + +@@ -295,7 +295,7 @@ static PyMemberDef overlapped_members[] = { + {NULL} + }; + +-PyTypeObject OverlappedType = { ++PyTypeObject WinApiOverlappedType = { + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "_winapi.Overlapped", + /* tp_basicsize */ sizeof(OverlappedObject), +@@ -341,7 +341,7 @@ new_overlapped(HANDLE handle) + { + OverlappedObject *self; + +- self = PyObject_New(OverlappedObject, &OverlappedType); ++ self = PyObject_New(OverlappedObject, &WinApiOverlappedType); + if (!self) + return NULL; + self->handle = handle; +@@ -1537,7 +1537,7 @@ PyInit__winapi(void) + PyObject *d; + PyObject *m; + +- if (PyType_Ready(&OverlappedType) < 0) ++ if (PyType_Ready(&WinApiOverlappedType) < 0) + return NULL; + + m = PyModule_Create(&winapi_module); +@@ -1545,7 +1545,7 @@ PyInit__winapi(void) + return NULL; + d = PyModule_GetDict(m); + +- PyDict_SetItemString(d, "Overlapped", (PyObject *) &OverlappedType); ++ PyDict_SetItemString(d, "Overlapped", (PyObject *) &WinApiOverlappedType); + + /* constants */ + WINAPI_CONSTANT(F_DWORD, CREATE_NEW_CONSOLE); +-- +2.5.0 + diff --git a/patches/3.7/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch b/patches/3.7/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch new file mode 100644 index 000000000..eaa49dc01 --- /dev/null +++ b/patches/3.7/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch @@ -0,0 +1,36 @@ +From 12cd7e4b43f85822d8ab0531cb3097e5f32bd5ff Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 11:27:32 -0500 +Subject: [PATCH 3/3] mpdecimal: Export inlined functions to support extension + built-in on windows + +This commit ensures that symbols are available when building _freeze_importlib +with all extensions built-in on windows. + +It addresses the following link error associated +with CMakeBuild\libpython\_freeze_importlib.vcxproj: + + 3>_decimal.obj : error LNK2019: unresolved external symbol _mpd_del referenced in function _PyDec_AsTuple + 3>io.obj : error LNK2001: unresolved external symbol _mpd_del + 3>basearith.obj : error LNK2019: unresolved external symbol _mpd_uint_zero referenced in function __mpd_baseshiftl + 3>io.obj : error LNK2019: unresolved external symbol _mpd_qresize referenced in function _mpd_qset_string +--- + Modules/_decimal/libmpdec/mpdecimal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c +index 328ab92..5812bcd 100644 +--- a/Modules/_decimal/libmpdec/mpdecimal.c ++++ b/Modules/_decimal/libmpdec/mpdecimal.c +@@ -54,7 +54,7 @@ + + + #if defined(_MSC_VER) +- #define ALWAYS_INLINE __forceinline ++ #define ALWAYS_INLINE extern __forceinline + #elif defined(LEGACY_COMPILER) + #define ALWAYS_INLINE + #undef inline +-- +2.5.0 + diff --git a/patches/3.7/README.rst b/patches/3.7/README.rst new file mode 100644 index 000000000..783b640a2 --- /dev/null +++ b/patches/3.7/README.rst @@ -0,0 +1,8 @@ +* ``0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch``: Rename header files found in + ``Modules/_decimal/libmpdec`` directory to avoid conflicts with system headers of the same name. + +* ``0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch``: Prevent duplicated OverlappedType + symbols with built-in extension on Windows. + +* ``0003-mpdecimal-Export-inlined-functions-to-support-extens.patch``: Export inlined functions to + support extension built-in on Windows. diff --git a/patches/3.8/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch b/patches/3.8/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch new file mode 100644 index 000000000..0e37554fd --- /dev/null +++ b/patches/3.8/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch @@ -0,0 +1,35 @@ +From 9ec49ea39b57e69722d82b41594479a896c65ae2 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 21:44:29 -0500 +Subject: [PATCH 1/3] Prevent incorrect include of "io.h" found in libmpdec + directory + +This commit improves support for building python with built-in extensions +on windows where the header provided by libmpdec would be included instead +of the system one. +--- + Modules/_decimal/libmpdec/io.c | 2 +- + Modules/_decimal/libmpdec/{io.h => mpd_io.h} | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename Modules/_decimal/libmpdec/{io.h => mpd_io.h} (100%) + +diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c +index 3aadfb0..1cc719a 100644 +--- a/Modules/_decimal/libmpdec/io.c ++++ b/Modules/_decimal/libmpdec/io.c +@@ -38,7 +38,7 @@ + #include "bits.h" + #include "constants.h" + #include "typearith.h" +-#include "io.h" ++#include "mpd_io.h" + + + /* This file contains functions for decimal <-> string conversions, including +diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpd_io.h +similarity index 100% +rename from Modules/_decimal/libmpdec/io.h +rename to Modules/_decimal/libmpdec/mpd_io.h +-- +2.5.0 + diff --git a/patches/3.8/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch b/patches/3.8/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch new file mode 100644 index 000000000..6fd360a54 --- /dev/null +++ b/patches/3.8/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch @@ -0,0 +1,65 @@ +From d96bfdc9f531eaefdab931f6b2830278c2dc0226 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 10:37:50 -0500 +Subject: [PATCH 2/3] Prevent duplicated OverlappedType symbols with built-in + extension on windows + +This commit improves support for building python with built-in extensions +on windows where the symbol from overlapped.c would clash with the one +from _winapi.c +--- + Modules/_winapi.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Modules/_winapi.c b/Modules/_winapi.c +index 1606f0d..d81215f 100644 +--- a/Modules/_winapi.c ++++ b/Modules/_winapi.c +@@ -147,7 +147,7 @@ overlapped_dealloc(OverlappedObject *self) + + /*[clinic input] + module _winapi +-class _winapi.Overlapped "OverlappedObject *" "&OverlappedType" ++class _winapi.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c13d3f5fd1dabb84]*/ + +@@ -295,7 +295,7 @@ static PyMemberDef overlapped_members[] = { + {NULL} + }; + +-PyTypeObject OverlappedType = { ++PyTypeObject WinApiOverlappedType = { + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "_winapi.Overlapped", + /* tp_basicsize */ sizeof(OverlappedObject), +@@ -341,7 +341,7 @@ new_overlapped(HANDLE handle) + { + OverlappedObject *self; + +- self = PyObject_New(OverlappedObject, &OverlappedType); ++ self = PyObject_New(OverlappedObject, &WinApiOverlappedType); + if (!self) + return NULL; + self->handle = handle; +@@ -1537,7 +1537,7 @@ PyInit__winapi(void) + PyObject *d; + PyObject *m; + +- if (PyType_Ready(&OverlappedType) < 0) ++ if (PyType_Ready(&WinApiOverlappedType) < 0) + return NULL; + + m = PyModule_Create(&winapi_module); +@@ -1545,7 +1545,7 @@ PyInit__winapi(void) + return NULL; + d = PyModule_GetDict(m); + +- PyDict_SetItemString(d, "Overlapped", (PyObject *) &OverlappedType); ++ PyDict_SetItemString(d, "Overlapped", (PyObject *) &WinApiOverlappedType); + + /* constants */ + WINAPI_CONSTANT(F_DWORD, CREATE_NEW_CONSOLE); +-- +2.5.0 + diff --git a/patches/3.8/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch b/patches/3.8/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch new file mode 100644 index 000000000..eaa49dc01 --- /dev/null +++ b/patches/3.8/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch @@ -0,0 +1,36 @@ +From 12cd7e4b43f85822d8ab0531cb3097e5f32bd5ff Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 11:27:32 -0500 +Subject: [PATCH 3/3] mpdecimal: Export inlined functions to support extension + built-in on windows + +This commit ensures that symbols are available when building _freeze_importlib +with all extensions built-in on windows. + +It addresses the following link error associated +with CMakeBuild\libpython\_freeze_importlib.vcxproj: + + 3>_decimal.obj : error LNK2019: unresolved external symbol _mpd_del referenced in function _PyDec_AsTuple + 3>io.obj : error LNK2001: unresolved external symbol _mpd_del + 3>basearith.obj : error LNK2019: unresolved external symbol _mpd_uint_zero referenced in function __mpd_baseshiftl + 3>io.obj : error LNK2019: unresolved external symbol _mpd_qresize referenced in function _mpd_qset_string +--- + Modules/_decimal/libmpdec/mpdecimal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c +index 328ab92..5812bcd 100644 +--- a/Modules/_decimal/libmpdec/mpdecimal.c ++++ b/Modules/_decimal/libmpdec/mpdecimal.c +@@ -54,7 +54,7 @@ + + + #if defined(_MSC_VER) +- #define ALWAYS_INLINE __forceinline ++ #define ALWAYS_INLINE extern __forceinline + #elif defined(LEGACY_COMPILER) + #define ALWAYS_INLINE + #undef inline +-- +2.5.0 + diff --git a/patches/3.8/README.rst b/patches/3.8/README.rst new file mode 100644 index 000000000..783b640a2 --- /dev/null +++ b/patches/3.8/README.rst @@ -0,0 +1,8 @@ +* ``0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch``: Rename header files found in + ``Modules/_decimal/libmpdec`` directory to avoid conflicts with system headers of the same name. + +* ``0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch``: Prevent duplicated OverlappedType + symbols with built-in extension on Windows. + +* ``0003-mpdecimal-Export-inlined-functions-to-support-extens.patch``: Export inlined functions to + support extension built-in on Windows. diff --git a/patches/3.9/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch b/patches/3.9/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch new file mode 100644 index 000000000..403c9255e --- /dev/null +++ b/patches/3.9/0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch @@ -0,0 +1,35 @@ +From 9ec49ea39b57e69722d82b41594479a896c65ae2 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 21:44:29 -0500 +Subject: [PATCH 1/3] Prevent incorrect include of "io.h" found in libmpdec + directory + +This commit improves support for building python with built-in extensions +on windows where the header provided by libmpdec would be included instead +of the system one. +--- + Modules/_decimal/libmpdec/io.c | 2 +- + Modules/_decimal/libmpdec/{io.h => mpd_io.h} | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename Modules/_decimal/libmpdec/{io.h => mpd_io.h} (100%) + +diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c +index 3aadfb0..1cc719a 100644 +--- a/Modules/_decimal/libmpdec/io.c ++++ b/Modules/_decimal/libmpdec/io.c +@@ -38,7 +38,7 @@ + #include + + #include "typearith.h" +-#include "io.h" ++#include "mpd_io.h" + + + /* This file contains functions for decimal <-> string conversions, including +diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpd_io.h +similarity index 100% +rename from Modules/_decimal/libmpdec/io.h +rename to Modules/_decimal/libmpdec/mpd_io.h +-- +2.5.0 + diff --git a/patches/3.9/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch b/patches/3.9/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch new file mode 100644 index 000000000..6fd360a54 --- /dev/null +++ b/patches/3.9/0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch @@ -0,0 +1,65 @@ +From d96bfdc9f531eaefdab931f6b2830278c2dc0226 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 10:37:50 -0500 +Subject: [PATCH 2/3] Prevent duplicated OverlappedType symbols with built-in + extension on windows + +This commit improves support for building python with built-in extensions +on windows where the symbol from overlapped.c would clash with the one +from _winapi.c +--- + Modules/_winapi.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Modules/_winapi.c b/Modules/_winapi.c +index 1606f0d..d81215f 100644 +--- a/Modules/_winapi.c ++++ b/Modules/_winapi.c +@@ -147,7 +147,7 @@ overlapped_dealloc(OverlappedObject *self) + + /*[clinic input] + module _winapi +-class _winapi.Overlapped "OverlappedObject *" "&OverlappedType" ++class _winapi.Overlapped "OverlappedObject *" "&WinApiOverlappedType" + [clinic start generated code]*/ + /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c13d3f5fd1dabb84]*/ + +@@ -295,7 +295,7 @@ static PyMemberDef overlapped_members[] = { + {NULL} + }; + +-PyTypeObject OverlappedType = { ++PyTypeObject WinApiOverlappedType = { + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "_winapi.Overlapped", + /* tp_basicsize */ sizeof(OverlappedObject), +@@ -341,7 +341,7 @@ new_overlapped(HANDLE handle) + { + OverlappedObject *self; + +- self = PyObject_New(OverlappedObject, &OverlappedType); ++ self = PyObject_New(OverlappedObject, &WinApiOverlappedType); + if (!self) + return NULL; + self->handle = handle; +@@ -1537,7 +1537,7 @@ PyInit__winapi(void) + PyObject *d; + PyObject *m; + +- if (PyType_Ready(&OverlappedType) < 0) ++ if (PyType_Ready(&WinApiOverlappedType) < 0) + return NULL; + + m = PyModule_Create(&winapi_module); +@@ -1545,7 +1545,7 @@ PyInit__winapi(void) + return NULL; + d = PyModule_GetDict(m); + +- PyDict_SetItemString(d, "Overlapped", (PyObject *) &OverlappedType); ++ PyDict_SetItemString(d, "Overlapped", (PyObject *) &WinApiOverlappedType); + + /* constants */ + WINAPI_CONSTANT(F_DWORD, CREATE_NEW_CONSOLE); +-- +2.5.0 + diff --git a/patches/3.9/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch b/patches/3.9/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch new file mode 100644 index 000000000..d00d4bc88 --- /dev/null +++ b/patches/3.9/0003-mpdecimal-Export-inlined-functions-to-support-extens.patch @@ -0,0 +1,46 @@ +From 12cd7e4b43f85822d8ab0531cb3097e5f32bd5ff Mon Sep 17 00:00:00 2001 +From: Jean-Christophe Fillion-Robin +Date: Mon, 6 Nov 2017 11:27:32 -0500 +Subject: [PATCH 3/3] mpdecimal: Export inlined functions to support extension + built-in on windows + +This commit ensures that symbols are available when building _freeze_importlib +with all extensions built-in on windows. + +It addresses the following link error associated +with CMakeBuild\libpython\_freeze_importlib.vcxproj: + + 3>_decimal.obj : error LNK2019: unresolved external symbol _mpd_del referenced in function _PyDec_AsTuple + 3>io.obj : error LNK2001: unresolved external symbol _mpd_del + 3>basearith.obj : error LNK2019: unresolved external symbol _mpd_uint_zero referenced in function __mpd_baseshiftl + 3>io.obj : error LNK2019: unresolved external symbol _mpd_qresize referenced in function _mpd_qset_string +--- + Modules/_decimal/libmpdec/mpdecimal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c +index 328ab92..5812bcd 100644 +--- a/Modules/_decimal/libmpdec/mpdecimal.c ++++ b/Modules/_decimal/libmpdec/mpdecimal.c +@@ -63,7 +63,7 @@ + + + #if defined(_MSC_VER) +- #define ALWAYS_INLINE __forceinline ++ #define ALWAYS_INLINE extern __forceinline + #elif defined(__IBMC__) || defined(LEGACY_COMPILER) + #define ALWAYS_INLINE + #undef inline +@@ -517,7 +517,7 @@ + } + + /* Same as mpd_qresize, but do not set the result no NaN on failure. */ +-static ALWAYS_INLINE int ++static inline int + mpd_qresize_cxx(mpd_t *result, mpd_ssize_t nwords) + { + assert(!mpd_isconst_data(result)); /* illegal operation for a const */ + +-- +2.5.0 + diff --git a/patches/3.9/README.rst b/patches/3.9/README.rst new file mode 100644 index 000000000..783b640a2 --- /dev/null +++ b/patches/3.9/README.rst @@ -0,0 +1,8 @@ +* ``0001-Prevent-incorrect-include-of-io.h-found-in-libmpdec-.patch``: Rename header files found in + ``Modules/_decimal/libmpdec`` directory to avoid conflicts with system headers of the same name. + +* ``0002-Prevent-duplicated-OverlappedType-symbols-with-built.patch``: Prevent duplicated OverlappedType + symbols with built-in extension on Windows. + +* ``0003-mpdecimal-Export-inlined-functions-to-support-extens.patch``: Export inlined functions to + support extension built-in on Windows.