From b466bd598e561aeff6e869104ddb03705f9f2fc1 Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Thu, 8 Apr 2021 06:16:28 +0900 Subject: [PATCH] [pthreads] support ARM arch and UWP platform (#16348) * [pthreads] support ARM/UWP * arm: enable macro __PTW32_PROGCTR * uwp: LINK option /APPCONTAINER * uwp: link with 'kernel32', 'windowsapp' * [pthreads] update baseline and port SHA * [pthreads] extract changes to patch * [pthreads] remove pthreads from ci.baseline.txt * [pthreads] separate uwp patch * update ci.baseline.txt for arm/arm64 * [pthreads] unify patch list * update ci.baseline.txt --- ports/pthreads/fix-arm-macro.patch | 13 +++++++++++++ ports/pthreads/fix-uwp-linkage.patch | 17 +++++++++++++++++ ports/pthreads/portfile.cmake | 17 ++++++++++++----- ports/pthreads/vcpkg.json | 5 ++--- scripts/ci.baseline.txt | 9 ++++++--- versions/baseline.json | 2 +- versions/p-/pthreads.json | 5 +++++ 7 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 ports/pthreads/fix-arm-macro.patch create mode 100644 ports/pthreads/fix-uwp-linkage.patch diff --git a/ports/pthreads/fix-arm-macro.patch b/ports/pthreads/fix-arm-macro.patch new file mode 100644 index 0000000000..559b385794 --- /dev/null +++ b/ports/pthreads/fix-arm-macro.patch @@ -0,0 +1,13 @@ +diff --git a/context.h b/context.h +index 33294c1..318b689 100644 +--- a/context.h ++++ b/context.h +@@ -62,7 +62,7 @@ + #endif + + #if defined(_ARM_) || defined(ARM) || defined(_M_ARM) || defined(_M_ARM64) +-#define PTW32_PROGCTR(Context) ((Context).Pc) ++#define __PTW32_PROGCTR(Context) ((Context).Pc) + #endif + + #if !defined (__PTW32_PROGCTR) diff --git a/ports/pthreads/fix-uwp-linkage.patch b/ports/pthreads/fix-uwp-linkage.patch new file mode 100644 index 0000000000..77d3a5b15a --- /dev/null +++ b/ports/pthreads/fix-uwp-linkage.patch @@ -0,0 +1,17 @@ +diff --git a/implement.h b/implement.h +index 1579376..3a7d29b 100644 +--- a/implement.h ++++ b/implement.h +@@ -36,6 +36,12 @@ + #if !defined(_IMPLEMENT_H) + #define _IMPLEMENT_H + ++#if 1 // The condition should be `defined(__cplusplus_winrt)` when compile option is provided correctly. ++// porvide 2 static libs to resolve link error. 'kernel32' and 'windowsapp' ++#pragma comment(lib, "kernel32") ++#pragma comment(lib, "WindowsApp") ++#endif ++ + #if !defined (__PTW32_CONFIG_H) + # error "config.h was not #included" + #endif diff --git a/ports/pthreads/portfile.cmake b/ports/pthreads/portfile.cmake index 967ff54e10..52dc6c663f 100644 --- a/ports/pthreads/portfile.cmake +++ b/ports/pthreads/portfile.cmake @@ -3,14 +3,19 @@ if(NOT VCPKG_TARGET_IS_WINDOWS) return() endif() -vcpkg_fail_port_install(MESSAGE "${PORT} does not currently support UWP platform nor ARM architectures" ON_TARGET "UWP" ON_ARCH "arm" ) - set(PTHREADS4W_VERSION "3.0.0") +if(VCPKG_TARGET_IS_UWP) + list(APPEND PATCH_FILES fix-uwp-linkage.patch) + # Inject linker option using the `LINK` environment variable + # https://docs.microsoft.com/en-us/cpp/build/reference/linker-options + # https://docs.microsoft.com/en-us/cpp/build/reference/linking#link-environment-variables + set(ENV{LINK} "/APPCONTAINER") +endif() if (VCPKG_CRT_LINKAGE STREQUAL dynamic) - set(PATCH_FILE use-md.patch) + list(APPEND PATCH_FILES use-md.patch) else() - set(PATCH_FILE use-mt.patch) + list(APPEND PATCH_FILES use-mt.patch) endif() vcpkg_from_sourceforge( @@ -18,7 +23,9 @@ vcpkg_from_sourceforge( REPO pthreads4w FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip" SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013 - PATCHES ${PATCH_FILE} + PATCHES + fix-arm-macro.patch + ${PATCH_FILES} ) find_program(NMAKE nmake REQUIRED) diff --git a/ports/pthreads/vcpkg.json b/ports/pthreads/vcpkg.json index 5a0423fb6d..3c5301d766 100644 --- a/ports/pthreads/vcpkg.json +++ b/ports/pthreads/vcpkg.json @@ -1,8 +1,7 @@ { "name": "pthreads", "version": "3.0.0", - "port-version": 7, + "port-version": 8, "description": "pthreads for windows", - "homepage": "https://sourceware.org/pub/pthreads-win32/", - "supports": "!(uwp | arm | arm64)" + "homepage": "https://sourceware.org/pub/pthreads-win32/" } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 1412a023a3..91c098efcc 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -118,6 +118,7 @@ chromium-base:x64-linux=skip civetweb:arm64-windows = skip civetweb:arm-uwp = skip civetweb:x64-uwp = skip +clamav:arm64-windows=fail clblas:arm64-windows=fail clblast:x64-linux=fail clblast:x64-windows-static=fail @@ -177,6 +178,8 @@ cudnn:arm-uwp=fail cudnn:x64-uwp=fail cudnn:x64-windows-static=fail cudnn:x86-windows=fail +darknet:arm64-windows=fail +darknet:arm-uwp=fail # Since pipeline cannot automatically install dbghelp dependency, skip this detection dbghelp:arm-uwp=skip dbghelp:arm64-windows=skip @@ -332,6 +335,9 @@ fmilib:arm64-windows=fail fmilib:arm-uwp=fail fmilib:x64-linux=fail fmilib:x64-uwp=fail +fontconfig:x64-uwp=fail +fontconfig:arm-uwp=fail +fontconfig:arm64-windows=fail foonathan-memory:arm64-windows=fail foonathan-memory:arm-uwp=fail foonathan-memory:x64-uwp=fail @@ -1283,9 +1289,6 @@ protobuf-c:x64-windows-static-md=fail protobuf-c:x64-uwp=fail protobuf-c:arm64-windows=fail protobuf-c:arm-uwp=fail -pthreads:arm64-windows=fail -pthreads:arm-uwp=fail -pthreads:x64-uwp=fail python2:arm64-windows=fail python2:arm-uwp=fail python2:x64-linux=fail diff --git a/versions/baseline.json b/versions/baseline.json index ab595daaae..be96904f68 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4906,7 +4906,7 @@ }, "pthreads": { "baseline": "3.0.0", - "port-version": 7 + "port-version": 8 }, "pugixml": { "baseline": "1.11.4", diff --git a/versions/p-/pthreads.json b/versions/p-/pthreads.json index c5b9839f55..0e84ad5cee 100644 --- a/versions/p-/pthreads.json +++ b/versions/p-/pthreads.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e03999fb593f35daefdea06f7c99af233f3a7f3d", + "version": "3.0.0", + "port-version": 8 + }, { "git-tree": "f76c9c365aff8cf663941bbe6dac93379e856345", "version": "3.0.0",