From 69f5165163f68536c10ec24be8e988c3817a9c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Sat, 3 Apr 2021 04:00:07 +0800 Subject: [PATCH] [pthreads] Fix crt linkage (#17011) * [pthreads] Fix crt linkage * update version record * update baseline --- ports/pthreads/CONTROL | 5 ----- ports/pthreads/portfile.cmake | 7 +++++++ ports/pthreads/use-md.patch | 33 +++++++++++++++++++++++++++++++++ ports/pthreads/use-mt.patch | 33 +++++++++++++++++++++++++++++++++ ports/pthreads/vcpkg.json | 8 ++++++++ scripts/ci.baseline.txt | 4 +++- versions/baseline.json | 4 ++-- versions/p-/pthreads.json | 5 +++++ 8 files changed, 91 insertions(+), 8 deletions(-) delete mode 100644 ports/pthreads/CONTROL create mode 100644 ports/pthreads/use-md.patch create mode 100644 ports/pthreads/use-mt.patch create mode 100644 ports/pthreads/vcpkg.json diff --git a/ports/pthreads/CONTROL b/ports/pthreads/CONTROL deleted file mode 100644 index 0aadc97151..0000000000 --- a/ports/pthreads/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: pthreads -Version: 3.0.0-6 -Homepage: https://sourceware.org/pub/pthreads-win32/ -Description: pthreads for windows -Supports: !(uwp|arm|arm64) \ No newline at end of file diff --git a/ports/pthreads/portfile.cmake b/ports/pthreads/portfile.cmake index 911eb4deda..967ff54e10 100644 --- a/ports/pthreads/portfile.cmake +++ b/ports/pthreads/portfile.cmake @@ -7,11 +7,18 @@ vcpkg_fail_port_install(MESSAGE "${PORT} does not currently support UWP platform set(PTHREADS4W_VERSION "3.0.0") +if (VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(PATCH_FILE use-md.patch) +else() + set(PATCH_FILE use-mt.patch) +endif() + vcpkg_from_sourceforge( OUT_SOURCE_PATH SOURCE_PATH REPO pthreads4w FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip" SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013 + PATCHES ${PATCH_FILE} ) find_program(NMAKE nmake REQUIRED) diff --git a/ports/pthreads/use-md.patch b/ports/pthreads/use-md.patch new file mode 100644 index 0000000000..b25a744a8c --- /dev/null +++ b/ports/pthreads/use-md.patch @@ -0,0 +1,33 @@ +diff --git a/Makefile b/Makefile +index a703b9c..ff81e7c 100644 +--- a/Makefile ++++ b/Makefile +@@ -173,22 +173,22 @@ VC-debug: + # @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_STATIC_LIB" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).small_static_stamp + + VCE-static: +- @ $(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 ++ @ $(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 + + VCE-static-debug: +- @ $(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 ++ @ $(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 + + VSE-static: +- @ $(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 ++ @ $(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 + + VSE-static-debug: +- @ $(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 ++ @ $(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 + + VC-static: +- @ $(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 ++ @ $(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 + + VC-static-debug: +- @ $(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 ++ @ $(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 + + + realclean: clean diff --git a/ports/pthreads/use-mt.patch b/ports/pthreads/use-mt.patch new file mode 100644 index 0000000000..41154e0311 --- /dev/null +++ b/ports/pthreads/use-mt.patch @@ -0,0 +1,33 @@ +diff --git a/Makefile b/Makefile +index a703b9c..502275f 100644 +--- a/Makefile ++++ b/Makefile +@@ -134,22 +134,22 @@ all-tests-mt: + @ echo $@ completed successfully. + + VCE: +- @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).dll ++ @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).dll + + VCE-debug: +- @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).dll ++ @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).dll + + VSE: +- @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VSEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).dll ++ @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VSEFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).dll + + VSE-debug: +- @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).dll ++ @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).dll + + VC: +- @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).dll ++ @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCFLAGS) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).dll + + VC-debug: +- @ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).dll ++ @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).dll + + # + # Static builds diff --git a/ports/pthreads/vcpkg.json b/ports/pthreads/vcpkg.json new file mode 100644 index 0000000000..5a0423fb6d --- /dev/null +++ b/ports/pthreads/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "pthreads", + "version": "3.0.0", + "port-version": 7, + "description": "pthreads for windows", + "homepage": "https://sourceware.org/pub/pthreads-win32/", + "supports": "!(uwp | arm | arm64)" +} diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index b11c3963f0..9b0bd80f47 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1794,6 +1794,7 @@ akali:x64-windows-static-md=fail chromium-base:x64-windows-static-md=fail clockutils:x64-windows-static-md=fail fastcgi:x64-windows-static-md=fail +fontconfig:x64-windows-static-md=fail gmp:x64-windows-static-md=fail ijg-libjpeg:x64-windows-static-md=fail keystone:x64-windows-static-md=fail @@ -1806,8 +1807,8 @@ mmloader:x64-windows-static-md=fail mpg123:x64-windows-static-md=fail netcdf-cxx4:x64-windows-static-md=fail open62541:x64-windows-static-md=fail +openscap:x64-windows-static-md=fail portmidi:x64-windows-static-md=fail -pthreads:x64-windows-static-md=fail quantlib:x64-windows-static-md=fail readosm:x64-windows-static-md=fail sentencepiece:x64-windows-static-md=fail @@ -1817,5 +1818,6 @@ unicorn:x64-windows-static-md=fail v8:x64-windows-static-md=fail yato:x64-windows-static-md=fail zyre:x64-windows-static-md=fail +usbmuxd:x64-windows-static-md=fail workflow:x64-uwp=fail workflow:arm-uwp=fail diff --git a/versions/baseline.json b/versions/baseline.json index 822fd931b5..c1531e7039 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4897,8 +4897,8 @@ "port-version": 0 }, "pthreads": { - "baseline": "3.0.0-6", - "port-version": 0 + "baseline": "3.0.0", + "port-version": 7 }, "pugixml": { "baseline": "1.11.4", diff --git a/versions/p-/pthreads.json b/versions/p-/pthreads.json index d0fdfb8734..c5b9839f55 100644 --- a/versions/p-/pthreads.json +++ b/versions/p-/pthreads.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f76c9c365aff8cf663941bbe6dac93379e856345", + "version": "3.0.0", + "port-version": 7 + }, { "git-tree": "6251ee2f710bfb8fb8c0177c07ef8fc5d7831aec", "version-string": "3.0.0-6",