Techt3o commited on
Commit
fbd48f3
·
verified ·
1 Parent(s): 8dbac44

01b88f4ffc374e24bf6e512cd8879abc0afecfa682ae86557d35186636141dca

Browse files
Files changed (50) hide show
  1. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/usage +9 -0
  2. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/use-md.patch +33 -0
  3. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/use-mt.patch +33 -0
  4. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/vcpkg-cmake-wrapper.cmake +227 -0
  5. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/vcpkg.json +7 -0
  6. third-party/DPVO/Pangolin/scripts/vcpkg/ports/ptyqt/portfile.cmake +42 -0
  7. third-party/DPVO/Pangolin/scripts/vcpkg/ports/ptyqt/vcpkg.json +21 -0
  8. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pugixml/portfile.cmake +22 -0
  9. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pugixml/vcpkg.json +7 -0
  10. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pybind11/portfile.cmake +30 -0
  11. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pybind11/vcpkg.json +19 -0
  12. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pystring/CMakeLists.txt +31 -0
  13. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pystring/portfile.cmake +23 -0
  14. third-party/DPVO/Pangolin/scripts/vcpkg/ports/pystring/vcpkg.json +17 -0
  15. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/001-build-msvc.patch +199 -0
  16. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/002-build-msvc.patch +228 -0
  17. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/003-build-msvc.patch +234 -0
  18. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/004-static-library-msvc.patch +39 -0
  19. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/005-static-crt-msvc.patch +15 -0
  20. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/006-static-fix-headers.patch +14 -0
  21. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/007-fix-build-path.patch +14 -0
  22. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/008-bz2d.patch +19 -0
  23. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/portfile.cmake +152 -0
  24. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/vcpkg.json +8 -0
  25. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0001-static-library.patch +77 -0
  26. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0002-use-vcpkg-zlib.patch +39 -0
  27. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0003-devendor-external-dependencies.patch +117 -0
  28. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0004-dont-copy-vcruntime.patch +26 -0
  29. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0005-only-build-required-projects.patch +60 -0
  30. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0006-restore-support-for-windows-7.patch +187 -0
  31. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch +30 -0
  32. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0009-python.pc.patch +16 -0
  33. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0010-bz2d.patch +19 -0
  34. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/openssl.props.in +14 -0
  35. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/portfile.cmake +294 -0
  36. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/python_vcpkg.props.in +41 -0
  37. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/usage +4 -0
  38. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake +120 -0
  39. third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/vcpkg.json +50 -0
  40. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch +72 -0
  41. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/0002-fix-build-error.patch +71 -0
  42. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/mk-ca-bundle.pl +554 -0
  43. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/portfile.cmake +91 -0
  44. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/vcpkg.json +32 -0
  45. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qcustomplot/portfile.cmake +40 -0
  46. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qcustomplot/vcpkg.json +12 -0
  47. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhttpengine/portfile.cmake +27 -0
  48. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhttpengine/vcpkg.json +18 -0
  49. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhull/fix-missing-symbols.patch +29 -0
  50. third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhull/include-qhullcpp-shared.patch +21 -0
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/usage ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ The package pthreads provides CMake targets:
2
+
3
+ find_package(pthreads REQUIRED)
4
+
5
+ target_link_libraries(main PRIVATE PThreads4W::PThreads4W)
6
+ #or
7
+ target_link_libraries(main PRIVATE PThreads4W::PThreads4W_CXXEXC)
8
+ #or
9
+ target_link_libraries(main PRIVATE PThreads4W::PThreads4W_STRUCTEXC)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/use-md.patch ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/Makefile b/Makefile
2
+ index a703b9c..ff81e7c 100644
3
+ --- a/Makefile
4
+ +++ b/Makefile
5
+ @@ -173,22 +173,22 @@ VC-debug:
6
+ # @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_STATIC_LIB" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).small_static_stamp
7
+
8
+ VCE-static:
9
+ - @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCEFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).inlined_static_stamp
10
+ + @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCEFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).inlined_static_stamp
11
+
12
+ VCE-static-debug:
13
+ - @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCEFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).inlined_static_stamp
14
+ + @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCEFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).inlined_static_stamp
15
+
16
+ VSE-static:
17
+ - @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VSEFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).inlined_static_stamp
18
+ + @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VSEFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).inlined_static_stamp
19
+
20
+ VSE-static-debug:
21
+ - @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).inlined_static_stamp
22
+ + @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).inlined_static_stamp
23
+
24
+ VC-static:
25
+ - @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).inlined_static_stamp
26
+ + @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).inlined_static_stamp
27
+
28
+ VC-static-debug:
29
+ - @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).inlined_static_stamp
30
+ + @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).inlined_static_stamp
31
+
32
+
33
+ realclean: clean
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/use-mt.patch ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/Makefile b/Makefile
2
+ index a703b9c..502275f 100644
3
+ --- a/Makefile
4
+ +++ b/Makefile
5
+ @@ -134,22 +134,22 @@ all-tests-mt:
6
+ @ echo $@ completed successfully.
7
+
8
+ VCE:
9
+ - @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).dll
10
+ + @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).dll
11
+
12
+ VCE-debug:
13
+ - @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).dll
14
+ + @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).dll
15
+
16
+ VSE:
17
+ - @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VSEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).dll
18
+ + @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VSEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).dll
19
+
20
+ VSE-debug:
21
+ - @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).dll
22
+ + @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).dll
23
+
24
+ VC:
25
+ - @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).dll
26
+ + @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).dll
27
+
28
+ VC-debug:
29
+ - @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).dll
30
+ + @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).dll
31
+
32
+ #
33
+ # Static builds
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/vcpkg-cmake-wrapper.cmake ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #.rst:
2
+ # PThreads4W config wrap for vcpkg
3
+ # ------------
4
+ #
5
+ # Find the PThread4W includes and library.
6
+ #
7
+ # Result Variables
8
+ # ^^^^^^^^^^^^^^^^
9
+ #
10
+ # This script defines the following variables:
11
+ #
12
+ # ``PThreads4W_FOUND``
13
+ # True if PThreads4W library found
14
+ #
15
+ # ``PThreads4W_VERSION``
16
+ # Containing the PThreads4W version tag (manually defined)
17
+ #
18
+ # ``PThreads4W_INCLUDE_DIR``
19
+ # Location of PThreads4W headers
20
+ #
21
+ # ``PThreads4W_LIBRARY``
22
+ # List of libraries to link with when using PThreads4W (no exception handling)
23
+ #
24
+ # ``PThreads4W_CXXEXC_LIBRARY``
25
+ # List of libraries to link with when using PThreads4W (C++ exception handling)
26
+ #
27
+ # ``PThreads4W_STRUCTEXC_LIBRARY``
28
+ # List of libraries to link with when using PThreads4W (struct exception handling)
29
+ #
30
+ # Result Targets
31
+ # ^^^^^^^^^^^^^^^^
32
+ #
33
+ # This script defines the following targets:
34
+ #
35
+ # ``PThreads4W::PThreads4W``
36
+ # Target to use PThreads4W (no exception handling)
37
+ #
38
+ # ``PThreads4W::PThreads4W_CXXEXC``
39
+ # Target to use PThreads4W (C++ exception handling)
40
+ #
41
+ # ``PThreads4W::PThreads4W_STRUCTEXC``
42
+ # Target to use PThreads4W (struct exception handling)
43
+ #
44
+
45
+ include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
46
+ include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
47
+
48
+ if(NOT PThreads4W_INCLUDE_DIR)
49
+ find_path(PThreads4W_INCLUDE_DIR NAMES pthread.h)
50
+ endif()
51
+
52
+ set(PThreads4W_MAJOR_VERSION 3)
53
+ set(PThreads4W_MINOR_VERSION 0)
54
+ set(PThreads4W_PATCH_VERSION 0)
55
+ set(PThreads4W_VERSION "${PThreads4W_MAJOR_VERSION}.${PThreads4W_MINOR_VERSION}.${PThreads4W_PATCH_VERSION}")
56
+
57
+ # Allow libraries to be set manually
58
+ if(NOT PThreads4W_LIBRARY)
59
+ find_library(PThreads4W_LIBRARY_RELEASE NAMES pthreadVC${PThreads4W_MAJOR_VERSION})
60
+ find_library(PThreads4W_LIBRARY_DEBUG NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d)
61
+ select_library_configurations(PThreads4W)
62
+ endif()
63
+ if(NOT PThreads4W_CXXEXC_LIBRARY)
64
+ find_library(PThreads4W_CXXEXC_LIBRARY_RELEASE NAMES pthreadVCE${PThreads4W_MAJOR_VERSION})
65
+ find_library(PThreads4W_CXXEXC_LIBRARY_DEBUG NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d)
66
+ select_library_configurations(PThreads4W_CXXEXC)
67
+ endif()
68
+ if(NOT PThreads4W_STRUCTEXC_LIBRARY)
69
+ find_library(PThreads4W_STRUCTEXC_LIBRARY_RELEASE NAMES pthreadVSE${PThreads4W_MAJOR_VERSION})
70
+ find_library(PThreads4W_STRUCTEXC_LIBRARY_DEBUG NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d)
71
+ select_library_configurations(PThreads4W_STRUCTEXC)
72
+ endif()
73
+
74
+ find_package_handle_standard_args(PThreads4W DEFAULT_MSG PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY PThreads4W_INCLUDE_DIR)
75
+ mark_as_advanced(PThreads4W_INCLUDE_DIR PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY)
76
+
77
+ set(PThreads4W_DLL_DIR ${PThreads4W_INCLUDE_DIR})
78
+ list(TRANSFORM PThreads4W_DLL_DIR APPEND "/../bin")
79
+ message(STATUS "PThreads4W_DLL_DIR: ${PThreads4W_DLL_DIR}")
80
+ set(PThreads4W_DEBUG_DLL_DIR ${PThreads4W_INCLUDE_DIR})
81
+ list(TRANSFORM PThreads4W_DEBUG_DLL_DIR APPEND "/../debug/bin")
82
+ message(STATUS "PThreads4W_DEBUG_DLL_DIR: ${PThreads4W_DEBUG_DLL_DIR}")
83
+
84
+ find_file(PThreads4W_LIBRARY_RELEASE_DLL NAMES pthreadVC${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR})
85
+ find_file(PThreads4W_LIBRARY_DEBUG_DLL NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DEBUG_DLL_DIR})
86
+ find_file(PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR})
87
+ find_file(PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DEBUG_DLL_DIR})
88
+ find_file(PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR})
89
+ find_file(PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DEBUG_DLL_DIR})
90
+
91
+ #Compatibility definitions, deprecated
92
+ set(PTHREAD_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "")
93
+ set(PTHREADS_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "")
94
+ set(PThreads_windows_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "")
95
+ set(PTHREAD_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "")
96
+ set(PTHREADS_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "")
97
+ set(PTHREAD_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "")
98
+ set(PTHREADS_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "")
99
+ set(LIBPTHREAD ${PThreads4W_LIBRARY} CACHE STRING "")
100
+ set(LIBPTHREADS ${PThreads4W_LIBRARY} CACHE STRING "")
101
+ set(PThreads_windows_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "")
102
+ set(PThreads_VERSION "${PThreads4W_VERSION}")
103
+ if(PThreads4W_FOUND)
104
+ set(PThreads_windows_FOUND TRUE)
105
+ endif()
106
+
107
+ #TARGETS
108
+ if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_CXXEXC )
109
+ if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}" )
110
+ add_library( PThreads4W::PThreads4W_CXXEXC SHARED IMPORTED )
111
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
112
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}"
113
+ IMPORTED_IMPLIB "${PThreads4W_CXXEXC_LIBRARY_RELEASE}"
114
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
115
+ IMPORTED_CONFIGURATIONS Release
116
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
117
+ if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL}" )
118
+ set_property( TARGET PThreads4W::PThreads4W_CXXEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
119
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
120
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL}"
121
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
122
+ endif()
123
+ else()
124
+ add_library( PThreads4W::PThreads4W_CXXEXC UNKNOWN IMPORTED )
125
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
126
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_CXXEXC_LIBRARY_RELEASE}"
127
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
128
+ IMPORTED_CONFIGURATIONS Release
129
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
130
+ if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
131
+ set_property( TARGET PThreads4W::PThreads4W_CXXEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
132
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
133
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
134
+ endif()
135
+ endif()
136
+ endif()
137
+
138
+ if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_STRUCTEXC )
139
+ if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL}" )
140
+ add_library( PThreads4W::PThreads4W_STRUCTEXC SHARED IMPORTED )
141
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
142
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL}"
143
+ IMPORTED_IMPLIB "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}"
144
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
145
+ IMPORTED_CONFIGURATIONS Release
146
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
147
+ if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL}" )
148
+ set_property( TARGET PThreads4W::PThreads4W_STRUCTEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
149
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
150
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL}"
151
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
152
+ endif()
153
+ else()
154
+ add_library( PThreads4W::PThreads4W_STRUCTEXC UNKNOWN IMPORTED )
155
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
156
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}"
157
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
158
+ IMPORTED_CONFIGURATIONS Release
159
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
160
+ if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
161
+ set_property( TARGET PThreads4W::PThreads4W_STRUCTEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
162
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
163
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
164
+ endif()
165
+ endif()
166
+ endif()
167
+
168
+ if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W )
169
+ if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" )
170
+ add_library( PThreads4W::PThreads4W SHARED IMPORTED )
171
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
172
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}"
173
+ IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}"
174
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
175
+ IMPORTED_CONFIGURATIONS Release
176
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
177
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" )
178
+ set_property( TARGET PThreads4W::PThreads4W APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
179
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
180
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}"
181
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
182
+ endif()
183
+ else()
184
+ add_library( PThreads4W::PThreads4W UNKNOWN IMPORTED )
185
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
186
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}"
187
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
188
+ IMPORTED_CONFIGURATIONS Release
189
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
190
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" )
191
+ set_property( TARGET PThreads4W::PThreads4W APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
192
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
193
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
194
+ endif()
195
+ endif()
196
+ endif()
197
+
198
+ #Compatibility targets, deprecated
199
+ if( PThreads4W_FOUND AND NOT TARGET PThreads_windows::PThreads_windows )
200
+ if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" )
201
+ add_library( PThreads_windows::PThreads_windows SHARED IMPORTED )
202
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
203
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}"
204
+ IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}"
205
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
206
+ IMPORTED_CONFIGURATIONS Release
207
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
208
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" )
209
+ set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
210
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
211
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}"
212
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
213
+ endif()
214
+ else()
215
+ add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED )
216
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
217
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}"
218
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
219
+ IMPORTED_CONFIGURATIONS Release
220
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
221
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" )
222
+ set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
223
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
224
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
225
+ endif()
226
+ endif()
227
+ endif()
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pthreads/vcpkg.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pthreads",
3
+ "version": "3.0.0",
4
+ "port-version": 10,
5
+ "description": "pthreads for windows",
6
+ "homepage": "https://sourceware.org/pub/pthreads-win32/"
7
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/ptyqt/portfile.cmake ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ vcpkg_from_github(
2
+ OUT_SOURCE_PATH SOURCE_PATH
3
+ REPO kafeg/ptyqt
4
+ REF 0.6.5
5
+ SHA512 0deb12be6c0e7bb44775daef3d4361c5d22143bc32cbf251ef99f10784b8996c4aa8e2806f1e08c3b39749ada6e85be91d721830ceee5d6ff86eaf714ef4c928
6
+ HEAD_REF master
7
+ )
8
+
9
+ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
10
+ set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -lrt")
11
+ set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -lrt")
12
+
13
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
14
+ file(READ ${SOURCE_PATH}/core/CMakeLists.txt filedata)
15
+ string(REPLACE "-static-libstdc++" "-static-libstdc++ -lglib-2.0" filedata "${filedata}")
16
+ file(WRITE ${SOURCE_PATH}/core/CMakeLists.txt "${filedata}")
17
+ else()
18
+ file(READ ${SOURCE_PATH}/core/CMakeLists.txt filedata)
19
+ string(REPLACE "-static-libstdc++ -lglib-2.0" "-static-libstdc++" filedata "${filedata}")
20
+ file(WRITE ${SOURCE_PATH}/core/CMakeLists.txt "${filedata}")
21
+ endif()
22
+ endif()
23
+
24
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
25
+ set(BUILD_TYPE SHARED)
26
+ else()
27
+ set(BUILD_TYPE STATIC)
28
+ endif()
29
+
30
+ vcpkg_cmake_configure(
31
+ SOURCE_PATH ${SOURCE_PATH}
32
+ OPTIONS
33
+ -DNO_BUILD_TESTS=1
34
+ -DNO_BUILD_EXAMPLES=1
35
+ -DBUILD_TYPE=${BUILD_TYPE}
36
+ )
37
+
38
+ vcpkg_cmake_install()
39
+ vcpkg_copy_pdbs()
40
+
41
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
42
+ file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/ptyqt/vcpkg.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ptyqt",
3
+ "version": "0.6.5",
4
+ "description": "PtyQt - C++ library for work with PseudoTerminals",
5
+ "supports": "!uwp",
6
+ "dependencies": [
7
+ "qt5-base",
8
+ {
9
+ "name": "vcpkg-cmake",
10
+ "host": true
11
+ },
12
+ {
13
+ "name": "vcpkg-cmake-config",
14
+ "host": true
15
+ },
16
+ {
17
+ "name": "winpty",
18
+ "platform": "windows"
19
+ }
20
+ ]
21
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pugixml/portfile.cmake ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ vcpkg_from_github(
2
+ OUT_SOURCE_PATH SOURCE_PATH
3
+ REPO zeux/pugixml
4
+ REF v1.11.4
5
+ SHA512 a1fdf4cbd744318fd339362465472279767777b18a3c8c7e8618d5e637213c632bf9dd8144d16ae22a75cfbde007f383e2feb49084e681c930fc89a2e3f2bc4f
6
+ HEAD_REF master
7
+ )
8
+
9
+ vcpkg_configure_cmake(
10
+ SOURCE_PATH ${SOURCE_PATH}
11
+ PREFER_NINJA
12
+ OPTIONS -DUSE_POSTFIX=ON
13
+ )
14
+
15
+ vcpkg_install_cmake()
16
+ vcpkg_copy_pdbs()
17
+ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/pugixml)
18
+ vcpkg_fixup_pkgconfig()
19
+
20
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
21
+
22
+ file(INSTALL ${SOURCE_PATH}/readme.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pugixml/vcpkg.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pugixml",
3
+ "version-string": "1.11.4",
4
+ "port-version": 1,
5
+ "description": "Light-weight, simple and fast XML parser for C++ with XPath support",
6
+ "homepage": "https://github.com/zeux/pugixml"
7
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pybind11/portfile.cmake ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ vcpkg_from_github(
2
+ OUT_SOURCE_PATH SOURCE_PATH
3
+ REPO pybind/pybind11
4
+ REF v2.9.2
5
+ SHA512 c6c18e5f59873adb3692640ade26472abd257607e7bb9fd48cfd1949878811e83d6ac6eb8c8dd926622d52ca4f13e5e6a58e0abaaaa1fa814ee831ea2b515272
6
+ HEAD_REF master
7
+ )
8
+
9
+ vcpkg_cmake_configure(
10
+ SOURCE_PATH "${SOURCE_PATH}"
11
+ OPTIONS
12
+ -DPYBIND11_TEST=OFF
13
+ -DPYBIND11_FINDPYTHON=ON
14
+ OPTIONS_RELEASE
15
+ -DPYTHON_IS_DEBUG=OFF
16
+ OPTIONS_DEBUG
17
+ -DPYTHON_IS_DEBUG=ON
18
+ )
19
+
20
+ vcpkg_cmake_install()
21
+ vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/pybind11")
22
+
23
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/")
24
+
25
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/pybind11/pybind11Tools.cmake"
26
+ [=[find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED ${_pybind11_quiet})]=]
27
+ [=[find_package(PythonLibs ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED ${_pybind11_quiet})]=]) # CMake's PythonLibs works better with vcpkg
28
+
29
+ # copy license
30
+ file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pybind11/vcpkg.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pybind11",
3
+ "version": "2.9.2",
4
+ "description": "pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code",
5
+ "homepage": "https://github.com/pybind/pybind11",
6
+ "license": "BSD-3-Clause",
7
+ "supports": "!(arm & windows)",
8
+ "dependencies": [
9
+ "python3",
10
+ {
11
+ "name": "vcpkg-cmake",
12
+ "host": true
13
+ },
14
+ {
15
+ "name": "vcpkg-cmake-config",
16
+ "host": true
17
+ }
18
+ ]
19
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pystring/CMakeLists.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cmake_minimum_required(VERSION 3.12)
2
+ project(pystring CXX)
3
+
4
+ if(MSVC)
5
+ add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
6
+ endif()
7
+
8
+ add_library(pystring pystring.cpp)
9
+ target_include_directories(
10
+ pystring
11
+ PUBLIC
12
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
13
+ $<INSTALL_INTERFACE:include>
14
+ )
15
+
16
+ include(GNUInstallDirs)
17
+
18
+ install(
19
+ TARGETS pystring
20
+ EXPORT pystring-config
21
+ )
22
+
23
+ if(NOT DISABLE_INSTALL_HEADERS)
24
+ install(FILES pystring.h DESTINATION include/pystring)
25
+ endif()
26
+
27
+ install(
28
+ EXPORT pystring-config
29
+ NAMESPACE pystring::
30
+ DESTINATION share/pystring
31
+ )
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pystring/portfile.cmake ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
2
+
3
+ vcpkg_from_github(
4
+ OUT_SOURCE_PATH SOURCE_PATH
5
+ REPO imageworks/pystring
6
+ REF v1.1.3
7
+ SHA512 a46bb2e96d6eb351a4a8097cde46ac2877d28e88f9e57e0ac36c42e8fc8543517c4be70306a01e2f88a891fc53c612494aeb37f47a200d94b8e1b050ed16eff6
8
+ HEAD_REF master
9
+ )
10
+
11
+ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
12
+
13
+ vcpkg_cmake_configure(
14
+ SOURCE_PATH ${SOURCE_PATH}
15
+ PREFER_NINJA
16
+ OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
17
+ )
18
+
19
+ vcpkg_cmake_install()
20
+ vcpkg_cmake_config_fixup()
21
+ vcpkg_copy_pdbs()
22
+
23
+ file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/pystring/vcpkg.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pystring",
3
+ "version-semver": "1.1.3",
4
+ "port-version": 4,
5
+ "description": "Pystring is a collection of C++ functions which match the interface and behavior of python's string class methods using std::string",
6
+ "homepage": "https://github.com/imageworks/pystring",
7
+ "dependencies": [
8
+ {
9
+ "name": "vcpkg-cmake",
10
+ "host": true
11
+ },
12
+ {
13
+ "name": "vcpkg-cmake-config",
14
+ "host": true
15
+ }
16
+ ]
17
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/001-build-msvc.patch ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
2
+ index 86a85c1..65a60b5 100644
3
+ --- a/Lib/distutils/command/build_ext.py
4
+ +++ b/Lib/distutils/command/build_ext.py
5
+ @@ -193,7 +193,7 @@ class build_ext (Command):
6
+ # Append the source distribution include and library directories,
7
+ # this allows distutils on windows to work in the source tree
8
+ self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC'))
9
+ - if MSVC_VERSION == 9:
10
+ + if MSVC_VERSION >= 9:
11
+ # Use the .lib files for the correct architecture
12
+ if self.plat_name == 'win32':
13
+ suffix = ''
14
+ diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
15
+ index 33d3e51..9fe6417 100644
16
+ --- a/Lib/distutils/msvc9compiler.py
17
+ +++ b/Lib/distutils/msvc9compiler.py
18
+ @@ -662,11 +662,12 @@ class MSVCCompiler(CCompiler) :
19
+ if mfinfo is not None:
20
+ mffilename, mfid = mfinfo
21
+ out_arg = '-outputresource:%s;%s' % (output_filename, mfid)
22
+ - try:
23
+ - self.spawn(['mt.exe', '-nologo', '-manifest',
24
+ - mffilename, out_arg])
25
+ - except DistutilsExecError, msg:
26
+ - raise LinkError(msg)
27
+ + if self.__version < 10:
28
+ + try:
29
+ + self.spawn(['mt.exe', '-nologo', '-manifest',
30
+ + mffilename, out_arg])
31
+ + except DistutilsExecError, msg:
32
+ + raise LinkError(msg)
33
+ else:
34
+ log.debug("skipping %s (up-to-date)", output_filename)
35
+
36
+ diff --git a/PC/dl_nt.c b/PC/dl_nt.c
37
+ index 3e58bac..cad9de5 100644
38
+ --- a/PC/dl_nt.c
39
+ +++ b/PC/dl_nt.c
40
+ @@ -18,6 +18,7 @@ char dllVersionBuffer[16] = ""; // a private buffer
41
+ HMODULE PyWin_DLLhModule = NULL;
42
+ const char *PyWin_DLLVersionString = dllVersionBuffer;
43
+
44
+ +#if HAVE_SXS
45
+ // Windows "Activation Context" work:
46
+ // Our .pyd extension modules are generally built without a manifest (ie,
47
+ // those included with Python and those built with a default distutils.
48
+ @@ -29,6 +30,8 @@ const char *PyWin_DLLVersionString = dllVersionBuffer;
49
+ // As an added complication, this magic only works on XP or later - we simply
50
+ // use the existence (or not) of the relevant function pointers from kernel32.
51
+ // See bug 4566 (http://python.org/sf/4566) for more details.
52
+ +// In Visual Studio 2010, side by side assemblies are no longer used by
53
+ +// default.
54
+
55
+ typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *);
56
+ typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *);
57
+ @@ -75,6 +78,7 @@ void _Py_DeactivateActCtx(ULONG_PTR cookie)
58
+ if (!(*pfnDeactivateActCtx)(0, cookie))
59
+ OutputDebugString("Python failed to de-activate the activation context\n");
60
+ }
61
+ +#endif /* HAVE_SXS */
62
+
63
+ BOOL WINAPI DllMain (HANDLE hInst,
64
+ ULONG ul_reason_for_call,
65
+ @@ -87,6 +91,7 @@ BOOL WINAPI DllMain (HANDLE hInst,
66
+ // 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
67
+ LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
68
+
69
+ +#if HAVE_SXS
70
+ // and capture our activation context for use when loading extensions.
71
+ _LoadActCtxPointers();
72
+ if (pfnGetCurrentActCtx && pfnAddRefActCtx)
73
+ @@ -98,12 +103,15 @@ BOOL WINAPI DllMain (HANDLE hInst,
74
+ "activation context\n");
75
+ return FALSE;
76
+ }
77
+ +#endif
78
+ break;
79
+
80
+ case DLL_PROCESS_DETACH:
81
+ +#if HAVE_SXS
82
+ if (pfnReleaseActCtx)
83
+ (*pfnReleaseActCtx)(PyWin_DLLhActivationContext);
84
+ +#endif
85
+ break;
86
+ }
87
+ return TRUE;
88
+ }
89
+ diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
90
+ index 44c82e4..091957e 100644
91
+ --- a/PC/msvcrtmodule.c
92
+ +++ b/PC/msvcrtmodule.c
93
+ @@ -25,6 +25,8 @@
94
+ #ifdef _MSC_VER
95
+ #if _MSC_VER >= 1500 && _MSC_VER < 1600
96
+ #include <crtassem.h>
97
+ +#elif _MSC_VER >= 1600
98
+ +#include <crtversion.h>
99
+ #endif
100
+ #endif
101
+
102
+ @@ -398,7 +400,7 @@ PyMODINIT_FUNC
103
+ initmsvcrt(void)
104
+ {
105
+ int st;
106
+ - PyObject *d;
107
+ + PyObject *d, *version;
108
+ PyObject *m = Py_InitModule("msvcrt", msvcrt_functions);
109
+ if (m == NULL)
110
+ return;
111
+ @@ -412,6 +414,7 @@ initmsvcrt(void)
112
+ insertint(d, "LK_UNLCK", _LK_UNLCK);
113
+
114
+ /* constants for the crt versions */
115
+ + (void)st;
116
+ #ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
117
+ st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
118
+ _VC_ASSEMBLY_PUBLICKEYTOKEN);
119
+ @@ -427,4 +430,13 @@ initmsvcrt(void)
120
+ __LIBRARIES_ASSEMBLY_NAME_PREFIX);
121
+ if (st < 0)return;
122
+ #endif
123
+ +/* constants for the 2010 crt versions */
124
+ +#if defined(_VC_CRT_MAJOR_VERSION) && defined (_VC_CRT_MINOR_VERSION) && defined(_VC_CRT_BUILD_VERSION) && defined(_VC_CRT_RBUILD_VERSION)
125
+ + version = PyUnicode_FromFormat("%d.%d.%d.%d", _VC_CRT_MAJOR_VERSION,
126
+ + _VC_CRT_MINOR_VERSION,
127
+ + _VC_CRT_BUILD_VERSION,
128
+ + _VC_CRT_RBUILD_VERSION);
129
+ + st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
130
+ + if (st < 0) return NULL;
131
+ +#endif
132
+ }
133
+ diff --git a/PC/pyconfig.h b/PC/pyconfig.h
134
+ index 5fa6398..0cbd236 100644
135
+ --- a/PC/pyconfig.h
136
+ +++ b/PC/pyconfig.h
137
+ @@ -226,14 +226,19 @@ typedef int pid_t;
138
+ #define Py_IS_FINITE(X) _finite(X)
139
+ #define copysign _copysign
140
+
141
+ -#endif /* _MSC_VER */
142
+ +/* Side by Side assemblies supported in VS 2005 and VS 2008 but not 2010*/
143
+ +#if _MSC_VER >= 1400 && _MSC_VER < 1600
144
+ +#define HAVE_SXS 1
145
+ +#endif
146
+
147
+ /* define some ANSI types that are not defined in earlier Win headers */
148
+ -#if defined(_MSC_VER) && _MSC_VER >= 1200
149
+ +#if _MSC_VER >= 1200
150
+ /* This file only exists in VC 6.0 or higher */
151
+ #include <basetsd.h>
152
+ #endif
153
+
154
+ +#endif /* _MSC_VER */
155
+ +
156
+ /* ------------------------------------------------------------------------*/
157
+ /* The Borland compiler defines __BORLANDC__ */
158
+ /* XXX These defines are likely incomplete, but should be easy to fix. */
159
+ diff --git a/Python/dynload_win.c b/Python/dynload_win.c
160
+ index 4e5555e..8626642 100644
161
+ --- a/Python/dynload_win.c
162
+ +++ b/Python/dynload_win.c
163
+ @@ -12,8 +12,10 @@
164
+ #include <windows.h>
165
+
166
+ // "activation context" magic - see dl_nt.c...
167
+ +#if HAVE_SXS
168
+ extern ULONG_PTR _Py_ActivateActCtx();
169
+ void _Py_DeactivateActCtx(ULONG_PTR cookie);
170
+ +#endif
171
+
172
+ const struct filedescr _PyImport_DynLoadFiletab[] = {
173
+ #ifdef _DEBUG
174
+ @@ -176,7 +178,9 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
175
+ char pathbuf[260];
176
+ LPTSTR dummy;
177
+ unsigned int old_mode;
178
+ +#if HAVE_SXS
179
+ ULONG_PTR cookie = 0;
180
+ +#endif
181
+ /* We use LoadLibraryEx so Windows looks for dependent DLLs
182
+ in directory of pathname first. However, Windows95
183
+ can sometimes not work correctly unless the absolute
184
+ @@ -190,11 +194,15 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
185
+ sizeof(pathbuf),
186
+ pathbuf,
187
+ &dummy)) {
188
+ +#if HAVE_SXS
189
+ ULONG_PTR cookie = _Py_ActivateActCtx();
190
+ +#endif
191
+ /* XXX This call doesn't exist in Windows CE */
192
+ hDLL = LoadLibraryEx(pathname, NULL,
193
+ LOAD_WITH_ALTERED_SEARCH_PATH);
194
+ +#if HAVE_SXS
195
+ _Py_DeactivateActCtx(cookie);
196
+ +#endif
197
+ }
198
+
199
+ /* restore old error mode settings */
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/002-build-msvc.patch ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
2
+ index ab10ec5..6c43d82 100644
3
+ --- a/Lib/ctypes/util.py
4
+ +++ b/Lib/ctypes/util.py
5
+ @@ -19,6 +19,8 @@ if os.name == "nt":
6
+ i = i + len(prefix)
7
+ s, rest = sys.version[i:].split(" ", 1)
8
+ majorVersion = int(s[:-2]) - 6
9
+ + if majorVersion >= 13:
10
+ + majorVersion += 1
11
+ minorVersion = int(s[2:3]) / 10.0
12
+ # I don't think paths are affected by minor version in version 6
13
+ if majorVersion == 6:
14
+ @@ -36,8 +38,10 @@ if os.name == "nt":
15
+ return None
16
+ if version <= 6:
17
+ clibname = 'msvcrt'
18
+ - else:
19
+ + elif version <= 13:
20
+ clibname = 'msvcr%d' % (version * 10)
21
+ + else:
22
+ + clibname = 'appcrt%d' % (version * 10)
23
+
24
+ # If python was built with in debug mode
25
+ import imp
26
+ diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
27
+ index 65a60b5..b2ee260 100644
28
+ --- a/Lib/distutils/command/build_ext.py
29
+ +++ b/Lib/distutils/command/build_ext.py
30
+ @@ -196,7 +196,7 @@ class build_ext (Command):
31
+ if MSVC_VERSION >= 9:
32
+ # Use the .lib files for the correct architecture
33
+ if self.plat_name == 'win32':
34
+ - suffix = ''
35
+ + suffix = 'win32'
36
+ else:
37
+ # win-amd64 or win-ia64
38
+ suffix = self.plat_name[4:]
39
+ diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
40
+ index 9fe6417..57d42b7 100644
41
+ --- a/Lib/distutils/msvc9compiler.py
42
+ +++ b/Lib/distutils/msvc9compiler.py
43
+ @@ -182,6 +182,9 @@ def get_build_version():
44
+ i = i + len(prefix)
45
+ s, rest = sys.version[i:].split(" ", 1)
46
+ majorVersion = int(s[:-2]) - 6
47
+ + if majorVersion >= 13:
48
+ + # v13 was skipped and should be v14
49
+ + majorVersion += 1
50
+ minorVersion = int(s[2:3]) / 10.0
51
+ # I don't think paths are affected by minor version in version 6
52
+ if majorVersion == 6:
53
+ diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py
54
+ index 0e69fd3..77025c6 100644
55
+ --- a/Lib/distutils/msvccompiler.py
56
+ +++ b/Lib/distutils/msvccompiler.py
57
+ @@ -164,6 +164,9 @@ def get_build_version():
58
+ i = i + len(prefix)
59
+ s, rest = sys.version[i:].split(" ", 1)
60
+ majorVersion = int(s[:-2]) - 6
61
+ + if majorVersion >= 13:
62
+ + # v13 was skipped and should be v14
63
+ + majorVersion += 1
64
+ minorVersion = int(s[2:3]) / 10.0
65
+ # I don't think paths are affected by minor version in version 6
66
+ if majorVersion == 6:
67
+ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
68
+ index 7a1a694..7d07150 100644
69
+ --- a/Modules/posixmodule.c
70
+ +++ b/Modules/posixmodule.c
71
+ @@ -558,15 +558,33 @@ _PyInt_FromDev(PY_LONG_LONG v)
72
+ /* The actual size of the structure is determined at runtime.
73
+ * Only the first items must be present.
74
+ */
75
+ +
76
+ +#if _MSC_VER >= 1900
77
+ +
78
+ +typedef struct {
79
+ + CRITICAL_SECTION lock;
80
+ + intptr_t osfhnd;
81
+ + __int64 startpos;
82
+ + char osfile;
83
+ +} my_ioinfo;
84
+ +
85
+ +#define IOINFO_L2E 6
86
+ +#define IOINFO_ARRAYS 128
87
+ +
88
+ +#else
89
+ +
90
+ typedef struct {
91
+ intptr_t osfhnd;
92
+ char osfile;
93
+ } my_ioinfo;
94
+
95
+ -extern __declspec(dllimport) char * __pioinfo[];
96
+ #define IOINFO_L2E 5
97
+ -#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
98
+ #define IOINFO_ARRAYS 64
99
+ +
100
+ +#endif
101
+ +
102
+ +extern __declspec(dllimport) char * __pioinfo[];
103
+ +#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
104
+ #define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)
105
+ #define FOPEN 0x01
106
+ #define _NO_CONSOLE_FILENO (intptr_t)-2
107
+ diff --git a/Modules/timemodule.c b/Modules/timemodule.c
108
+ index 61b8d61..7678283 100644
109
+ --- a/Modules/timemodule.c
110
+ +++ b/Modules/timemodule.c
111
+ @@ -808,7 +808,7 @@ inittimezone(PyObject *m) {
112
+ #ifdef PYOS_OS2
113
+ PyModule_AddIntConstant(m, "timezone", _timezone);
114
+ #else /* !PYOS_OS2 */
115
+ - PyModule_AddIntConstant(m, "timezone", timezone);
116
+ + PyModule_AddIntConstant(m, "timezone", _timezone);
117
+ #endif /* PYOS_OS2 */
118
+ #ifdef HAVE_ALTZONE
119
+ PyModule_AddIntConstant(m, "altzone", altzone);
120
+ @@ -816,7 +816,7 @@ inittimezone(PyObject *m) {
121
+ #ifdef PYOS_OS2
122
+ PyModule_AddIntConstant(m, "altzone", _timezone-3600);
123
+ #else /* !PYOS_OS2 */
124
+ - PyModule_AddIntConstant(m, "altzone", timezone-3600);
125
+ + PyModule_AddIntConstant(m, "altzone", _timezone-3600);
126
+ #endif /* PYOS_OS2 */
127
+ #endif
128
+ PyModule_AddIntConstant(m, "daylight", daylight);
129
+ diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c
130
+ index e3b52a8..a7d1c2c 100644
131
+ --- a/PC/bdist_wininst/install.c
132
+ +++ b/PC/bdist_wininst/install.c
133
+ @@ -1185,7 +1185,7 @@ static void CenterWindow(HWND hwnd)
134
+
135
+ #include <prsht.h>
136
+
137
+ -BOOL CALLBACK
138
+ +INT_PTR CALLBACK
139
+ IntroDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
140
+ {
141
+ LPNMHDR lpnm;
142
+ @@ -1534,7 +1534,7 @@ SCHEME *GetScheme(int major, int minor)
143
+ return old_scheme;
144
+ }
145
+
146
+ -BOOL CALLBACK
147
+ +INT_PTR CALLBACK
148
+ SelectPythonDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
149
+ {
150
+ LPNMHDR lpnm;
151
+ @@ -1836,7 +1836,7 @@ static void CloseLogfile(void)
152
+ fclose(logfile);
153
+ }
154
+
155
+ -BOOL CALLBACK
156
+ +INT_PTR CALLBACK
157
+ InstallFilesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
158
+ {
159
+ LPNMHDR lpnm;
160
+ @@ -1991,7 +1991,7 @@ InstallFilesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
161
+ }
162
+
163
+
164
+ -BOOL CALLBACK
165
+ +INT_PTR CALLBACK
166
+ FinishedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
167
+ {
168
+ LPNMHDR lpnm;
169
+ @@ -2167,23 +2167,6 @@ BOOL NeedAutoUAC()
170
+ return TRUE;
171
+ }
172
+
173
+ -// Returns TRUE if the platform supports UAC.
174
+ -BOOL PlatformSupportsUAC()
175
+ -{
176
+ - // Note that win2k does seem to support ShellExecute with 'runas',
177
+ - // but does *not* support IsUserAnAdmin - so we just pretend things
178
+ - // only work on XP and later.
179
+ - BOOL bIsWindowsXPorLater;
180
+ - OSVERSIONINFO winverinfo;
181
+ - winverinfo.dwOSVersionInfoSize = sizeof(winverinfo);
182
+ - if (!GetVersionEx(&winverinfo))
183
+ - return FALSE; // something bad has gone wrong
184
+ - bIsWindowsXPorLater =
185
+ - ( (winverinfo.dwMajorVersion > 5) ||
186
+ - ( (winverinfo.dwMajorVersion == 5) && (winverinfo.dwMinorVersion >= 1) ));
187
+ - return bIsWindowsXPorLater;
188
+ -}
189
+ -
190
+ // Spawn ourself as an elevated application. On failure, a message is
191
+ // displayed to the user - but this app will always terminate, even
192
+ // on error.
193
+ @@ -2239,7 +2222,7 @@ int DoInstall(void)
194
+
195
+ // See if we need to do the Vista UAC magic.
196
+ if (strcmp(user_access_control, "force")==0) {
197
+ - if (PlatformSupportsUAC() && !MyIsUserAnAdmin()) {
198
+ + if (!MyIsUserAnAdmin()) {
199
+ SpawnUAC();
200
+ return 0;
201
+ }
202
+ @@ -2247,7 +2230,7 @@ int DoInstall(void)
203
+ } else if (strcmp(user_access_control, "auto")==0) {
204
+ // Check if it looks like we need UAC control, based
205
+ // on how Python itself was installed.
206
+ - if (PlatformSupportsUAC() && !MyIsUserAnAdmin() && NeedAutoUAC()) {
207
+ + if (!MyIsUserAnAdmin() && NeedAutoUAC()) {
208
+ SpawnUAC();
209
+ return 0;
210
+ }
211
+ diff --git a/PC/pyconfig.h b/PC/pyconfig.h
212
+ index 0cbd236..d896a38 100644
213
+ --- a/PC/pyconfig.h
214
+ +++ b/PC/pyconfig.h
215
+ @@ -226,6 +226,13 @@ typedef int pid_t;
216
+ #define Py_IS_FINITE(X) _finite(X)
217
+ #define copysign _copysign
218
+
219
+ +/* VS 2015 defines these names with a leading underscore */
220
+ +#if _MSC_VER >= 1900
221
+ +// #define timezone _timezone
222
+ +#define daylight _daylight
223
+ +#define tzname _tzname
224
+ +#endif
225
+ +
226
+ /* Side by Side assemblies supported in VS 2005 and VS 2008 but not 2010*/
227
+ #if _MSC_VER >= 1400 && _MSC_VER < 1600
228
+ #define HAVE_SXS 1
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/003-build-msvc.patch ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 00164b4a9821e82f513183035587bea9243a7d5e Mon Sep 17 00:00:00 2001
2
+ From: Jean-Christophe Fillion-Robin <[email protected]>
3
+ Date: Tue, 1 Aug 2017 14:13:24 -0400
4
+ Subject: [PATCH 3/3] VS2015 Support: Backport of "Issue #23524: Replace
5
+ _PyVerify_fd function with calling
6
+ _set_thread_local_invalid_parameter_handler on every thread."
7
+
8
+ This commit is a partial backport of python/cpython@d81431f. It was
9
+ originally designed to work with python-cmake-buildsystem.
10
+
11
+ Implementation of "_PyVerify_fd" in "Python/fileutils.c" found only in
12
+ Python 3.x has been copied into "Modules/posixmodule.c"
13
+
14
+ The following modules have NOT been backported:
15
+
16
+ * PCbuild
17
+ ---
18
+ Modules/posixmodule.c | 54 +++++++++++++++++++++++-------------------
19
+ PC/invalid_parameter_handler.c | 22 +++++++++++++++++
20
+ Python/pystate.c | 12 ++++++++++
21
+ PCbuild/pythoncore.vcxproj | 1 +
22
+ PCbuild/pythoncore.vcxproj.filters | 1 +
23
+ 5 files changed, 65 insertions(+), 26 deletions(-)
24
+ create mode 100644 PC/invalid_parameter_handler.c
25
+
26
+ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
27
+ index 90d5318..6a180a0 100644
28
+ --- a/Modules/posixmodule.c
29
+ +++ b/Modules/posixmodule.c
30
+ @@ -277,6 +277,7 @@ extern int lstat(const char *, struct stat *);
31
+ #include "osdefs.h"
32
+ #include <malloc.h>
33
+ #include <windows.h>
34
+ +#include <malloc.h>
35
+ #include <shellapi.h> /* for ShellExecute() */
36
+ #define popen _popen
37
+ #define pclose _pclose
38
+ @@ -535,8 +534,28 @@ _PyInt_FromDev(PY_LONG_LONG v)
39
+ # define _PyInt_FromDev PyInt_FromLong
40
+ #endif
41
+
42
+ +#ifdef _MSC_VER
43
+ +#if _MSC_VER >= 1900
44
+ +
45
+ +/* This function lets the Windows CRT validate the file handle without
46
+ + terminating the process if it's invalid. */
47
+ +int
48
+ +_PyVerify_fd(int fd)
49
+ +{
50
+ + intptr_t osh;
51
+ + /* Fast check for the only condition we know */
52
+ + if (fd < 0) {
53
+ + _set_errno(EBADF);
54
+ + return 0;
55
+ + }
56
+ + osh = _get_osfhandle(fd);
57
+ + return osh != (intptr_t)-1;
58
+ +}
59
+ +
60
+ +#define _PyVerify_fd_dup2(fd1, fd2) (_PyVerify_fd(fd1) && (fd2) >= 0)
61
+ +
62
+ +#elif _MSC_VER >= 1400
63
+
64
+ -#if defined _MSC_VER && _MSC_VER >= 1400
65
+ /* Microsoft CRT in VS2005 and higher will verify that a filehandle is
66
+ * valid and raise an assertion if it isn't.
67
+ * Normally, an invalid fd is likely to be a C program error and therefore
68
+ @@ -601,35 +580,18 @@ _PyInt_FromDev(PY_LONG_LONG v)
69
+ * Only the first items must be present.
70
+ */
71
+
72
+ -#if _MSC_VER >= 1900
73
+ -
74
+ -typedef struct {
75
+ - CRITICAL_SECTION lock;
76
+ - intptr_t osfhnd;
77
+ - __int64 startpos;
78
+ - char osfile;
79
+ -} my_ioinfo;
80
+ -
81
+ -#define IOINFO_L2E 6
82
+ -#define IOINFO_ARRAYS 128
83
+ -
84
+ -#else
85
+ -
86
+ typedef struct {
87
+ intptr_t osfhnd;
88
+ char osfile;
89
+ } my_ioinfo;
90
+
91
+ -#define IOINFO_L2E 5
92
+ -#define IOINFO_ARRAYS 64
93
+ -
94
+ -#endif
95
+ -
96
+ extern __declspec(dllimport) char * __pioinfo[];
97
+ #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
98
+ #define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)
99
+ #define FOPEN 0x01
100
+ #define _NO_CONSOLE_FILENO (intptr_t)-2
101
+ +#define IOINFO_L2E 5
102
+ +#define IOINFO_ARRAYS 64
103
+
104
+ /* This function emulates what the windows CRT does to validate file handles */
105
+ int
106
+ @@ -653,6 +649,8 @@ _PyVerify_fd_dup2(int fd1, int fd2)
107
+ #define _PyVerify_fd_dup2(A, B) (1)
108
+ #endif
109
+
110
+ +#endif /* defined _MSC_VER */
111
+ +
112
+ /* Return a dictionary corresponding to the POSIX environment table */
113
+ #if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED))
114
+ /* On Darwin/MacOSX a shared library or framework has no access to
115
+ @@ -1260,14 +1254,10 @@ win32_fstat(int file_number, struct win32_stat *result)
116
+
117
+ h = (HANDLE)_get_osfhandle(file_number);
118
+
119
+ - /* Protocol violation: we explicitly clear errno, instead of
120
+ - setting it to a POSIX error. Callers should use GetLastError. */
121
+ errno = 0;
122
+
123
+ if (h == INVALID_HANDLE_VALUE) {
124
+ - /* This is really a C library error (invalid file handle).
125
+ - We set the Win32 error to the closes one matching. */
126
+ - SetLastError(ERROR_INVALID_HANDLE);
127
+ + errno = EBADF;
128
+ return -1;
129
+ }
130
+ memset(result, 0, sizeof(*result));
131
+ @@ -1268,6 +1266,7 @@ win32_fstat(int file_number, struct win32_stat *result)
132
+ if (type == FILE_TYPE_UNKNOWN) {
133
+ DWORD error = GetLastError();
134
+ if (error != 0) {
135
+ + errno = EINVAL;
136
+ return -1;
137
+ }
138
+ /* else: valid but unknown file */
139
+ @@ -1284,6 +1281,7 @@ win32_fstat(int file_number, struct win32_stat *result)
140
+ }
141
+
142
+ if (!GetFileInformationByHandle(h, &info)) {
143
+ + errno = EINVAL;
144
+ return -1;
145
+ }
146
+
147
+ diff --git a/PC/invalid_parameter_handler.c b/PC/invalid_parameter_handler.c
148
+ new file mode 100644
149
+ index 0000000..3bc0104
150
+ --- /dev/null
151
+ +++ b/PC/invalid_parameter_handler.c
152
+ @@ -0,0 +1,22 @@
153
+ +#ifdef _MSC_VER
154
+ +
155
+ +#include <stdlib.h>
156
+ +
157
+ +#if _MSC_VER >= 1900
158
+ +/* pyconfig.h uses this function in the _Py_BEGIN/END_SUPPRESS_IPH
159
+ + * macros. It does not need to be defined when building using MSVC
160
+ + * earlier than 14.0 (_MSC_VER == 1900).
161
+ + */
162
+ +
163
+ +static void __cdecl _silent_invalid_parameter_handler(
164
+ + wchar_t const* expression,
165
+ + wchar_t const* function,
166
+ + wchar_t const* file,
167
+ + unsigned int line,
168
+ + uintptr_t pReserved) { }
169
+ +
170
+ +void *_Py_silent_invalid_parameter_handler =
171
+ + (void*)_silent_invalid_parameter_handler;
172
+ +#endif
173
+ +
174
+ +#endif
175
+ diff --git a/Python/pystate.c b/Python/pystate.c
176
+ index eb992c1..1c0f970 100644
177
+ --- a/Python/pystate.c
178
+ +++ b/Python/pystate.c
179
+ @@ -22,6 +22,12 @@ the expense of doing their own locking).
180
+ #endif
181
+ #endif
182
+
183
+ +#if defined _MSC_VER && _MSC_VER >= 1900
184
+ +/* Issue #23524: Temporary fix to disable termination due to invalid parameters */
185
+ +PyAPI_DATA(void*) _Py_silent_invalid_parameter_handler;
186
+ +#include <stdlib.h>
187
+ +#endif
188
+ +
189
+ #ifdef __cplusplus
190
+ extern "C" {
191
+ #endif
192
+ @@ -202,6 +208,12 @@ new_threadstate(PyInterpreterState *interp, int init)
193
+ tstate->next = interp->tstate_head;
194
+ interp->tstate_head = tstate;
195
+ HEAD_UNLOCK();
196
+ +
197
+ +#if defined _MSC_VER && _MSC_VER >= 1900
198
+ + /* Issue #23524: Temporary fix to disable termination due to invalid parameters */
199
+ + _set_thread_local_invalid_parameter_handler((_invalid_parameter_handler)_Py_silent_invalid_parameter_handler);
200
+ +#endif
201
+ +
202
+ }
203
+
204
+ return tstate;
205
+ --
206
+ 2.5.0
207
+
208
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
209
+ index 99291ea..af17762 100644
210
+ --- a/PCbuild/pythoncore.vcxproj
211
+ +++ b/PCbuild/pythoncore.vcxproj
212
+ @@ -333,6 +333,7 @@
213
+ <ClCompile Include="..\Parser\parser.c" />
214
+ <ClCompile Include="..\Parser\parsetok.c" />
215
+ <ClCompile Include="..\Parser\tokenizer.c" />
216
+ + <ClCompile Include="..\PC\invalid_parameter_handler.c" />
217
+ <ClCompile Include="..\PC\_subprocess.c" />
218
+ <ClCompile Include="..\PC\_winreg.c" />
219
+ <ClCompile Include="..\PC\config.c" />
220
+
221
+ diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
222
+ index 99291ea..af17762 100644
223
+ --- a/PCbuild/pythoncore.vcxproj.filters
224
+ +++ b/PCbuild/pythoncore.vcxproj.filters
225
+ @@ -794,6 +794,9 @@
226
+ <ClCompile Include="..\Parser\tokenizer.c">
227
+ <Filter>Parser</Filter>
228
+ </ClCompile>
229
+ + <ClCompile Include="..\PC\invalid_parameter_handler.c">
230
+ + <Filter>PC</Filter>
231
+ + </ClCompile>
232
+ <ClCompile Include="..\PC\_subprocess.c">
233
+ <Filter>PC</Filter>
234
+ </ClCompile>
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/004-static-library-msvc.patch ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
2
+ index 92b32da..8dac984 100644
3
+ --- a/PCbuild/pythoncore.vcxproj
4
+ +++ b/PCbuild/pythoncore.vcxproj
5
+ @@ -41,7 +41,7 @@
6
+ <Import Project="python.props" />
7
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
+ <PropertyGroup Label="Configuration">
9
+ - <ConfigurationType>DynamicLibrary</ConfigurationType>
10
+ + <ConfigurationType>StaticLibrary</ConfigurationType>
11
+ <UseOfMfc>false</UseOfMfc>
12
+ </PropertyGroup>
13
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
14
+ @@ -70,12 +70,24 @@
15
+ <ClCompile>
16
+ <AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
17
+ <AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
18
+ - <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;_CRT_SECURE_NO_WARNINGS;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
19
+ + <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_NO_ENABLE_SHARED;_CRT_SECURE_NO_WARNINGS;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
20
+ </ClCompile>
21
+ <Link>
22
+ <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
23
+ <BaseAddress>0x1e000000</BaseAddress>
24
+ </Link>
25
+ + <Lib>
26
+ + <TargetMachine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MachineX86</TargetMachine>
27
+ + </Lib>
28
+ + <Lib>
29
+ + <TargetMachine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">MachineX86</TargetMachine>
30
+ + </Lib>
31
+ + <Lib>
32
+ + <TargetMachine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">MachineX86</TargetMachine>
33
+ + </Lib>
34
+ + <Lib>
35
+ + <TargetMachine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MachineX86</TargetMachine>
36
+ + </Lib>
37
+ </ItemDefinitionGroup>
38
+ <ItemGroup>
39
+ <ClInclude Include="..\Include\abstract.h" />
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/005-static-crt-msvc.patch ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
2
+ index 8dac984..c18ad1e 100644
3
+ --- a/PCbuild/pythoncore.vcxproj
4
+ +++ b/PCbuild/pythoncore.vcxproj
5
+ @@ -71,6 +71,10 @@
6
+ <AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
7
+ <AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
8
+ <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_NO_ENABLE_SHARED;_CRT_SECURE_NO_WARNINGS;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
9
+ + <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>
10
+ + <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>
11
+ + <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>
12
+ + <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>
13
+ </ClCompile>
14
+ <Link>
15
+ <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/006-static-fix-headers.patch ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/PC/pyconfig.h b/PC/pyconfig.h
2
+ index 64e7aec..aa36745 100644
3
+ --- a/PC/pyconfig.h
4
+ +++ b/PC/pyconfig.h
5
+ @@ -331,6 +331,7 @@ typedef int pid_t;
6
+
7
+ /* For Windows the Python core is in a DLL by default. Test
8
+ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
9
+ +#define Py_NO_ENABLE_SHARED
10
+ #if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
11
+ # define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
12
+ # define MS_COREDLL /* deprecated old symbol */
13
+ --
14
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/007-fix-build-path.patch ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/PCbuild/python.props b/PCbuild/python.props
2
+ index d2b1991..a22c054 100644
3
+ --- a/PCbuild/python.props
4
+ +++ b/PCbuild/python.props
5
+ @@ -26,8 +26,7 @@
6
+ <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
7
+
8
+ <!-- Directory where build outputs are put -->
9
+ - <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCBuild\</BuildPath>
10
+ - <BuildPath Condition="'$(ArchName)' != 'win32'">$(BuildPath)\$(ArchName)\</BuildPath>
11
+ + <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath>
12
+ <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
13
+
14
+ <!-- Directories of external projects. tcltk is handled in tcltk.props -->
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/008-bz2d.patch ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/setup.py b/setup.py
2
+ index f764223..d6a58e4 100644
3
+ --- a/setup.py
4
+ +++ b/setup.py
5
+ @@ -1506,6 +1506,14 @@ class PyBuildExt(build_ext):
6
+ exts.append( Extension('bz2', ['bz2module.c'],
7
+ libraries = ['bz2'],
8
+ extra_link_args = bz2_extra_link_args) )
9
+ + elif (self.compiler.find_library_file(lib_dirs, 'bz2d')):
10
+ + if host_platform == "darwin":
11
+ + bz2_extra_link_args = ('-Wl,-search_paths_first',)
12
+ + else:
13
+ + bz2_extra_link_args = ()
14
+ + exts.append( Extension('bz2', ['bz2module.c'],
15
+ + libraries=['bz2d'],
16
+ + extra_link_args = bz2_extra_link_args) )
17
+ else:
18
+ missing.append('bz2')
19
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/portfile.cmake ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Patches are from:
2
+ # - https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/tree/master/patches/2.7.13/Windows-MSVC/1900
3
+ # - https://github.com/Microsoft/vcpkg/tree/master/ports/python3
4
+
5
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND VCPKG_CRT_LINKAGE STREQUAL static)
6
+ message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.")
7
+ set(VCPKG_LIBRARY_LINKAGE static)
8
+ endif()
9
+
10
+ set(PYTHON_VERSION_MAJOR 2)
11
+ set(PYTHON_VERSION_MINOR 7)
12
+ set(PYTHON_VERSION_PATCH 18)
13
+ set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH})
14
+
15
+ set(_PYTHON_PATCHES "")
16
+ if (VCPKG_TARGET_IS_WINDOWS)
17
+ list(APPEND _PYTHON_PATCHES
18
+ ${CMAKE_CURRENT_LIST_DIR}/001-build-msvc.patch
19
+ ${CMAKE_CURRENT_LIST_DIR}/002-build-msvc.patch
20
+ ${CMAKE_CURRENT_LIST_DIR}/003-build-msvc.patch
21
+ )
22
+ endif()
23
+
24
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
25
+ list(APPEND _PYTHON_PATCHES
26
+ ${CMAKE_CURRENT_LIST_DIR}/004-static-library-msvc.patch
27
+ ${CMAKE_CURRENT_LIST_DIR}/006-static-fix-headers.patch
28
+ )
29
+ endif()
30
+ if (VCPKG_CRT_LINKAGE STREQUAL static)
31
+ list(APPEND _PYTHON_PATCHES ${CMAKE_CURRENT_LIST_DIR}/005-static-crt-msvc.patch)
32
+ endif()
33
+
34
+ if (VCPKG_TARGET_IS_WINDOWS)
35
+ list(APPEND _PYTHON_PATCHES
36
+ ${CMAKE_CURRENT_LIST_DIR}/007-fix-build-path.patch
37
+ )
38
+ else()
39
+ list(APPEND _PYTHON_PATCHES
40
+ ${CMAKE_CURRENT_LIST_DIR}/008-bz2d.patch
41
+ )
42
+ endif()
43
+
44
+
45
+ vcpkg_download_distfile(ARCHIVE
46
+ URLS https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz
47
+ FILENAME Python-${PYTHON_VERSION}.tar.xz
48
+ SHA512 a7bb62b51f48ff0b6df0b18f5b0312a523e3110f49c3237936bfe56ed0e26838c0274ff5401bda6fc21bf24337477ccac49e8026c5d651e4b4cafb5eb5086f6c
49
+ )
50
+
51
+ vcpkg_extract_source_archive_ex(
52
+ OUT_SOURCE_PATH SOURCE_PATH
53
+ ARCHIVE ${ARCHIVE}
54
+ PATCHES ${_PYTHON_PATCHES}
55
+ )
56
+
57
+ vcpkg_replace_string("${SOURCE_PATH}/Makefile.pre.in" "$(INSTALL) -d -m $(DIRMODE)" "$(MKDIR_P)")
58
+
59
+ if (VCPKG_TARGET_IS_WINDOWS)
60
+ if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
61
+ set(BUILD_ARCH "Win32")
62
+ set(OUT_DIR "win32")
63
+ elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
64
+ set(BUILD_ARCH "x64")
65
+ set(OUT_DIR "amd64")
66
+ else()
67
+ message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
68
+ endif()
69
+
70
+ vcpkg_build_msbuild(
71
+ PROJECT_PATH ${SOURCE_PATH}/PCBuild/pythoncore.vcxproj
72
+ PLATFORM ${BUILD_ARCH}
73
+ )
74
+
75
+ vcpkg_copy_pdbs()
76
+
77
+ file(GLOB HEADERS ${SOURCE_PATH}/Include/*.h)
78
+ file(COPY ${HEADERS} ${SOURCE_PATH}/PC/pyconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
79
+
80
+ file(COPY ${SOURCE_PATH}/Lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
81
+
82
+ file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
83
+ file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
84
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
85
+ file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
86
+ file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
87
+ endif()
88
+ else()
89
+ vcpkg_configure_make(
90
+ SOURCE_PATH ${SOURCE_PATH}
91
+ )
92
+
93
+ vcpkg_install_make()
94
+ vcpkg_fixup_pkgconfig()
95
+
96
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
97
+ endif()
98
+
99
+ if (NOT VCPKG_TARGET_IS_WINDOWS)
100
+ foreach(lib_suffix IN ITEMS "" "/debug")
101
+ set(python_config_file "${CURRENT_PACKAGES_DIR}${lib_suffix}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata.py")
102
+ if(NOT EXISTS "${python_config_file}")
103
+ continue()
104
+ endif()
105
+
106
+ file(READ "${python_config_file}" contents)
107
+
108
+ string(PREPEND contents "import os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))\n")
109
+ # make contents a list of lines
110
+ string(REPLACE ";" "\\;" old_contents "${contents}")
111
+ string(REGEX REPLACE "\r?\n" ";" old_contents "${contents}")
112
+
113
+ set(new_contents "")
114
+ foreach(line IN LISTS old_contents)
115
+ if(line MATCHES "\"")
116
+ string(REGEX REPLACE
117
+ "${CURRENT_PACKAGES_DIR}|${CURRENT_INSTALLED_DIR}"
118
+ "\" + _base + \""
119
+ line
120
+ "${line}"
121
+ )
122
+ string(REGEX REPLACE
123
+ "\"[^\"]*${CURRENT_BUILDTREES_DIR}[^\"]*\""
124
+ "''"
125
+ line
126
+ "${line}"
127
+ )
128
+ else()
129
+ string(REGEX REPLACE
130
+ "${CURRENT_PACKAGES_DIR}|${CURRENT_INSTALLED_DIR}"
131
+ "' + _base + '"
132
+ line
133
+ "${line}"
134
+ )
135
+ string(REGEX REPLACE
136
+ "'[^']*${CURRENT_BUILDTREES_DIR}[^']*'"
137
+ "''"
138
+ line
139
+ "${line}"
140
+ )
141
+ endif()
142
+ list(APPEND new_contents "${line}")
143
+ endforeach()
144
+
145
+ list(JOIN new_contents "\n" contents)
146
+ file(WRITE "${python_config_file}" "${contents}")
147
+ endforeach()
148
+ endif()
149
+
150
+ # Handle copyright
151
+ file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
152
+ file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python2/vcpkg.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "python2",
3
+ "version": "2.7.18",
4
+ "port-version": 4,
5
+ "description": "The Python programming language as an embeddable library",
6
+ "homepage": "https://www.python.org",
7
+ "license": "Python-2.0"
8
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0001-static-library.patch ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 14d91e4f4a9377f47cc4cc33faeeb7c82f64b176 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Thu, 28 May 2020 17:25:21 -0400
4
+ Subject: [PATCH 1/7] static library
5
+
6
+ builds the pythoncore as a static library instead of a DLL
7
+ ---
8
+ PC/pyconfig.h | 9 +++++++++
9
+ PCbuild/pythoncore.vcxproj | 4 ++--
10
+ 2 files changed, 11 insertions(+), 2 deletions(-)
11
+
12
+ diff --git a/PC/pyconfig.h b/PC/pyconfig.h
13
+ index d7d3cf081e..34269f0b75 100644
14
+ --- a/PC/pyconfig.h
15
+ +++ b/PC/pyconfig.h
16
+ @@ -251,6 +251,7 @@ typedef int pid_t;
17
+
18
+ /* For Windows the Python core is in a DLL by default. Test
19
+ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
20
+ +#define Py_NO_ENABLE_SHARED
21
+ #if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
22
+ # define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
23
+ # define MS_COREDLL /* deprecated old symbol */
24
+ @@ -276,6 +277,14 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
25
+ # endif /* _DEBUG */
26
+ # endif /* _MSC_VER */
27
+ # endif /* Py_BUILD_CORE */
28
+ +#else
29
+ + /* So MSVC users need not specify the .lib file in their own config */
30
+ +# pragma comment(lib, "version.lib")
31
+ +# pragma comment(lib, "shlwapi.lib")
32
+ +# pragma comment(lib, "ws2_32.lib")
33
+ +# if Py_WINVER > 0x0601
34
+ +# pragma comment(lib, "pathcch.lib")
35
+ +# endif /* Py_WINVER */
36
+ #endif /* MS_COREDLL */
37
+
38
+ #if defined(MS_WIN64)
39
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
40
+ index 2625d0293d..2f8bdaa931 100644
41
+ --- a/PCbuild/pythoncore.vcxproj
42
+ +++ b/PCbuild/pythoncore.vcxproj
43
+ @@ -73,7 +73,7 @@
44
+ <Import Project="python.props" />
45
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
46
+ <PropertyGroup Label="Configuration">
47
+ - <ConfigurationType>DynamicLibrary</ConfigurationType>
48
+ + <ConfigurationType>StaticLibrary</ConfigurationType>
49
+ <UseOfMfc>false</UseOfMfc>
50
+ </PropertyGroup>
51
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
52
+ @@ -102,7 +102,7 @@
53
+ <AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
54
+ <AdditionalIncludeDirectories>$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
55
+ <AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
56
+ - <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
57
+ + <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
58
+ <PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
59
+ </ClCompile>
60
+ <Link>
61
+ diff --git a/Python/sysmodule.c b/Python/sysmodule.c
62
+ index ac49f7867a..f3583345ff 100644
63
+ --- a/Python/sysmodule.c
64
+ +++ b/Python/sysmodule.c
65
+ @@ -2804,6 +2804,9 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
66
+ #ifdef MS_COREDLL
67
+ SET_SYS("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule));
68
+ SET_SYS_FROM_STRING("winver", PyWin_DLLVersionString);
69
+ +#elif defined(MS_WINDOWS)
70
+ + SET_SYS("dllhandle", PyLong_FromVoidPtr(NULL));
71
+ + SET_SYS_FROM_STRING("winver", MS_DLL_ID);
72
+ #endif
73
+ #ifdef ABIFLAGS
74
+ SET_SYS_FROM_STRING("abiflags", ABIFLAGS);
75
+ --
76
+ 2.28.0.windows.1
77
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0002-use-vcpkg-zlib.patch ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 196555707236f4387875749f66620fb519166963 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Wed, 9 Sep 2020 15:20:36 -0400
4
+ Subject: [PATCH 2/6] use vcpkg zlib
5
+
6
+ building without zlib is not a supported configuration, per the warning
7
+ messages.
8
+ ---
9
+ PCbuild/pythoncore.vcxproj | 6 ++++--
10
+ 1 file changed, 4 insertions(+), 2 deletions(-)
11
+
12
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
13
+ index dbe236829a..5f30a35eb3 100644
14
+ --- a/PCbuild/pythoncore.vcxproj
15
+ +++ b/PCbuild/pythoncore.vcxproj
16
+ @@ -507,8 +507,10 @@
17
+ <ClCompile Include="..\Python\thread.c" />
18
+ <ClCompile Include="..\Python\traceback.c" />
19
+ </ItemGroup>
20
+ - <ItemGroup Condition="$(IncludeExternals)">
21
+ + <ItemGroup>
22
+ <ClCompile Include="..\Modules\zlibmodule.c" />
23
+ + </ItemGroup>
24
+ + <ItemGroup Condition="false">
25
+ <ClCompile Include="$(zlibDir)\adler32.c" />
26
+ <ClCompile Include="$(zlibDir)\compress.c" />
27
+ <ClCompile Include="$(zlibDir)\crc32.c" />
28
+ @@ -556,7 +558,7 @@
29
+ <Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140' and $(PlatformToolset) != 'v141' and $(PlatformToolset) != 'v142'">
30
+ <Warning Text="Toolset $(PlatformToolset) is not used for official builds. Your build may have errors or incompatibilities." />
31
+ </Target>
32
+ - <Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="!$(IncludeExternals)">
33
+ + <Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="false">
34
+ <Warning Text="Not including zlib is not a supported configuration." />
35
+ </Target>
36
+
37
+ --
38
+ 2.28.0.windows.1
39
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0003-devendor-external-dependencies.patch ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 6c5c3793cbc6ba2a1d0d623a2bdaa9c2125be516 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Wed, 9 Sep 2020 15:24:38 -0400
4
+ Subject: [PATCH 3/6] devendor external dependencies
5
+
6
+ externally fetched libraries may cause linker errors resulting from
7
+ duplicate symbols in downstream projects.
8
+ ---
9
+ PCbuild/_bz2.vcxproj | 4 +++-
10
+ PCbuild/_lzma.vcxproj | 5 ++---
11
+ PCbuild/_sqlite3.vcxproj | 2 +-
12
+ PCbuild/_ssl.vcxproj | 2 +-
13
+ PCbuild/pyexpat.vcxproj | 6 ++++--
14
+ 5 files changed, 11 insertions(+), 8 deletions(-)
15
+
16
+ diff --git a/PCbuild/_bz2.vcxproj b/PCbuild/_bz2.vcxproj
17
+ index 3fe95fbf83..6b12e8818e 100644
18
+ --- a/PCbuild/_bz2.vcxproj
19
+ +++ b/PCbuild/_bz2.vcxproj
20
+ @@ -101,6 +101,8 @@
21
+ </ItemDefinitionGroup>
22
+ <ItemGroup>
23
+ <ClCompile Include="..\Modules\_bz2module.c" />
24
+ + </ItemGroup>
25
+ + <ItemGroup Condition="false">
26
+ <ClCompile Include="$(bz2Dir)\blocksort.c" />
27
+ <ClCompile Include="$(bz2Dir)\bzlib.c" />
28
+ <ClCompile Include="$(bz2Dir)\compress.c" />
29
+ @@ -109,7 +111,7 @@
30
+ <ClCompile Include="$(bz2Dir)\huffman.c" />
31
+ <ClCompile Include="$(bz2Dir)\randtable.c" />
32
+ </ItemGroup>
33
+ - <ItemGroup>
34
+ + <ItemGroup Condition="false">
35
+ <ClInclude Include="$(bz2Dir)\bzlib.h" />
36
+ <ClInclude Include="$(bz2Dir)\bzlib_private.h" />
37
+ </ItemGroup>
38
+ diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj
39
+ index fe076a6fc5..70cc61dd95 100644
40
+ --- a/PCbuild/_lzma.vcxproj
41
+ +++ b/PCbuild/_lzma.vcxproj
42
+ @@ -94,10 +94,9 @@
43
+ <ItemDefinitionGroup>
44
+ <ClCompile>
45
+ <AdditionalIncludeDirectories>$(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
46
+ - <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
47
+ + <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
48
+ </ClCompile>
49
+ <Link>
50
+ - <AdditionalDependencies>$(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies)</AdditionalDependencies>
51
+ </Link>
52
+ </ItemDefinitionGroup>
53
+ <ItemGroup>
54
+ @@ -111,7 +110,7 @@
55
+ <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
56
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
57
+ </ProjectReference>
58
+ - <ProjectReference Include="liblzma.vcxproj">
59
+ + <ProjectReference Condition="false" Include="liblzma.vcxproj">
60
+ <Project>{12728250-16eC-4dc6-94d7-e21dd88947f8}</Project>
61
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
62
+ </ProjectReference>
63
+ diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj
64
+ index 7e0062692b..6fb3279a20 100644
65
+ --- a/PCbuild/_sqlite3.vcxproj
66
+ +++ b/PCbuild/_sqlite3.vcxproj
67
+ @@ -127,7 +127,7 @@
68
+ <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
69
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
70
+ </ProjectReference>
71
+ - <ProjectReference Include="sqlite3.vcxproj">
72
+ + <ProjectReference Condition="false" Include="sqlite3.vcxproj">
73
+ <Project>{a1a295e5-463c-437f-81ca-1f32367685da}</Project>
74
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
75
+ </ProjectReference>
76
+ diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj
77
+ index 4907f49b66..4dffa202b7 100644
78
+ --- a/PCbuild/_ssl.vcxproj
79
+ +++ b/PCbuild/_ssl.vcxproj
80
+ @@ -99,7 +99,7 @@
81
+ </ItemDefinitionGroup>
82
+ <ItemGroup>
83
+ <ClCompile Include="..\Modules\_ssl.c" />
84
+ - <ClCompile Include="$(opensslIncludeDir)\applink.c">
85
+ + <ClCompile Condition="false" Include="$(opensslIncludeDir)\applink.c">
86
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
87
+ </ClCompile>
88
+ </ItemGroup>
89
+ diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj
90
+ index b2d9f5d57d..4efb826a05 100644
91
+ --- a/PCbuild/pyexpat.vcxproj
92
+ +++ b/PCbuild/pyexpat.vcxproj
93
+ @@ -89,17 +89,19 @@
94
+ </ImportGroup>
95
+ <PropertyGroup Label="UserMacros" />
96
+ <ItemDefinitionGroup>
97
+ - <ClCompile>
98
+ + <ClCompile Condition="false">
99
+ <AdditionalIncludeDirectories>$(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
100
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
101
+ </ClCompile>
102
+ </ItemDefinitionGroup>
103
+ - <ItemGroup>
104
+ + <ItemGroup Condition="false">
105
+ <ClInclude Include="..\Modules\expat\xmlrole.h" />
106
+ <ClInclude Include="..\Modules\expat\xmltok.h" />
107
+ </ItemGroup>
108
+ <ItemGroup>
109
+ <ClCompile Include="..\Modules\pyexpat.c" />
110
+ + </ItemGroup>
111
+ + <ItemGroup Condition="false">
112
+ <ClCompile Include="..\Modules\expat\xmlparse.c" />
113
+ <ClCompile Include="..\Modules\expat\xmlrole.c" />
114
+ <ClCompile Include="..\Modules\expat\xmltok.c" />
115
+ --
116
+ 2.28.0.windows.1
117
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0004-dont-copy-vcruntime.patch ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 8086c67fa7ada1888a7808cbdc6fe74b62abe5b1 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Wed, 9 Sep 2020 16:12:49 -0400
4
+ Subject: [PATCH 4/6] dont copy vcruntime
5
+
6
+ VCRUNTIME140.dll should not be redistributed, ever.
7
+ ---
8
+ PCbuild/pythoncore.vcxproj | 2 +-
9
+ 1 file changed, 1 insertion(+), 1 deletion(-)
10
+
11
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
12
+ index 5f30a35eb3..3cf21ba39c 100644
13
+ --- a/PCbuild/pythoncore.vcxproj
14
+ +++ b/PCbuild/pythoncore.vcxproj
15
+ @@ -565,7 +565,7 @@
16
+ <Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">
17
+ <!-- bpo-38597: When we switch to another VCRuntime DLL, include vcruntime140.dll as well -->
18
+ <Warning Text="A copy of vcruntime140.dll is also required" Condition="!$(VCToolsRedistVersion.StartsWith(`14.`))" />
19
+ - <Copy SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
20
+ + <Copy Condition="false" SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
21
+ </Target>
22
+ <Target Name="_CleanVCRuntime" AfterTargets="Clean">
23
+ <Delete Files="@(VCRuntimeDLL->'$(OutDir)%(Filename)%(Extension)')" />
24
+ --
25
+ 2.28.0.windows.1
26
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0005-only-build-required-projects.patch ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 6492277e39dbe7dd77d32fdc9ae4b989213ef3c6 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Wed, 9 Sep 2020 20:15:58 -0400
4
+ Subject: [PATCH 5/6] only build required projects
5
+
6
+ strips out tests and unsupported externals (eg tkinter).
7
+ ---
8
+ PCbuild/_ssl.vcxproj | 2 +-
9
+ PCbuild/pcbuild.proj | 14 +++++++-------
10
+ 2 files changed, 8 insertions(+), 8 deletions(-)
11
+
12
+ diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj
13
+ index 4dffa202b7..e661cb6fb6 100644
14
+ --- a/PCbuild/_ssl.vcxproj
15
+ +++ b/PCbuild/_ssl.vcxproj
16
+ @@ -111,7 +111,7 @@
17
+ <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
18
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
19
+ </ProjectReference>
20
+ - <ProjectReference Include="_socket.vcxproj">
21
+ + <ProjectReference Condition="false" Include="_socket.vcxproj">
22
+ <Project>{86937f53-c189-40ef-8ce8-8759d8e7d480}</Project>
23
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
24
+ </ProjectReference>
25
+ diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
26
+ index 4d416c589e..ede9868a8f 100644
27
+ --- a/PCbuild/pcbuild.proj
28
+ +++ b/PCbuild/pcbuild.proj
29
+ @@ -45,21 +45,21 @@
30
+ <BuildInParallel>false</BuildInParallel>
31
+ </Projects>
32
+ <!-- python3.dll -->
33
+ - <Projects Include="python3dll.vcxproj" />
34
+ + <Projects Include="python3dll.vcxproj" Condition="false" />
35
+ <!-- py[w].exe -->
36
+ - <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" />
37
+ + <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" Condition="false" />
38
+ <!-- pyshellext.dll -->
39
+ - <Projects Include="pyshellext.vcxproj" />
40
+ + <Projects Include="pyshellext.vcxproj" Condition="false" />
41
+ <!-- Extension modules -->
42
+ <ExtensionModules Include="_asyncio;_zoneinfo;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;_queue;select;unicodedata;winsound;_uuid" />
43
+ <ExtensionModules Include="_ctypes" Condition="$(IncludeCTypes)" />
44
+ <!-- Extension modules that require external sources -->
45
+ <ExternalModules Include="_bz2;_lzma;_sqlite3" />
46
+ <!-- venv launchers -->
47
+ - <Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" />
48
+ - <!-- _ssl will build _socket as well, which may cause conflicts in parallel builds -->
49
+ - <ExtensionModules Include="_socket" Condition="!$(IncludeSSL) or !$(IncludeExternals)" />
50
+ - <ExternalModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
51
+ + <Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" Condition="false" />
52
+ + <!-- _ssl will NOT build _socket as well -->
53
+ + <ExtensionModules Include="_socket" Condition="true" />
54
+ + <ExternalModules Include="_ssl;_hashlib" Condition="true" />
55
+ <ExternalModules Include="_tkinter" Condition="$(IncludeTkinter) and $(Platform) != 'ARM' and $(Platform) != 'ARM64'" />
56
+ <ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
57
+ <Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
58
+ --
59
+ 2.28.0.windows.1
60
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0006-restore-support-for-windows-7.patch ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From e30a560527d17ae81685dd11d3268bc982af2048 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Tue, 16 Feb 2021 18:03:07 -0500
4
+ Subject: [PATCH 7/7] restore support for windows 7
5
+
6
+ this backports the windows 7 compatible fix for bpo-39401 from gh-18234,
7
+ originally authored by Steve Dower, and removes explicit dependencies on
8
+ pathcch.
9
+
10
+ The same mechanism is applied to fix posixmodule.c
11
+ ---
12
+ index 25ddc82..ff51042 100644
13
+ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
14
+ --- a/Modules/posixmodule.c
15
+ +++ b/Modules/posixmodule.c
16
+ @@ -20,7 +20,7 @@
17
+
18
+ FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
19
+ # include <windows.h>
20
+ -# include <pathcch.h>
21
+ +# include <Shlwapi.h>
22
+ #endif
23
+
24
+ #ifdef __VXWORKS__
25
+ @@ -4410,6 +4410,10 @@ os__getvolumepathname_impl(PyObject *module, path_t *path)
26
+ return result;
27
+ }
28
+
29
+ +static int _PathCchSkipRoot_Initialized = 0;
30
+ +typedef HRESULT (__stdcall *PPathCchSkipRoot) (PCWSTR pszPath, PCWSTR *ppszRootEnd);
31
+ +static PPathCchSkipRoot _PathCchSkipRoot;
32
+ +
33
+
34
+ /*[clinic input]
35
+ os._path_splitroot
36
+ @@ -4428,6 +4432,19 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
37
+ PyObject *result = NULL;
38
+ HRESULT ret;
39
+
40
+ + if (_PathCchSkipRoot_Initialized == 0) {
41
+ + HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
42
+ + LOAD_LIBRARY_SEARCH_SYSTEM32);
43
+ +
44
+ + if (pathapi) {
45
+ + _PathCchSkipRoot = (PPathCchSkipRoot)GetProcAddress(pathapi, "PathCchSkipRoot");
46
+ + } else {
47
+ + _PathCchSkipRoot = NULL;
48
+ + }
49
+ +
50
+ + _PathCchSkipRoot_Initialized = 1;
51
+ + }
52
+ +
53
+ buffer = (wchar_t*)PyMem_Malloc(sizeof(wchar_t) * (wcslen(path->wide) + 1));
54
+ if (!buffer) {
55
+ return NULL;
56
+ @@ -4438,7 +4455,14 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
57
+ }
58
+
59
+ Py_BEGIN_ALLOW_THREADS
60
+ - ret = PathCchSkipRoot(buffer, &end);
61
+ + if (_PathCchSkipRoot) {
62
+ + ret = _PathCchSkipRoot(buffer, &end);
63
+ + } else {
64
+ + end = PathSkipRootW(buffer);
65
+ + if (!end) {
66
+ + ret = E_FAIL;
67
+ + }
68
+ + }
69
+ Py_END_ALLOW_THREADS
70
+ if (FAILED(ret)) {
71
+ result = Py_BuildValue("sO", "", path->object);
72
+ diff --git a/PC/getpathp.c b/PC/getpathp.c
73
+ index 53da3a6..3d58bbf 100644
74
+ --- a/PC/getpathp.c
75
+ +++ b/PC/getpathp.c
76
+ @@ -90,7 +90,7 @@
77
+ #endif
78
+
79
+ #include <windows.h>
80
+ -#include <pathcch.h>
81
+ +#include <Shlwapi.h>
82
+
83
+ #ifdef HAVE_SYS_TYPES_H
84
+ #include <sys/types.h>
85
+ @@ -249,14 +249,43 @@ ismodule(wchar_t *filename, int update_filename)
86
+ stuff as fits will be appended.
87
+ */
88
+
89
+ +
90
+ +static int _PathCchCombineEx_Initialized = 0;
91
+ +typedef HRESULT(__stdcall *PPathCchCombineEx) (PWSTR pszPathOut, size_t cchPathOut,
92
+ + PCWSTR pszPathIn, PCWSTR pszMore,
93
+ + unsigned long dwFlags);
94
+ +static PPathCchCombineEx _PathCchCombineEx;
95
+ +
96
+ static void
97
+ join(wchar_t *buffer, const wchar_t *stuff)
98
+ {
99
+ - if (FAILED(PathCchCombineEx(buffer, MAXPATHLEN+1, buffer, stuff, 0))) {
100
+ - Py_FatalError("buffer overflow in getpathp.c's join()");
101
+ + if (_PathCchCombineEx_Initialized == 0) {
102
+ + HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
103
+ + LOAD_LIBRARY_SEARCH_SYSTEM32);
104
+ + if (pathapi) {
105
+ + _PathCchCombineEx = (PPathCchCombineEx)GetProcAddress(pathapi, "PathCchCombineEx");
106
+ + }
107
+ + else {
108
+ + _PathCchCombineEx = NULL;
109
+ + }
110
+ + _PathCchCombineEx_Initialized = 1;
111
+ + }
112
+ + if (_PathCchCombineEx) {
113
+ + if (FAILED(_PathCchCombineEx(buffer, MAXPATHLEN+1, buffer, stuff, 0))) {
114
+ + Py_FatalError("buffer overflow in getpathp.c's join()");
115
+ + }
116
+ + } else {
117
+ + if (!PathCombineW(buffer, buffer, stuff)) {
118
+ + Py_FatalError("buffer overflow in getpathp.c's join()");
119
+ + }
120
+ }
121
+ }
122
+
123
+ +static int _PathCchCanonicalizeEx_Initialized = 0;
124
+ +typedef HRESULT(__stdcall *PPathCchCanonicalizeEx) (PWSTR pszPathOut, size_t cchPathOut,
125
+ + PCWSTR pszPathIn, unsigned long dwFlags);
126
+ +static PPathCchCanonicalizeEx _PathCchCanonicalizeEx;
127
+ +
128
+ /* Call PathCchCanonicalizeEx(path): remove navigation elements such as "."
129
+ and ".." to produce a direct, well-formed path. */
130
+ static PyStatus
131
+ @@ -267,8 +296,26 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
132
+ return _PyStatus_NO_MEMORY();
133
+ }
134
+
135
+ - if (FAILED(PathCchCanonicalizeEx(buffer, MAXPATHLEN + 1, path, 0))) {
136
+ - return INIT_ERR_BUFFER_OVERFLOW();
137
+ + if (_PathCchCanonicalizeEx_Initialized == 0) {
138
+ + HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
139
+ + LOAD_LIBRARY_SEARCH_SYSTEM32);
140
+ + if (pathapi) {
141
+ + _PathCchCanonicalizeEx = (PPathCchCanonicalizeEx)GetProcAddress(pathapi, "PathCchCanonicalizeEx");
142
+ + }
143
+ + else {
144
+ + _PathCchCanonicalizeEx = NULL;
145
+ + }
146
+ + _PathCchCanonicalizeEx_Initialized = 1;
147
+ + }
148
+ + if (_PathCchCanonicalizeEx) {
149
+ + if (FAILED(_PathCchCanonicalizeEx(buffer, MAXPATHLEN + 1, path, 0))) {
150
+ + return INIT_ERR_BUFFER_OVERFLOW();
151
+ + }
152
+ + }
153
+ + else {
154
+ + if (!PathCanonicalizeW(buffer, path)) {
155
+ + return INIT_ERR_BUFFER_OVERFLOW();
156
+ + }
157
+ }
158
+ return _PyStatus_OK();
159
+ }
160
+ diff --git a/PC/pyconfig.h b/PC/pyconfig.h
161
+ index d7d3cf0..6e9c090 100644
162
+ --- a/PC/pyconfig.h
163
+ +++ b/PC/pyconfig.h
164
+ @@ -136,8 +136,8 @@ WIN32 is still required for the locale module.
165
+
166
+ /* set the version macros for the windows headers */
167
+ /* Python 3.9+ requires Windows 8 or greater */
168
+ -#define Py_WINVER 0x0602 /* _WIN32_WINNT_WIN8 */
169
+ -#define Py_NTDDI NTDDI_WIN8
170
+ +#define Py_WINVER 0x0601 /* _WIN32_WINNT_WIN7 */
171
+ +#define Py_NTDDI NTDDI_WIN7
172
+
173
+ /* We only set these values when building Python - we don't want to force
174
+ these values on extensions, as that will affect the prototypes and
175
+ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
176
+ index c39ba3e1a9..0ef3a05fb6 100644
177
+ --- a/PCbuild/pythoncore.vcxproj
178
+ +++ b/PCbuild/pythoncore.vcxproj
179
+ @@ -106,7 +106,7 @@
180
+ <PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
181
+ </ClCompile>
182
+ <Link>
183
+ - <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
184
+ + <AdditionalDependencies>version.lib;ws2_32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
185
+ </Link>
186
+ </ItemDefinitionGroup>
187
+ <ItemGroup>
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 0a72b7061ed79c5d6d37b41a5b1610e32fb371a4 Mon Sep 17 00:00:00 2001
2
+ From: Adam Johnson <[email protected]>
3
+ Date: Wed, 22 Sep 2021 21:04:21 -0400
4
+ Subject: [PATCH] workaround windows 11 sdk rc compiler error
5
+
6
+ winnt.h was changed to error if the `SYSTEM_CACHE_ALIGNMENT` cannot be
7
+ determined. when the RC compiler is invoked, this seems to fail where
8
+ previous SDKs silently set the ARM value.
9
+ ---
10
+ PC/python_ver_rc.h | 7 +++++++
11
+ 1 file changed, 7 insertions(+)
12
+
13
+ diff --git a/PC/python_ver_rc.h b/PC/python_ver_rc.h
14
+ index 90fc6ba1a1..e313a5138e 100644
15
+ --- a/PC/python_ver_rc.h
16
+ +++ b/PC/python_ver_rc.h
17
+ @@ -1,3 +1,10 @@
18
+ +// Temporarily workaround bug in Windows SDK 10.0.22000.0 winnt.h
19
+ +#ifdef RC_INVOKED
20
+ +# ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
21
+ +# define SYSTEM_CACHE_ALIGNMENT_SIZE 64
22
+ +# endif
23
+ +#endif
24
+ +
25
+ // Resource script for Python core DLL.
26
+ // Currently only holds version information.
27
+ //
28
+ --
29
+ 2.33.0.windows.1
30
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0009-python.pc.patch ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --- a/Misc/python.pc.in 2022-01-14 05:23:10.299912709 +0000
2
+ +++ b/Misc/python.pc.in 2022-01-14 05:23:15.908022446 +0000
3
+ @@ -10,4 +10,4 @@
4
+ Version: @VERSION@
5
+ Libs.private: @LIBS@
6
+ Libs:
7
+ -Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
8
+ +Cflags: -I${includedir}/python@VERSION@
9
+ --- a/Misc/python-embed.pc.in 2022-01-14 05:22:57.043653570 +0000
10
+ +++ b/Misc/python-embed.pc.in 2022-01-14 05:23:04.603801315 +0000
11
+ @@ -10,4 +10,4 @@
12
+ Version: @VERSION@
13
+ Libs.private: @LIBS@
14
+ Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
15
+ -Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
16
+ +Cflags: -I${includedir}/python@VERSION@
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/0010-bz2d.patch ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/setup.py b/setup.py
2
+ index 43e807f20..df4d43d3d 100644
3
+ --- a/setup.py
4
+ +++ b/setup.py
5
+ @@ -1741,6 +1741,14 @@ def detect_compress_exts(self):
6
+ self.add(Extension('_bz2', ['_bz2module.c'],
7
+ libraries=['bz2'],
8
+ extra_link_args=bz2_extra_link_args))
9
+ + elif (self.compiler.find_library_file(self.lib_dirs, 'bz2d')):
10
+ + if MACOS:
11
+ + bz2_extra_link_args = ('-Wl,-search_paths_first',)
12
+ + else:
13
+ + bz2_extra_link_args = ()
14
+ + self.add(Extension('_bz2', ['_bz2module.c'],
15
+ + libraries=['bz2d'],
16
+ + extra_link_args=bz2_extra_link_args))
17
+ else:
18
+ self.missing.append('_bz2')
19
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/openssl.props.in ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemDefinitionGroup>
4
+ <Link>
5
+ <AdditionalDependencies>Crypt32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
6
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Release|true'">
7
+ ${CRYPTO_RELEASE};${SSL_RELEASE};%(AdditionalDependencies)
8
+ </AdditionalDependencies>
9
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Debug|true'">
10
+ ${CRYPTO_DEBUG};${SSL_DEBUG};%(AdditionalDependencies)
11
+ </AdditionalDependencies>
12
+ </Link>
13
+ </ItemDefinitionGroup>
14
+ </Project>
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/portfile.cmake ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND VCPKG_CRT_LINKAGE STREQUAL static)
2
+ message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.")
3
+ set(VCPKG_LIBRARY_LINKAGE static)
4
+ endif()
5
+
6
+ set(PYTHON_VERSION_MAJOR 3)
7
+ set(PYTHON_VERSION_MINOR 10)
8
+ set(PYTHON_VERSION_PATCH 2)
9
+ set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH})
10
+
11
+ set(PATCHES
12
+ 0002-use-vcpkg-zlib.patch
13
+ 0003-devendor-external-dependencies.patch
14
+ 0004-dont-copy-vcruntime.patch
15
+ 0005-only-build-required-projects.patch
16
+ 0009-python.pc.patch
17
+ 0010-bz2d.patch
18
+ )
19
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
20
+ list(PREPEND PATCHES 0001-static-library.patch)
21
+ endif()
22
+
23
+ # Python 3.9 removed support for Windows 7. This patch re-adds support for Windows 7 and is therefore
24
+ # required to build this port on Windows 7 itself due to Python using itself in its own build system.
25
+ if("deprecated-win7-support" IN_LIST FEATURES)
26
+ list(APPEND PATCHES 0006-restore-support-for-windows-7.patch)
27
+ message(WARNING "Windows 7 support is deprecated and may be removed at any time.")
28
+ elseif(VCPKG_TARGET_IS_WINDOWS AND CMAKE_SYSTEM_VERSION EQUAL 6.1)
29
+ message(FATAL_ERROR "python3 requires the feature deprecated-win7-support when building on Windows 7.")
30
+ endif()
31
+
32
+ # The Windows 11 SDK has a problem that causes it to error on the resource files, so we patch that.
33
+ if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
34
+ vcpkg_get_windows_sdk(WINSDK_VERSION)
35
+ if("${WINSDK_VERSION}" VERSION_GREATER_EQUAL "10.0.22000")
36
+ list(APPEND PATCHES "0007-workaround-windows-11-sdk-rc-compiler-error.patch")
37
+ endif()
38
+ endif()
39
+
40
+ vcpkg_from_github(
41
+ OUT_SOURCE_PATH SOURCE_PATH
42
+ REPO python/cpython
43
+ REF v${PYTHON_VERSION}
44
+ SHA512 14f0d1847d4361fa075adbe4dbf7339fb62be91d5419cf506abdf46b36dc5273564792d35e5a5e0608a8fa877a870152a593743c3b70a98c739d5bd028be9e18
45
+ HEAD_REF master
46
+ PATCHES ${PATCHES}
47
+ )
48
+
49
+ vcpkg_replace_string("${SOURCE_PATH}/Makefile.pre.in" "$(INSTALL) -d -m $(DIRMODE)" "$(MKDIR_P)")
50
+
51
+ function(make_python_pkgconfig)
52
+ cmake_parse_arguments(PARSE_ARGV 0 arg "" "FILE;INSTALL_ROOT;EXEC_PREFIX;INCLUDEDIR;ABIFLAGS" "")
53
+
54
+ set(prefix "${CURRENT_PACKAGES_DIR}")
55
+ set(libdir [[${prefix}/lib]])
56
+ set(exec_prefix ${arg_EXEC_PREFIX})
57
+ set(includedir ${arg_INCLUDEDIR})
58
+ set(VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
59
+ set(ABIFLAGS ${arg_ABIFLAGS})
60
+
61
+ string(REPLACE "python" "python-${VERSION}" out_file ${arg_FILE})
62
+ set(out_full_path "${arg_INSTALL_ROOT}/lib/pkgconfig/${out_file}")
63
+ configure_file("${SOURCE_PATH}/Misc/${arg_FILE}.in" ${out_full_path} @ONLY)
64
+
65
+ file(READ ${out_full_path} pkgconfig_file)
66
+ string(REPLACE "-lpython${VERSION}" "-lpython${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}" pkgconfig_file "${pkgconfig_file}")
67
+ file(WRITE ${out_full_path} "${pkgconfig_file}")
68
+ endfunction()
69
+
70
+ if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
71
+ # Due to the way Python handles C extension modules on Windows, a static python core cannot
72
+ # load extension modules.
73
+ string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "dynamic" PYTHON_ALLOW_EXTENSIONS)
74
+ if(PYTHON_ALLOW_EXTENSIONS)
75
+ find_library(BZ2_RELEASE NAMES bz2 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
76
+ find_library(BZ2_DEBUG NAMES bz2d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
77
+ find_library(CRYPTO_RELEASE NAMES libcrypto PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
78
+ find_library(CRYPTO_DEBUG NAMES libcrypto PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
79
+ find_library(EXPAT_RELEASE NAMES libexpat libexpatMD PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
80
+ find_library(EXPAT_DEBUG NAMES libexpatd libexpatdMD PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
81
+ find_library(FFI_RELEASE NAMES libffi PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
82
+ find_library(FFI_DEBUG NAMES libffi PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
83
+ find_library(LZMA_RELEASE NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
84
+ find_library(LZMA_DEBUG NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
85
+ find_library(SQLITE_RELEASE NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
86
+ find_library(SQLITE_DEBUG NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
87
+ find_library(SSL_RELEASE NAMES libssl PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
88
+ find_library(SSL_DEBUG NAMES libssl PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
89
+ else()
90
+ message(STATUS "WARNING: Static builds of Python will not have C extension modules available.")
91
+ endif()
92
+ find_library(ZLIB_RELEASE NAMES zlib PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
93
+ find_library(ZLIB_DEBUG NAMES zlib zlibd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
94
+
95
+ configure_file("${SOURCE_PATH}/PC/pyconfig.h" "${SOURCE_PATH}/PC/pyconfig.h")
96
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/python_vcpkg.props.in" "${SOURCE_PATH}/PCbuild/python_vcpkg.props")
97
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.props.in" "${SOURCE_PATH}/PCbuild/openssl.props")
98
+ file(WRITE "${SOURCE_PATH}/PCbuild/libffi.props"
99
+ "<?xml version='1.0' encoding='utf-8'?>
100
+ <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' />"
101
+ )
102
+
103
+ if(PYTHON_ALLOW_EXTENSIONS)
104
+ set(OPTIONS
105
+ "/p:IncludeExtensions=true"
106
+ "/p:IncludeExternals=true"
107
+ "/p:IncludeCTypes=true"
108
+ "/p:IncludeSSL=true"
109
+ "/p:IncludeTkinter=false"
110
+ "/p:IncludeTests=false"
111
+ "/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/PCbuild/python_vcpkg.props"
112
+ )
113
+ else()
114
+ set(OPTIONS
115
+ "/p:IncludeExtensions=false"
116
+ "/p:IncludeExternals=false"
117
+ "/p:IncludeTests=false"
118
+ "/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/PCbuild/python_vcpkg.props"
119
+ )
120
+ endif()
121
+ if(VCPKG_TARGET_IS_UWP)
122
+ list(APPEND OPTIONS "/p:IncludeUwp=true")
123
+ else()
124
+ list(APPEND OPTIONS "/p:IncludeUwp=false")
125
+ endif()
126
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
127
+ list(APPEND OPTIONS "/p:_VcpkgPythonLinkage=DynamicLibrary")
128
+ else()
129
+ list(APPEND OPTIONS "/p:_VcpkgPythonLinkage=StaticLibrary")
130
+ endif()
131
+
132
+ # _freeze_importlib.exe is run as part of the build process, so make sure the required dynamic libs are available.
133
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
134
+ vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/bin")
135
+ endif()
136
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
137
+ vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/debug/bin")
138
+ endif()
139
+
140
+ vcpkg_install_msbuild(
141
+ SOURCE_PATH "${SOURCE_PATH}"
142
+ PROJECT_SUBPATH "PCbuild/pcbuild.proj"
143
+ OPTIONS ${OPTIONS}
144
+ LICENSE_SUBPATH "LICENSE"
145
+ TARGET_PLATFORM_VERSION "${WINSDK_VERSION}"
146
+ SKIP_CLEAN
147
+ )
148
+
149
+ # The extension modules must be placed in the DLLs directory, so we can't use vcpkg_copy_tools()
150
+ if(PYTHON_ALLOW_EXTENSIONS)
151
+ file(GLOB_RECURSE PYTHON_EXTENSIONS "${CURRENT_BUILDTREES_DIR}/*.pyd")
152
+ list(FILTER PYTHON_EXTENSIONS EXCLUDE REGEX [[.*_d\.pyd]])
153
+ file(COPY ${PYTHON_EXTENSIONS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs")
154
+ vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs")
155
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll")
156
+ endif()
157
+
158
+ file(COPY "${SOURCE_PATH}/Include/" "${SOURCE_PATH}/PC/pyconfig.h"
159
+ DESTINATION "${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
160
+ FILES_MATCHING PATTERN *.h
161
+ )
162
+ file(COPY "${SOURCE_PATH}/Lib" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
163
+
164
+ # Remove any extension libraries and other unversioned binaries that could conflict with the python2 port.
165
+ # You don't need to link against these anyway.
166
+ file(GLOB PYTHON_LIBS
167
+ "${CURRENT_PACKAGES_DIR}/lib/*.lib"
168
+ "${CURRENT_PACKAGES_DIR}/debug/lib/*.lib"
169
+ )
170
+ list(FILTER PYTHON_LIBS EXCLUDE REGEX [[python[0-9]*(_d)?\.lib$]])
171
+ file(GLOB PYTHON_INSTALLERS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wininst-*.exe")
172
+ file(REMOVE ${PYTHON_LIBS} ${PYTHON_INSTALLERS})
173
+
174
+ # The generated python executable must match the host arch
175
+ if(PYTHON_ALLOW_EXTENSIONS AND NOT VCPKG_CROSSCOMPILING)
176
+ message(STATUS "Bootstrapping pip")
177
+ vcpkg_execute_required_process(COMMAND python -m ensurepip
178
+ WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}"
179
+ LOGNAME "ensurepip-${TARGET_TRIPLET}"
180
+ )
181
+ endif()
182
+
183
+ # pkg-config files
184
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
185
+ make_python_pkgconfig(FILE python.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
186
+ EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
187
+ make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
188
+ EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
189
+ endif()
190
+
191
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
192
+ make_python_pkgconfig(FILE python.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
193
+ EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
194
+ make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
195
+ EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
196
+ endif()
197
+
198
+ vcpkg_fixup_pkgconfig()
199
+
200
+ vcpkg_clean_msbuild()
201
+
202
+ # Remove static library belonging to executable
203
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
204
+ if (EXISTS "${CURRENT_PACKAGES_DIR}/lib/python.lib")
205
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
206
+ file(RENAME "${CURRENT_PACKAGES_DIR}/lib/python.lib"
207
+ "${CURRENT_PACKAGES_DIR}/lib/manual-link/python.lib")
208
+ endif()
209
+ if (EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/python_d.lib")
210
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
211
+ file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/python_d.lib"
212
+ "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/python_d.lib")
213
+ endif()
214
+ endif()
215
+ else()
216
+ set(OPTIONS
217
+ "--with-openssl=${CURRENT_INSTALLED_DIR}"
218
+ "--with-ensurepip"
219
+ "--with-suffix="
220
+ "--with-system-expat"
221
+ "--without-readline"
222
+ "--disable-test-modules"
223
+ )
224
+ if(VCPKG_TARGET_IS_OSX)
225
+ list(APPEND OPTIONS "LIBS=-liconv -lintl")
226
+ endif()
227
+
228
+ vcpkg_configure_make(
229
+ SOURCE_PATH "${SOURCE_PATH}"
230
+ OPTIONS ${OPTIONS}
231
+ OPTIONS_DEBUG "--with-pydebug"
232
+ )
233
+ vcpkg_install_make(ADD_BIN_TO_PATH INSTALL_TARGET altinstall)
234
+
235
+ file(COPY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
236
+
237
+ # Makefiles, c files, __pycache__, and other junk.
238
+ file(GLOB PYTHON_LIB_DIRS LIST_DIRECTORIES true
239
+ "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*"
240
+ "${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*")
241
+ list(FILTER PYTHON_LIB_DIRS INCLUDE REGEX [[config-[0-9].*.*]])
242
+ file(REMOVE_RECURSE ${PYTHON_LIB_DIRS})
243
+
244
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
245
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
246
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
247
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
248
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}d")
249
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man1")
250
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
251
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
252
+
253
+ file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright")
254
+
255
+ vcpkg_fixup_pkgconfig()
256
+ endif()
257
+
258
+ file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
259
+
260
+ function(_generate_finder)
261
+ cmake_parse_arguments(PythonFinder "NO_OVERRIDE" "DIRECTORY;PREFIX" "" ${ARGN})
262
+ configure_file(
263
+ "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
264
+ "${CURRENT_PACKAGES_DIR}/share/${PythonFinder_DIRECTORY}/vcpkg-cmake-wrapper.cmake"
265
+ @ONLY
266
+ )
267
+ endfunction()
268
+
269
+ message(STATUS "Installing cmake wrappers")
270
+ _generate_finder(DIRECTORY "python" PREFIX "Python")
271
+ _generate_finder(DIRECTORY "python3" PREFIX "Python3")
272
+ _generate_finder(DIRECTORY "pythoninterp" PREFIX "PYTHON" NO_OVERRIDE)
273
+
274
+ if (NOT VCPKG_TARGET_IS_WINDOWS)
275
+ function(replace_dirs_in_config_file python_config_file)
276
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_INSTALLED_DIR}" "' + _base + '")
277
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_PACKAGES_DIR}" "' + _base + '")
278
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_BUILDTREES_DIR}" "not/existing")
279
+ endfunction()
280
+
281
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
282
+ file(GLOB python_config_files "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata*")
283
+ list(POP_FRONT python_config_files python_config_file)
284
+ vcpkg_replace_string("${python_config_file}" "# system configuration generated and used by the sysconfig module" "# system configuration generated and used by the sysconfig module\nimport os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))\n")
285
+ replace_dirs_in_config_file("${python_config_file}")
286
+ endif()
287
+
288
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
289
+ file(GLOB python_config_files "${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata*")
290
+ list(POP_FRONT python_config_files python_config_file)
291
+ vcpkg_replace_string("${python_config_file}" "# system configuration generated and used by the sysconfig module" "# system configuration generated and used by the sysconfig module\nimport os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))\n")
292
+ replace_dirs_in_config_file("${python_config_file}")
293
+ endif()
294
+ endif()
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/python_vcpkg.props.in ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemDefinitionGroup>
4
+ <CLCompile>
5
+ <!-- Use vcpkg ports instead of vendored externals -->
6
+ <PreprocessorDefinitions>_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
7
+ <PreprocessorDefinitions Condition="${VCPKG_LIBRARY_LINKAGE} == 'static'">XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8
+ <AdditionalIncludeDirectories>
9
+ %(AdditionalIncludeDirectories);${CURRENT_INSTALLED_DIR}/include
10
+ </AdditionalIncludeDirectories>
11
+
12
+ <RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|Debug'">MultiThreadedDebug</RuntimeLibrary>
13
+ <RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|Release'">MultiThreaded</RuntimeLibrary>
14
+ <RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|Debug'">MultiThreadedDebugDLL</RuntimeLibrary>
15
+ <RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|Release'">MultiThreadedDLL</RuntimeLibrary>
16
+ </CLCompile>
17
+ <Link>
18
+ <!-- Required Libs -->
19
+ <AdditionalDependencies Condition="'$(Configuration)'=='Release'">
20
+ ${ZLIB_RELEASE};%(AdditionalDependencies)
21
+ </AdditionalDependencies>
22
+ <AdditionalDependencies Condition="'$(Configuration)'=='Debug'">
23
+ ${ZLIB_DEBUG};%(AdditionalDependencies)
24
+ </AdditionalDependencies>
25
+
26
+ <!-- Extension modules -->
27
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Release|true'">
28
+ ${BZ2_RELEASE};${EXPAT_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE_RELEASE};%(AdditionalDependencies)
29
+ </AdditionalDependencies>
30
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Debug|true'">
31
+ ${BZ2_DEBUG};${EXPAT_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE_DEBUG};%(AdditionalDependencies)
32
+ </AdditionalDependencies>
33
+ </Link>
34
+
35
+ <Lib>
36
+ <!-- Required to prevent linker errors on Visual Studio 2017 with static CRT -->
37
+ <TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x86'">MachineX86</TargetMachine>
38
+ <TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x64'">MachineX64</TargetMachine>
39
+ </Lib>
40
+ </ItemDefinitionGroup>
41
+ </Project>
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/usage ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ The package python3 is compatible with built-in CMake targets:
2
+
3
+ find_package(Python3 COMPONENTS Development REQUIRED)
4
+ target_link_libraries(main PRIVATE Python3::Python)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # For very old ports whose upstream do not properly set the minimum CMake version.
2
+ cmake_policy(SET CMP0012 NEW)
3
+ cmake_policy(SET CMP0057 NEW)
4
+
5
+ # This prevents the port's python.exe from overriding the Python fetched by
6
+ # vcpkg_find_acquire_program(PYTHON3) and prevents the vcpkg toolchain from
7
+ # stomping on FindPython's default functionality.
8
+ list(REMOVE_ITEM CMAKE_PROGRAM_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3")
9
+ if(@PythonFinder_NO_OVERRIDE@)
10
+ _find_package(${ARGS})
11
+ return()
12
+ endif()
13
+
14
+ # CMake's FindPython's separation of concerns is very muddy. We only want to force vcpkg's Python
15
+ # if the consumer is using the development component. What we don't want to do is break detection
16
+ # of the system Python, which may have certain packages the user expects. But - if the user is
17
+ # embedding Python or using both the development and interpreter components, then we need the
18
+ # interpreter matching vcpkg's Python libraries. Note that the "Development" component implies
19
+ # both "Development.Module" and "Development.Embed"
20
+ if("Development" IN_LIST ARGS OR "Development.Embed" IN_LIST ARGS)
21
+ set(_PythonFinder_WantInterp TRUE)
22
+ set(_PythonFinder_WantLibs TRUE)
23
+ elseif("Development.Module" IN_LIST ARGS)
24
+ if("Interpreter" IN_LIST ARGS)
25
+ set(_PythonFinder_WantInterp TRUE)
26
+ endif()
27
+ set(_PythonFinder_WantLibs TRUE)
28
+ endif()
29
+
30
+ if(_PythonFinder_WantLibs)
31
+ find_path(
32
+ @PythonFinder_PREFIX@_INCLUDE_DIR
33
+ NAMES "Python.h"
34
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include"
35
+ PATH_SUFFIXES "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
36
+ NO_DEFAULT_PATH
37
+ )
38
+
39
+ # Don't set the public facing hint or the finder will be unable to detect the debug library.
40
+ # Internally, it uses the same value with an underscore prepended.
41
+ find_library(
42
+ _@PythonFinder_PREFIX@_LIBRARY_RELEASE
43
+ NAMES
44
+ "python@PYTHON_VERSION_MAJOR@@PYTHON_VERSION_MINOR@"
45
+ "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
46
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib"
47
+ NO_DEFAULT_PATH
48
+ )
49
+ find_library(
50
+ _@PythonFinder_PREFIX@_LIBRARY_DEBUG
51
+ NAMES
52
+ "python@PYTHON_VERSION_MAJOR@@PYTHON_VERSION_MINOR@_d"
53
+ "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@d"
54
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib"
55
+ NO_DEFAULT_PATH
56
+ )
57
+
58
+ if(_PythonFinder_WantInterp)
59
+ find_program(
60
+ @PythonFinder_PREFIX@_EXECUTABLE
61
+ NAMES "python" "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
62
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3"
63
+ NO_DEFAULT_PATH
64
+ )
65
+ endif()
66
+
67
+ _find_package(${ARGS})
68
+
69
+ if(@VCPKG_LIBRARY_LINKAGE@ STREQUAL static)
70
+ include(CMakeFindDependencyMacro)
71
+
72
+ # Python for Windows embeds the zlib module into the core, so we have to link against it.
73
+ # This is a separate extension module on Unix-like platforms.
74
+ if(WIN32)
75
+ find_dependency(ZLIB)
76
+ if(TARGET @PythonFinder_PREFIX@::Python)
77
+ set_property(TARGET @PythonFinder_PREFIX@::Python APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
78
+ endif()
79
+ if(TARGET @PythonFinder_PREFIX@::Module)
80
+ set_property(TARGET @PythonFinder_PREFIX@::Module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
81
+ endif()
82
+ if(DEFINED @PythonFinder_PREFIX@_LIBRARIES)
83
+ list(APPEND @PythonFinder_PREFIX@_LIBRARIES ${ZLIB_LIBRARIES})
84
+ endif()
85
+ endif()
86
+
87
+ if(APPLE)
88
+ find_dependency(Iconv)
89
+ find_dependency(Intl)
90
+ if(TARGET @PythonFinder_PREFIX@::Python)
91
+ get_target_property(_PYTHON_INTERFACE_LIBS @PythonFinder_PREFIX@::Python INTERFACE_LINK_LIBRARIES)
92
+ list(REMOVE_ITEM _PYTHON_INTERFACE_LIBS "-liconv" "-lintl")
93
+ list(APPEND _PYTHON_INTERFACE_LIBS
94
+ Iconv::Iconv
95
+ "$<IF:$<CONFIG:Debug>,${Intl_LIBRARY_DEBUG},${Intl_LIBRARY_RELEASE}>"
96
+ )
97
+ set_property(TARGET @PythonFinder_PREFIX@::Python PROPERTY INTERFACE_LINK_LIBRARIES ${_PYTHON_INTERFACE_LIBS})
98
+ unset(_PYTHON_INTERFACE_LIBS)
99
+ endif()
100
+ if(TARGET @PythonFinder_PREFIX@::Module)
101
+ get_target_property(_PYTHON_INTERFACE_LIBS @PythonFinder_PREFIX@::Module INTERFACE_LINK_LIBRARIES)
102
+ list(REMOVE_ITEM _PYTHON_INTERFACE_LIBS "-liconv" "-lintl")
103
+ list(APPEND _PYTHON_INTERFACE_LIBS
104
+ Iconv::Iconv
105
+ "$<IF:$<CONFIG:Debug>,${Intl_LIBRARY_DEBUG},${Intl_LIBRARY_RELEASE}>"
106
+ )
107
+ set_property(TARGET @PythonFinder_PREFIX@::Module PROPERTY INTERFACE_LINK_LIBRARIES ${_PYTHON_INTERFACE_LIBS})
108
+ unset(_PYTHON_INTERFACE_LIBS)
109
+ endif()
110
+ if(DEFINED @PythonFinder_PREFIX@_LIBRARIES)
111
+ list(APPEND @PythonFinder_PREFIX@_LIBRARIES "-framework CoreFoundation" ${Iconv_LIBRARIES} ${Intl_LIBRARIES})
112
+ endif()
113
+ endif()
114
+ endif()
115
+ else()
116
+ _find_package(${ARGS})
117
+ endif()
118
+
119
+ unset(_PythonFinder_WantInterp)
120
+ unset(_PythonFinder_WantLibs)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/python3/vcpkg.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "python3",
3
+ "version": "3.10.2",
4
+ "port-version": 1,
5
+ "description": "The Python programming language",
6
+ "homepage": "https://github.com/python/cpython",
7
+ "license": "Python-2.0",
8
+ "supports": "!uwp",
9
+ "dependencies": [
10
+ {
11
+ "name": "bzip2",
12
+ "platform": "!(windows & static)"
13
+ },
14
+ "expat",
15
+ {
16
+ "name": "gettext",
17
+ "platform": "osx"
18
+ },
19
+ {
20
+ "name": "libffi",
21
+ "platform": "!(windows & static)"
22
+ },
23
+ {
24
+ "name": "libiconv",
25
+ "platform": "osx"
26
+ },
27
+ {
28
+ "name": "liblzma",
29
+ "platform": "!(windows & static)"
30
+ },
31
+ {
32
+ "name": "openssl",
33
+ "platform": "!(windows & static)"
34
+ },
35
+ {
36
+ "name": "python3",
37
+ "host": true
38
+ },
39
+ {
40
+ "name": "sqlite3",
41
+ "platform": "!(windows & static)"
42
+ },
43
+ "zlib"
44
+ ],
45
+ "features": {
46
+ "deprecated-win7-support": {
47
+ "description": "Deprecated support for the Windows 7 platform -- may be removed at any time."
48
+ }
49
+ }
50
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git "a/CMakeLists.txt" "b/CMakeLists.txt"
2
+ index 1f84c2c9e..f72ee9d8d 100644
3
+ --- "a/CMakeLists.txt"
4
+ +++ "b/CMakeLists.txt"
5
+ @@ -58,6 +58,7 @@ set(QCA_SUFFIX "qt5")
6
+ if(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC)
7
+ set(STATIC_PLUGINS ON)
8
+ add_definitions(-DQT_STATICPLUGIN)
9
+ + add_definitions(-DQCA_STATIC)
10
+ set(PLUGIN_TYPE "STATIC")
11
+ else()
12
+ set(PLUGIN_TYPE "MODULE")
13
+ @@ -266,10 +267,17 @@ if(DEVELOPER_MODE)
14
+ add_definitions(-DDEVELOPER_MODE)
15
+
16
+ # To prefer plugins from build tree when run qca from build tree
17
+ - file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf
18
+ -"[Paths]
19
+ -Plugins=${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME}
20
+ -")
21
+ + if(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC)
22
+ + file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf
23
+ + "[Paths]
24
+ + Plugins=${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME}
25
+ + ")
26
+ + else()
27
+ + file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf
28
+ + "[Paths]
29
+ + Plugins=${CMAKE_BINARY_DIR}/bin/${QCA_LIB_NAME}
30
+ + ")
31
+ + endif()
32
+ endif()
33
+
34
+ if (APPLE)
35
+ @@ -309,7 +317,7 @@ else()
36
+ set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem")
37
+ # note that INSTALL_FILES targets are relative to the current installation prefix...
38
+ if(NOT DEVELOPER_MODE)
39
+ - install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/certs")
40
+ + install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/share/qca/certs")
41
+ endif()
42
+ endif()
43
+ message(STATUS "certstore path: " ${qca_CERTSTORE})
44
+ @@ -390,10 +398,10 @@ endif()
45
+ include(CMakePackageConfigHelpers)
46
+ configure_package_config_file(
47
+ "${CMAKE_CURRENT_SOURCE_DIR}/QcaConfig.cmake.in"
48
+ - "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}Config.cmake"
49
+ - INSTALL_DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE}
50
+ + "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}Config.cmake"
51
+ + INSTALL_DESTINATION ${CMAKE_BINARY_DIR}/share/qca/cmake
52
+ )
53
+ -write_basic_config_version_file("${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" VERSION ${QCA_LIB_VERSION_STRING} COMPATIBILITY AnyNewerVersion)
54
+ +write_basic_config_version_file("${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" VERSION ${QCA_LIB_VERSION_STRING} COMPATIBILITY AnyNewerVersion)
55
+
56
+ if(NOT DEVELOPER_MODE)
57
+
58
+ @@ -461,10 +469,10 @@ if(NOT DEVELOPER_MODE)
59
+ endif()
60
+ endif()
61
+
62
+ - install(EXPORT ${QCA_CONFIG_NAME_BASE}Targets DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE} FILE ${QCA_CONFIG_NAME_BASE}Targets.cmake)
63
+ + install(EXPORT ${QCA_CONFIG_NAME_BASE}Targets DESTINATION ${QCA_PREFIX_INSTALL_DIR}/share/qca/cmake FILE ${QCA_CONFIG_NAME_BASE}Targets.cmake)
64
+ install(FILES
65
+ - "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}Config.cmake"
66
+ - "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake"
67
+ - DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE}
68
+ + "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}Config.cmake"
69
+ + "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake"
70
+ + DESTINATION ${QCA_PREFIX_INSTALL_DIR}/share/qca/cmake
71
+ )
72
+ endif()
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/0002-fix-build-error.patch ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 8d67288a3dde7e535ff747715f96f98282a3bf67 Mon Sep 17 00:00:00 2001
2
+ From: Matthias Kuhn <[email protected]>
3
+ Date: Fri, 3 Dec 2021 15:17:25 +0100
4
+ Subject: [PATCH] Ifdef codecs
5
+
6
+ ---
7
+ cmake/modules/QcaMacro.cmake | 9 ---------
8
+ plugins/qca-ossl/qca-ossl.cpp | 6 ++++++
9
+ 2 files changed, 6 insertions(+), 9 deletions(-)
10
+
11
+ diff --git a/cmake/modules/QcaMacro.cmake b/cmake/modules/QcaMacro.cmake
12
+ index 80af6e84..ba86310d 100644
13
+ --- a/cmake/modules/QcaMacro.cmake
14
+ +++ b/cmake/modules/QcaMacro.cmake
15
+ @@ -69,15 +69,6 @@ macro(add_qca_test TARGET DESCRIPTION)
16
+ endmacro(add_qca_test)
17
+
18
+ macro(install_pdb TARGET INSTALL_PATH)
19
+ - if(MSVC)
20
+ - get_target_property(LOCATION ${TARGET} LOCATION_DEBUG)
21
+ - string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}")
22
+ - install(FILES ${LOCATION} DESTINATION ${INSTALL_PATH} CONFIGURATIONS Debug)
23
+ -
24
+ - get_target_property(LOCATION ${TARGET} LOCATION_RELWITHDEBINFO)
25
+ - string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}")
26
+ - install(FILES ${LOCATION} DESTINATION ${INSTALL_PATH} CONFIGURATIONS RelWithDebInfo)
27
+ - endif()
28
+ endmacro(install_pdb)
29
+
30
+ macro(normalize_path PATH)
31
+ diff --git a/plugins/qca-ossl/qca-ossl.cpp b/plugins/qca-ossl/qca-ossl.cpp
32
+ index b2c5d3d3..4250ec26 100644
33
+ --- a/plugins/qca-ossl/qca-ossl.cpp
34
+ +++ b/plugins/qca-ossl/qca-ossl.cpp
35
+ @@ -6846,6 +6846,7 @@ public:
36
+ else if (type == QLatin1String("aes256-ccm"))
37
+ return new opensslCipherContext(EVP_aes_256_ccm(), 0, this, type);
38
+ #endif
39
+ +#ifndef OPENSSL_NO_BF
40
+ else if (type == QLatin1String("blowfish-ecb"))
41
+ return new opensslCipherContext(EVP_bf_ecb(), 0, this, type);
42
+ else if (type == QLatin1String("blowfish-cfb"))
43
+ @@ -6856,6 +6857,8 @@ public:
44
+ return new opensslCipherContext(EVP_bf_cbc(), 0, this, type);
45
+ else if (type == QLatin1String("blowfish-cbc-pkcs7"))
46
+ return new opensslCipherContext(EVP_bf_cbc(), 1, this, type);
47
+ +#endif
48
+ +#ifndef OPENSSL_NO_DES
49
+ else if (type == QLatin1String("tripledes-ecb"))
50
+ return new opensslCipherContext(EVP_des_ede3(), 0, this, type);
51
+ else if (type == QLatin1String("tripledes-cbc"))
52
+ @@ -6872,6 +6875,8 @@ public:
53
+ return new opensslCipherContext(EVP_des_cfb(), 0, this, type);
54
+ else if (type == QLatin1String("des-ofb"))
55
+ return new opensslCipherContext(EVP_des_ofb(), 0, this, type);
56
+ +#endif
57
+ +#ifndef OPENSSL_NO_CAST
58
+ else if (type == QLatin1String("cast5-ecb"))
59
+ return new opensslCipherContext(EVP_cast5_ecb(), 0, this, type);
60
+ else if (type == QLatin1String("cast5-cbc"))
61
+ @@ -6882,6 +6887,7 @@ public:
62
+ return new opensslCipherContext(EVP_cast5_cfb(), 0, this, type);
63
+ else if (type == QLatin1String("cast5-ofb"))
64
+ return new opensslCipherContext(EVP_cast5_ofb(), 0, this, type);
65
+ +#endif
66
+ else if (type == QLatin1String("pkey"))
67
+ return new MyPKeyContext(this);
68
+ else if (type == QLatin1String("dlgroup"))
69
+ --
70
+ 2.31.1
71
+
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/mk-ca-bundle.pl ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ # ***************************************************************************
3
+ # * _ _ ____ _
4
+ # * Project ___| | | | _ \| |
5
+ # * / __| | | | |_) | |
6
+ # * | (__| |_| | _ <| |___
7
+ # * \___|\___/|_| \_\_____|
8
+ # *
9
+ # * Copyright (C) 1998 - 2016, Daniel Stenberg, <[email protected]>, et al.
10
+ # *
11
+ # * This software is licensed as described in the file COPYING, which
12
+ # * you should have received as part of this distribution. The terms
13
+ # * are also available at https://curl.haxx.se/docs/copyright.html.
14
+ # *
15
+ # * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
+ # * copies of the Software, and permit persons to whom the Software is
17
+ # * furnished to do so, under the terms of the COPYING file.
18
+ # *
19
+ # * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
+ # * KIND, either express or implied.
21
+ # *
22
+ # ***************************************************************************
23
+ # This Perl script creates a fresh ca-bundle.crt file for use with libcurl.
24
+ # It downloads certdata.txt from Mozilla's source tree (see URL below),
25
+ # then parses certdata.txt and extracts CA Root Certificates into PEM format.
26
+ # These are then processed with the OpenSSL commandline tool to produce the
27
+ # final ca-bundle.crt file.
28
+ # The script is based on the parse-certs script written by Roland Krikava.
29
+ # This Perl script works on almost any platform since its only external
30
+ # dependency is the OpenSSL commandline tool for optional text listing.
31
+ # Hacked by Guenter Knauf.
32
+ #
33
+ use Encode;
34
+ use Getopt::Std;
35
+ use MIME::Base64;
36
+ use strict;
37
+ use vars qw($opt_b $opt_d $opt_f $opt_h $opt_i $opt_k $opt_l $opt_m $opt_n $opt_p $opt_q $opt_s $opt_t $opt_u $opt_v $opt_w);
38
+ use List::Util;
39
+ use Text::Wrap;
40
+ my $MOD_SHA = "Digest::SHA";
41
+ eval "require $MOD_SHA";
42
+ if ($@) {
43
+ $MOD_SHA = "Digest::SHA::PurePerl";
44
+ eval "require $MOD_SHA";
45
+ }
46
+ eval "require LWP::UserAgent";
47
+
48
+ my %urls = (
49
+ 'nss' =>
50
+ 'https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/builtins/certdata.txt',
51
+ 'central' =>
52
+ 'https://hg.mozilla.org/mozilla-central/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
53
+ 'aurora' =>
54
+ 'https://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
55
+ 'beta' =>
56
+ 'https://hg.mozilla.org/releases/mozilla-beta/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
57
+ 'release' =>
58
+ 'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
59
+ );
60
+
61
+ $opt_d = 'release';
62
+
63
+ # If the OpenSSL commandline is not in search path you can configure it here!
64
+ my $openssl = 'openssl';
65
+
66
+ my $version = '1.27';
67
+
68
+ $opt_w = 76; # default base64 encoded lines length
69
+
70
+ # default cert types to include in the output (default is to include CAs which may issue SSL server certs)
71
+ my $default_mozilla_trust_purposes = "SERVER_AUTH";
72
+ my $default_mozilla_trust_levels = "TRUSTED_DELEGATOR";
73
+ $opt_p = $default_mozilla_trust_purposes . ":" . $default_mozilla_trust_levels;
74
+
75
+ my @valid_mozilla_trust_purposes = (
76
+ "DIGITAL_SIGNATURE",
77
+ "NON_REPUDIATION",
78
+ "KEY_ENCIPHERMENT",
79
+ "DATA_ENCIPHERMENT",
80
+ "KEY_AGREEMENT",
81
+ "KEY_CERT_SIGN",
82
+ "CRL_SIGN",
83
+ "SERVER_AUTH",
84
+ "CLIENT_AUTH",
85
+ "CODE_SIGNING",
86
+ "EMAIL_PROTECTION",
87
+ "IPSEC_END_SYSTEM",
88
+ "IPSEC_TUNNEL",
89
+ "IPSEC_USER",
90
+ "TIME_STAMPING",
91
+ "STEP_UP_APPROVED"
92
+ );
93
+
94
+ my @valid_mozilla_trust_levels = (
95
+ "TRUSTED_DELEGATOR", # CAs
96
+ "NOT_TRUSTED", # Don't trust these certs.
97
+ "MUST_VERIFY_TRUST", # This explicitly tells us that it ISN'T a CA but is otherwise ok. In other words, this should tell the app to ignore any other sources that claim this is a CA.
98
+ "TRUSTED" # This cert is trusted, but only for itself and not for delegates (i.e. it is not a CA).
99
+ );
100
+
101
+ my $default_signature_algorithms = $opt_s = "MD5";
102
+
103
+ my @valid_signature_algorithms = (
104
+ "MD5",
105
+ "SHA1",
106
+ "SHA256",
107
+ "SHA384",
108
+ "SHA512"
109
+ );
110
+
111
+ $0 =~ s@.*(/|\\)@@;
112
+ $Getopt::Std::STANDARD_HELP_VERSION = 1;
113
+ getopts('bd:fhiklmnp:qs:tuvw:');
114
+
115
+ if(!defined($opt_d)) {
116
+ # to make plain "-d" use not cause warnings, and actually still work
117
+ $opt_d = 'release';
118
+ }
119
+
120
+ # Use predefined URL or else custom URL specified on command line.
121
+ my $url;
122
+ if(defined($urls{$opt_d})) {
123
+ $url = $urls{$opt_d};
124
+ if(!$opt_k && $url !~ /^https:\/\//i) {
125
+ die "The URL for '$opt_d' is not HTTPS. Use -k to override (insecure).\n";
126
+ }
127
+ }
128
+ else {
129
+ $url = $opt_d;
130
+ }
131
+
132
+ my $curl = `curl -V`;
133
+
134
+ if ($opt_i) {
135
+ print ("=" x 78 . "\n");
136
+ print "Script Version : $version\n";
137
+ print "Perl Version : $]\n";
138
+ print "Operating System Name : $^O\n";
139
+ print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
140
+ print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
141
+ print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n" if($LWP::UserAgent::VERSION);
142
+ print "LWP.pm Version : ${LWP::VERSION}\n" if($LWP::VERSION);
143
+ print "Digest::SHA.pm Version : ${Digest::SHA::VERSION}\n" if ($Digest::SHA::VERSION);
144
+ print "Digest::SHA::PurePerl.pm Version : ${Digest::SHA::PurePerl::VERSION}\n" if ($Digest::SHA::PurePerl::VERSION);
145
+ print ("=" x 78 . "\n");
146
+ }
147
+
148
+ sub warning_message() {
149
+ if ( $opt_d =~ m/^risk$/i ) { # Long Form Warning and Exit
150
+ print "Warning: Use of this script may pose some risk:\n";
151
+ print "\n";
152
+ print " 1) If you use HTTP URLs they are subject to a man in the middle attack\n";
153
+ print " 2) Default to 'release', but more recent updates may be found in other trees\n";
154
+ print " 3) certdata.txt file format may change, lag time to update this script\n";
155
+ print " 4) Generally unwise to blindly trust CAs without manual review & verification\n";
156
+ print " 5) Mozilla apps use additional security checks aren't represented in certdata\n";
157
+ print " 6) Use of this script will make a security engineer grind his teeth and\n";
158
+ print " swear at you. ;)\n";
159
+ exit;
160
+ } else { # Short Form Warning
161
+ print "Warning: Use of this script may pose some risk, -d risk for more details.\n";
162
+ }
163
+ }
164
+
165
+ sub HELP_MESSAGE() {
166
+ print "Usage:\t${0} [-b] [-d<certdata>] [-f] [-i] [-k] [-l] [-n] [-p<purposes:levels>] [-q] [-s<algorithms>] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n";
167
+ print "\t-b\tbackup an existing version of ca-bundle.crt\n";
168
+ print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
169
+ print "\t\t Valid names are:\n";
170
+ print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n";
171
+ print "\t-f\tforce rebuild even if certdata.txt is current\n";
172
+ print "\t-i\tprint version info about used modules\n";
173
+ print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n";
174
+ print "\t-l\tprint license info about certdata.txt\n";
175
+ print "\t-m\tinclude meta data in output\n";
176
+ print "\t-n\tno download of certdata.txt (to use existing)\n";
177
+ print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n";
178
+ print "\t\t Valid purposes are:\n";
179
+ print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n";
180
+ print "\t\t Valid levels are:\n";
181
+ print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n";
182
+ print "\t-q\tbe really quiet (no progress output at all)\n";
183
+ print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n");
184
+ print "\t\t Valid signature algorithms are:\n";
185
+ print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n";
186
+ print "\t-t\tinclude plain text listing of certificates\n";
187
+ print "\t-u\tunlink (remove) certdata.txt after processing\n";
188
+ print "\t-v\tbe verbose and print out processed CAs\n";
189
+ print "\t-w <l>\twrap base64 output lines after <l> chars (default: ${opt_w})\n";
190
+ exit;
191
+ }
192
+
193
+ sub VERSION_MESSAGE() {
194
+ print "${0} version ${version} running Perl ${]} on ${^O}\n";
195
+ }
196
+
197
+ warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
198
+ HELP_MESSAGE() if ($opt_h);
199
+
200
+ sub report($@) {
201
+ my $output = shift;
202
+
203
+ print STDERR $output . "\n" unless $opt_q;
204
+ }
205
+
206
+ sub is_in_list($@) {
207
+ my $target = shift;
208
+
209
+ return defined(List::Util::first { $target eq $_ } @_);
210
+ }
211
+
212
+ # Parses $param_string as a case insensitive comma separated list with optional whitespace
213
+ # validates that only allowed parameters are supplied
214
+ sub parse_csv_param($$@) {
215
+ my $description = shift;
216
+ my $param_string = shift;
217
+ my @valid_values = @_;
218
+
219
+ my @values = map {
220
+ s/^\s+//; # strip leading spaces
221
+ s/\s+$//; # strip trailing spaces
222
+ uc $_ # return the modified string as upper case
223
+ } split( ',', $param_string );
224
+
225
+ # Find all values which are not in the list of valid values or "ALL"
226
+ my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values;
227
+
228
+ if ( scalar(@invalid) > 0 ) {
229
+ # Tell the user which parameters were invalid and print the standard help message which will exit
230
+ print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n";
231
+ HELP_MESSAGE();
232
+ }
233
+
234
+ @values = @valid_values if ( is_in_list("ALL",@values) );
235
+
236
+ return @values;
237
+ }
238
+
239
+ sub sha256 {
240
+ my $result;
241
+ if ($Digest::SHA::VERSION || $Digest::SHA::PurePerl::VERSION) {
242
+ open(FILE, $_[0]) or die "Can't open '$_[0]': $!";
243
+ binmode(FILE);
244
+ $result = $MOD_SHA->new(256)->addfile(*FILE)->hexdigest;
245
+ close(FILE);
246
+ } else {
247
+ # Use OpenSSL command if Perl Digest::SHA modules not available
248
+ $result = `"$openssl" dgst -r -sha256 "$_[0]"`;
249
+ $result =~ s/^([0-9a-f]{64}) .+/$1/is;
250
+ }
251
+ return $result;
252
+ }
253
+
254
+
255
+ sub oldhash {
256
+ my $hash = "";
257
+ open(C, "<$_[0]") || return 0;
258
+ while(<C>) {
259
+ chomp;
260
+ if($_ =~ /^\#\# SHA256: (.*)/) {
261
+ $hash = $1;
262
+ last;
263
+ }
264
+ }
265
+ close(C);
266
+ return $hash;
267
+ }
268
+
269
+ if ( $opt_p !~ m/:/ ) {
270
+ print "Error: Mozilla trust identifier list must include both purposes and levels\n";
271
+ HELP_MESSAGE();
272
+ }
273
+
274
+ (my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p );
275
+ my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes );
276
+ my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels );
277
+
278
+ my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms );
279
+
280
+ sub should_output_cert(%) {
281
+ my %trust_purposes_by_level = @_;
282
+
283
+ foreach my $level (@included_mozilla_trust_levels) {
284
+ # for each level we want to output, see if any of our desired purposes are included
285
+ return 1 if ( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) );
286
+ }
287
+
288
+ return 0;
289
+ }
290
+
291
+ my $crt = $ARGV[0] || 'ca-bundle.crt';
292
+ (my $txt = $url) =~ s@(.*/|\?.*)@@g;
293
+
294
+ my $stdout = $crt eq '-';
295
+ my $resp;
296
+ my $fetched;
297
+
298
+ my $oldhash = oldhash($crt);
299
+
300
+ report "SHA256 of old file: $oldhash";
301
+
302
+ if(!$opt_n) {
303
+ report "Downloading $txt ...";
304
+
305
+ # If we have an HTTPS URL then use curl
306
+ if($url =~ /^https:\/\//i) {
307
+ if($curl) {
308
+ if($curl =~ /^Protocols:.* https( |$)/m) {
309
+ report "Get certdata with curl!";
310
+ my $proto = !$opt_k ? "--proto =https" : "";
311
+ my $quiet = $opt_q ? "-s" : "";
312
+ my @out = `curl -w %{response_code} $proto $quiet -o "$txt" "$url"`;
313
+ if(@out && $out[0] == 200) {
314
+ $fetched = 1;
315
+ report "Downloaded $txt";
316
+ }
317
+ else {
318
+ report "Failed downloading via HTTPS with curl";
319
+ if(-e $txt && !unlink($txt)) {
320
+ report "Failed to remove '$txt': $!";
321
+ }
322
+ }
323
+ }
324
+ else {
325
+ report "curl lacks https support";
326
+ }
327
+ }
328
+ else {
329
+ report "curl not found";
330
+ }
331
+ }
332
+
333
+ # If nothing was fetched then use LWP
334
+ if(!$fetched) {
335
+ if($url =~ /^https:\/\//i) {
336
+ report "Falling back to HTTP";
337
+ $url =~ s/^https:\/\//http:\/\//i;
338
+ }
339
+ if(!$opt_k) {
340
+ report "URLs other than HTTPS are disabled by default, to enable use -k";
341
+ exit 1;
342
+ }
343
+ report "Get certdata with LWP!";
344
+ if(!defined(${LWP::UserAgent::VERSION})) {
345
+ report "LWP is not available (LWP::UserAgent not found)";
346
+ exit 1;
347
+ }
348
+ my $ua = new LWP::UserAgent(agent => "$0/$version");
349
+ $ua->env_proxy();
350
+ $resp = $ua->mirror($url, $txt);
351
+ if($resp && $resp->code eq '304') {
352
+ report "Not modified";
353
+ exit 0 if -e $crt && !$opt_f;
354
+ }
355
+ else {
356
+ $fetched = 1;
357
+ report "Downloaded $txt";
358
+ }
359
+ if(!$resp || $resp->code !~ /^(?:200|304)$/) {
360
+ report "Unable to download latest data: "
361
+ . ($resp? $resp->code . ' - ' . $resp->message : "LWP failed");
362
+ exit 1 if -e $crt || ! -r $txt;
363
+ }
364
+ }
365
+ }
366
+
367
+ my $filedate = $resp ? $resp->last_modified : (stat($txt))[9];
368
+ my $datesrc = "as of";
369
+ if(!$filedate) {
370
+ # mxr.mozilla.org gave us a time, hg.mozilla.org does not!
371
+ $filedate = time();
372
+ $datesrc="downloaded on";
373
+ }
374
+
375
+ # get the hash from the download file
376
+ my $newhash= sha256($txt);
377
+
378
+ if(!$opt_f && $oldhash eq $newhash) {
379
+ report "Downloaded file identical to previous run\'s source file. Exiting";
380
+ exit;
381
+ }
382
+
383
+ report "SHA256 of new file: $newhash";
384
+
385
+ my $currentdate = scalar gmtime($filedate);
386
+
387
+ my $format = $opt_t ? "plain text and " : "";
388
+ if( $stdout ) {
389
+ open(CRT, '> -') or die "Couldn't open STDOUT: $!\n";
390
+ } else {
391
+ open(CRT,">$crt.~") or die "Couldn't open $crt.~: $!\n";
392
+ }
393
+ print CRT <<EOT;
394
+ ##
395
+ ## Bundle of CA Root Certificates
396
+ ##
397
+ ## Certificate data from Mozilla ${datesrc}: ${currentdate} GMT
398
+ ##
399
+ ## This is a bundle of X.509 certificates of public Certificate Authorities
400
+ ## (CA). These were automatically extracted from Mozilla's root certificates
401
+ ## file (certdata.txt). This file can be found in the mozilla source tree:
402
+ ## ${url}
403
+ ##
404
+ ## It contains the certificates in ${format}PEM format and therefore
405
+ ## can be directly used with curl / libcurl / php_curl, or with
406
+ ## an Apache+mod_ssl webserver for SSL client authentication.
407
+ ## Just configure this file as the SSLCACertificateFile.
408
+ ##
409
+ ## Conversion done with mk-ca-bundle.pl version $version.
410
+ ## SHA256: $newhash
411
+ ##
412
+
413
+ EOT
414
+
415
+ report "Processing '$txt' ...";
416
+ my $caname;
417
+ my $certnum = 0;
418
+ my $skipnum = 0;
419
+ my $start_of_cert = 0;
420
+ my @precert;
421
+
422
+ open(TXT,"$txt") or die "Couldn't open $txt: $!\n";
423
+ while (<TXT>) {
424
+ if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) {
425
+ print CRT;
426
+ print if ($opt_l);
427
+ while (<TXT>) {
428
+ print CRT;
429
+ print if ($opt_l);
430
+ last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/);
431
+ }
432
+ }
433
+ elsif(/^# (Issuer|Serial Number|Subject|Not Valid Before|Not Valid After |Fingerprint \(MD5\)|Fingerprint \(SHA1\)):/) {
434
+ push @precert, $_;
435
+ next;
436
+ }
437
+ elsif(/^#|^\s*$/) {
438
+ undef @precert;
439
+ next;
440
+ }
441
+ chomp;
442
+
443
+ # this is a match for the start of a certificate
444
+ if (/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) {
445
+ $start_of_cert = 1
446
+ }
447
+ if ($start_of_cert && /^CKA_LABEL UTF8 \"(.*)\"/) {
448
+ $caname = $1;
449
+ }
450
+ my %trust_purposes_by_level;
451
+ if ($start_of_cert && /^CKA_VALUE MULTILINE_OCTAL/) {
452
+ my $data;
453
+ while (<TXT>) {
454
+ last if (/^END/);
455
+ chomp;
456
+ my @octets = split(/\\/);
457
+ shift @octets;
458
+ for (@octets) {
459
+ $data .= chr(oct);
460
+ }
461
+ }
462
+ # scan forwards until the trust part
463
+ while (<TXT>) {
464
+ last if (/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/);
465
+ chomp;
466
+ }
467
+ # now scan the trust part to determine how we should trust this cert
468
+ while (<TXT>) {
469
+ last if (/^#/);
470
+ if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) {
471
+ if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) {
472
+ report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2";
473
+ } elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) {
474
+ report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2";
475
+ } else {
476
+ push @{$trust_purposes_by_level{$2}}, $1;
477
+ }
478
+ }
479
+ }
480
+
481
+ if ( !should_output_cert(%trust_purposes_by_level) ) {
482
+ $skipnum ++;
483
+ } else {
484
+ my $encoded = MIME::Base64::encode_base64($data, '');
485
+ $encoded =~ s/(.{1,${opt_w}})/$1\n/g;
486
+ my $pem = "-----BEGIN CERTIFICATE-----\n"
487
+ . $encoded
488
+ . "-----END CERTIFICATE-----\n";
489
+ print CRT "\n$caname\n";
490
+ print CRT @precert if($opt_m);
491
+ my $maxStringLength = length(decode('UTF-8', $caname, Encode::FB_CROAK));
492
+ if ($opt_t) {
493
+ foreach my $key (keys %trust_purposes_by_level) {
494
+ my $string = $key . ": " . join(", ", @{$trust_purposes_by_level{$key}});
495
+ $maxStringLength = List::Util::max( length($string), $maxStringLength );
496
+ print CRT $string . "\n";
497
+ }
498
+ }
499
+ print CRT ("=" x $maxStringLength . "\n");
500
+ if (!$opt_t) {
501
+ print CRT $pem;
502
+ } else {
503
+ my $pipe = "";
504
+ foreach my $hash (@included_signature_algorithms) {
505
+ $pipe = "|$openssl x509 -" . $hash . " -fingerprint -noout -inform PEM";
506
+ if (!$stdout) {
507
+ $pipe .= " >> $crt.~";
508
+ close(CRT) or die "Couldn't close $crt.~: $!";
509
+ }
510
+ open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
511
+ print TMP $pem;
512
+ close(TMP) or die "Couldn't close openssl pipe: $!";
513
+ if (!$stdout) {
514
+ open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
515
+ }
516
+ }
517
+ $pipe = "|$openssl x509 -text -inform PEM";
518
+ if (!$stdout) {
519
+ $pipe .= " >> $crt.~";
520
+ close(CRT) or die "Couldn't close $crt.~: $!";
521
+ }
522
+ open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
523
+ print TMP $pem;
524
+ close(TMP) or die "Couldn't close openssl pipe: $!";
525
+ if (!$stdout) {
526
+ open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
527
+ }
528
+ }
529
+ report "Parsing: $caname" if ($opt_v);
530
+ $certnum ++;
531
+ $start_of_cert = 0;
532
+ }
533
+ undef @precert;
534
+ }
535
+
536
+ }
537
+ close(TXT) or die "Couldn't close $txt: $!\n";
538
+ close(CRT) or die "Couldn't close $crt.~: $!\n";
539
+ unless( $stdout ) {
540
+ if ($opt_b && -e $crt) {
541
+ my $bk = 1;
542
+ while (-e "$crt.~${bk}~") {
543
+ $bk++;
544
+ }
545
+ rename $crt, "$crt.~${bk}~" or die "Failed to create backup $crt.~$bk}~: $!\n";
546
+ } elsif( -e $crt ) {
547
+ unlink( $crt ) or die "Failed to remove $crt: $!\n";
548
+ }
549
+ rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
550
+ }
551
+ if($opt_u && -e $txt && !unlink($txt)) {
552
+ report "Failed to remove $txt: $!\n";
553
+ }
554
+ report "Done ($certnum CA certs processed, $skipnum skipped).";
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/portfile.cmake ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This portfile adds the Qt Cryptographic Arcitecture
2
+ # Changes to the original build:
3
+ # No -qt5 suffix, which is recommended just for Linux
4
+ # Output directories according to vcpkg
5
+ # Updated certstore. See certstore.pem in the output dirs
6
+ #
7
+ vcpkg_find_acquire_program(PERL)
8
+ get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
9
+ vcpkg_add_to_path("${PERL_EXE_PATH}")
10
+
11
+ vcpkg_from_github(
12
+ OUT_SOURCE_PATH SOURCE_PATH
13
+ REPO KDE/qca
14
+ REF v2.3.4
15
+ SHA512 04583da17531538fc2a7ae18a1a4f89f1e8d303e2bb390520a8f55a20bab17f8407ab07aefef2a75587e2a0521f41b37a9fdd8430ec483daf5d02c05556b8ddb
16
+ PATCHES
17
+ 0001-fix-path-for-vcpkg.patch
18
+ 0002-fix-build-error.patch
19
+ )
20
+
21
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
22
+ set(QCA_FEATURE_INSTALL_DIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug/bin/Qca)
23
+ set(QCA_FEATURE_INSTALL_DIR_RELEASE ${CURRENT_PACKAGES_DIR}/bin/Qca)
24
+ else()
25
+ set(QCA_FEATURE_INSTALL_DIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug/lib/Qca)
26
+ set(QCA_FEATURE_INSTALL_DIR_RELEASE ${CURRENT_PACKAGES_DIR}/lib/Qca)
27
+ endif()
28
+
29
+ # According to:
30
+ # https://www.openssl.org/docs/faq.html#USER16
31
+ # it is up to developers or admins to maintain CAs.
32
+ # So we do it here:
33
+ message(STATUS "Importing certstore")
34
+ file(REMOVE "${SOURCE_PATH}/certs/rootcerts.pem")
35
+ # Using file(DOWNLOAD) to use https
36
+ file(DOWNLOAD https://raw.githubusercontent.com/mozilla/gecko-dev/master/security/nss/lib/ckfw/builtins/certdata.txt
37
+ "${CURRENT_BUILDTREES_DIR}/cert/certdata.txt"
38
+ TLS_VERIFY ON
39
+ )
40
+ vcpkg_execute_required_process(
41
+ COMMAND "${PERL}" "${CMAKE_CURRENT_LIST_DIR}/mk-ca-bundle.pl" -n "${SOURCE_PATH}/certs/rootcerts.pem"
42
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/cert"
43
+ LOGNAME ca-bundle
44
+ )
45
+ message(STATUS "Importing certstore done")
46
+
47
+ if("botan" IN_LIST FEATURES)
48
+ list(APPEND QCA_OPTIONS -DWITH_botan_PLUGIN="yes")
49
+ else()
50
+ list(APPEND QCA_OPTIONS -DWITH_botan_PLUGIN="no")
51
+ endif()
52
+
53
+ # Configure and build
54
+ vcpkg_cmake_configure(
55
+ SOURCE_PATH "${SOURCE_PATH}"
56
+ OPTIONS
57
+ -DUSE_RELATIVE_PATHS=ON
58
+ -DBUILD_TESTS=OFF
59
+ -DBUILD_TOOLS=OFF
60
+ -DQCA_SUFFIX=OFF
61
+ -DQCA_FEATURE_INSTALL_DIR=share/qca/mkspecs/features
62
+ -DOSX_FRAMEWORK=OFF
63
+ ${QCA_OPTIONS}
64
+ OPTIONS_DEBUG
65
+ -DQCA_PLUGINS_INSTALL_DIR=${QCA_FEATURE_INSTALL_DIR_DEBUG}
66
+ OPTIONS_RELEASE
67
+ -DQCA_PLUGINS_INSTALL_DIR=${QCA_FEATURE_INSTALL_DIR_RELEASE}
68
+ )
69
+
70
+ vcpkg_cmake_install()
71
+
72
+ vcpkg_cmake_config_fixup(CONFIG_PATH share/qca/cmake)
73
+ file(READ "${CURRENT_PACKAGES_DIR}/share/${PORT}/QcaConfig.cmake" QCA_CONFIG_FILE)
74
+ string(REGEX REPLACE "PACKAGE_PREFIX_DIR \"(.*)\" ABSOLUTE"
75
+ [[PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE]]
76
+ QCA_CONFIG_FILE "${QCA_CONFIG_FILE}"
77
+ )
78
+ file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/QcaConfig.cmake" "${QCA_CONFIG_FILE}")
79
+
80
+ # Remove unneeded dirs
81
+ file(REMOVE_RECURSE
82
+ "${CURRENT_BUILDTREES_DIR}/share/man"
83
+ "${CURRENT_PACKAGES_DIR}/share/man"
84
+ "${CURRENT_PACKAGES_DIR}/debug/include"
85
+ "${CURRENT_PACKAGES_DIR}/debug/share"
86
+ )
87
+
88
+ vcpkg_fixup_pkgconfig()
89
+
90
+ # Handle copyright
91
+ file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qca/vcpkg.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "qca",
3
+ "version": "2.3.4",
4
+ "port-version": 2,
5
+ "description": "Qt Cryptographic Architecture (QCA).",
6
+ "homepage": "https://cgit.kde.org/qca.git/",
7
+ "dependencies": [
8
+ {
9
+ "name": "qt5-base",
10
+ "default-features": false
11
+ },
12
+ {
13
+ "name": "vcpkg-cmake",
14
+ "host": true
15
+ },
16
+ {
17
+ "name": "vcpkg-cmake-config",
18
+ "host": true
19
+ }
20
+ ],
21
+ "default-features": [
22
+ "botan"
23
+ ],
24
+ "features": {
25
+ "botan": {
26
+ "description": "Build with botan",
27
+ "dependencies": [
28
+ "botan"
29
+ ]
30
+ }
31
+ }
32
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qcustomplot/portfile.cmake ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ set(QCP_VERSION 2.0.1)
2
+
3
+ vcpkg_download_distfile(ARCHIVE
4
+ URLS "https://www.qcustomplot.com/release/${QCP_VERSION}/QCustomPlot.tar.gz"
5
+ FILENAME "QCustomPlot-${QCP_VERSION}.tar.gz"
6
+ SHA512 a15598718146ed3c6b5d38530a56661c16269e530fe0dedb71b4cb2722b5733a3b57689d668a75994b79c19c6e61dcc133dbcb9ed77b93a165f4ac826a5685b9
7
+ )
8
+ vcpkg_extract_source_archive_ex(
9
+ OUT_SOURCE_PATH SOURCE_PATH
10
+ ARCHIVE ${ARCHIVE}
11
+ REF ${QCP_VERSION}
12
+ )
13
+
14
+ vcpkg_download_distfile(ARCHIVE
15
+ URLS "https://www.qcustomplot.com/release/${QCP_VERSION}/QCustomPlot-sharedlib.tar.gz"
16
+ FILENAME "QCustomPlot-sharedlib-${QCP_VERSION}.tar.gz"
17
+ SHA512 ce90540fca7226eac37746327e1939a9c7af38fc2595f385ed04d6d1f49560da08fb5fae15d1b9d22b6ba578583f70de8f89ef26796770d41bf599c1b15c535d
18
+ )
19
+ vcpkg_extract_source_archive(SharedLib_SOURCE_PATH ARCHIVE "${ARCHIVE}")
20
+ file(RENAME "${SharedLib_SOURCE_PATH}" "${SOURCE_PATH}/qcustomplot-sharedlib")
21
+
22
+
23
+ vcpkg_configure_qmake(SOURCE_PATH
24
+ ${SOURCE_PATH}/qcustomplot-sharedlib/sharedlib-compilation/sharedlib-compilation.pro
25
+ )
26
+
27
+ vcpkg_install_qmake(
28
+ RELEASE_TARGETS release-all
29
+ DEBUG_TARGETS debug-all
30
+ )
31
+
32
+ # Install header file
33
+ file(INSTALL ${SOURCE_PATH}/qcustomplot.h
34
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
35
+ )
36
+
37
+ vcpkg_copy_pdbs()
38
+
39
+ # Handle copyright
40
+ configure_file(${SOURCE_PATH}/GPL.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qcustomplot/vcpkg.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "qcustomplot",
3
+ "version": "2.0.1",
4
+ "port-version": 5,
5
+ "description": "QCustomPlot is a Qt C++ widget for plotting and data visualization.",
6
+ "dependencies": [
7
+ {
8
+ "name": "qt5-base",
9
+ "default-features": false
10
+ }
11
+ ]
12
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhttpengine/portfile.cmake ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ vcpkg_from_github(
2
+ OUT_SOURCE_PATH SOURCE_PATH
3
+ REPO nitroshare/qhttpengine
4
+ REF 43f55df51623621ed3efb4e42c7894586d988667
5
+ SHA512 bf615016b9078ff1b3b47bb0d0329565d2d44caba67a3a207c430e7f03a7b5d8b326268fafa2b8ebff387aec9356014ec5510e18a422dd2dea7eb1e9bfc009f3
6
+ HEAD_REF master
7
+ )
8
+
9
+ vcpkg_cmake_configure(
10
+ SOURCE_PATH "${SOURCE_PATH}"
11
+ OPTIONS
12
+ -DBUILD_DOC=OFF
13
+ -DBUILD_EXAMPLES=OFF
14
+ -DBUILD_TESTS=OFF
15
+ )
16
+
17
+ vcpkg_cmake_install()
18
+ vcpkg_copy_pdbs()
19
+ vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake)
20
+ if(VCPKG_TARGET_IS_WINDOWS)
21
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
22
+ else()
23
+ vcpkg_fixup_pkgconfig()
24
+ endif()
25
+
26
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
27
+ file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhttpengine/vcpkg.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "qhttpengine",
3
+ "version": "1.0.2",
4
+ "port-version": 1,
5
+ "description": "HTTP server for Qt applications",
6
+ "supports": "!uwp",
7
+ "dependencies": [
8
+ "qt5-base",
9
+ {
10
+ "name": "vcpkg-cmake",
11
+ "host": true
12
+ },
13
+ {
14
+ "name": "vcpkg-cmake-config",
15
+ "host": true
16
+ }
17
+ ]
18
+ }
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhull/fix-missing-symbols.patch ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ From 02ba907908ccf5ed0d40a2251272b67cb05c23ea Mon Sep 17 00:00:00 2001
2
+ From: Francisco Facioni <[email protected]>
3
+ Date: Sat, 31 Jul 2021 22:30:45 +0100
4
+ Subject: [PATCH] Missing symbols in the export
5
+
6
+ ---
7
+ src/libqhull_r/qhull_r-exports.def | 2 ++
8
+ 1 file changed, 2 insertions(+)
9
+
10
+ diff --git a/src/libqhull_r/qhull_r-exports.def b/src/libqhull_r/qhull_r-exports.def
11
+ index 4c5e17c..b789673 100644
12
+ --- a/src/libqhull_r/qhull_r-exports.def
13
+ +++ b/src/libqhull_r/qhull_r-exports.def
14
+ @@ -183,6 +183,7 @@ qh_maxouter
15
+ qh_maxsimplex
16
+ qh_maydropneighbor
17
+ qh_memalloc
18
+ +qh_memcheck
19
+ qh_memfree
20
+ qh_memfreeshort
21
+ qh_meminit
22
+ @@ -351,6 +352,7 @@ qh_setdelnth
23
+ qh_setdelnthsorted
24
+ qh_setdelsorted
25
+ qh_setduplicate
26
+ +qh_setendpointer
27
+ qh_setequal
28
+ qh_setequal_except
29
+ qh_setequal_skip
third-party/DPVO/Pangolin/scripts/vcpkg/ports/qhull/include-qhullcpp-shared.patch ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/CMakeLists.txt b/CMakeLists.txt
2
+ index f50b187..30109b3 100644
3
+ --- a/CMakeLists.txt
4
+ +++ b/CMakeLists.txt
5
+ @@ -344,7 +344,7 @@ set(qhull_SHAREDP qhull_p) # libqhull and qhull_p are deprecated, use qhull_r i
6
+
7
+ set(qhull_TARGETS_APPLICATIONS qhull rbox qconvex qdelaunay qvoronoi qhalf)
8
+ set(qhull_TARGETS_STATIC ${qhull_CPP} ${qhull_STATIC} ${qhull_STATICR})
9
+ -set(qhull_TARGETS_SHARED ${qhull_SHAREDR})
10
+ +set(qhull_TARGETS_SHARED ${qhull_CPP} ${qhull_SHAREDR})
11
+
12
+ set(
13
+ qhull_TARGETS_TEST # Unused
14
+ @@ -474,7 +474,6 @@ set_target_properties(${qhull_CPP} PROPERTIES
15
+ if(NOT ${BUILD_STATIC_LIBS})
16
+ set_target_properties(${qhull_STATIC} PROPERTIES EXCLUDE_FROM_ALL TRUE)
17
+ set_target_properties(${qhull_STATICR} PROPERTIES EXCLUDE_FROM_ALL TRUE)
18
+ - set_target_properties(${qhull_CPP} PROPERTIES EXCLUDE_FROM_ALL TRUE)
19
+ endif()
20
+ if(NOT ${BUILD_SHARED_LIBS})
21
+ set_target_properties(${qhull_SHARED} PROPERTIES EXCLUDE_FROM_ALL TRUE)