From 8582ea0567fb5a26b2084bbaccfd2a8f46bcb29a Mon Sep 17 00:00:00 2001 From: chausner Date: Sun, 14 Nov 2021 22:54:34 +0100 Subject: [PATCH 1/7] Update protobuf-c to 1.4.0 --- ports/protobuf-c/fix-features.patch | 62 -------------------------- ports/protobuf-c/fix-usage-issue.patch | 36 --------------- ports/protobuf-c/portfile.cmake | 38 +++++++++------- ports/protobuf-c/vcpkg.json | 13 +++--- 4 files changed, 31 insertions(+), 118 deletions(-) delete mode 100644 ports/protobuf-c/fix-features.patch delete mode 100644 ports/protobuf-c/fix-usage-issue.patch diff --git a/ports/protobuf-c/fix-features.patch b/ports/protobuf-c/fix-features.patch deleted file mode 100644 index 89b2dd43201763..00000000000000 --- a/ports/protobuf-c/fix-features.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt -index bc1728f..7c6a04d 100644 ---- a/build-cmake/CMakeLists.txt -+++ b/build-cmake/CMakeLists.txt -@@ -61,11 +61,15 @@ if (MSVC AND MSVC_STATIC_BUILD) - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - endif (MSVC AND MSVC_STATIC_BUILD) -+ -+IF(WITH_TOOLS) - FILE(GLOB PROTOC_GEN_C_SRC ${MAIN_DIR}/protoc-c/*.h ${MAIN_DIR}/protoc-c/*.cc ) - ADD_EXECUTABLE(protoc-gen-c ${PROTOC_GEN_C_SRC}) - - TARGET_LINK_LIBRARIES(protoc-gen-c ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY}) -+ENDIF() - -+IF(WITH_TEST AND WITH_TOOLS) - IF(CMAKE_HOST_UNIX) - ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ln -sf protoc-gen-c protoc-c -@@ -79,8 +83,6 @@ FUNCTION(GENERATE_TEST_SOURCES PROTO_FILE SRC HDR) - DEPENDS protoc-gen-c) - ENDFUNCTION() - -- --IF(CMAKE_BUILD_TYPE MATCHES Debug) - ENABLE_TESTING() - - GENERATE_TEST_SOURCES(${TEST_DIR}/test.proto t/test.pb-c.c t/test.pb-c.h) -@@ -126,17 +128,17 @@ GENERATE_TEST_SOURCES(${TEST_DIR}/test-proto3.proto t/test-proto3.pb-c.c t/test- - ADD_EXECUTABLE(test-generated-code3 ${TEST_DIR}/generated-code/test-generated-code.c t/test-proto3.pb-c.c t/test-proto3.pb-c.h) - TARGET_COMPILE_DEFINITIONS(test-generated-code3 PUBLIC -DPROTO3) - TARGET_LINK_LIBRARIES(test-generated-code3 protobuf-c) -- - ENDIF() - --INSTALL(TARGETS protoc-gen-c protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) --INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c) --INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include) -+IF (WITH_TOOLS) -+INSTALL(TARGETS protoc-gen-c RUNTIME DESTINATION tools LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ENDIF() - - IF(CMAKE_HOST_UNIX) - INSTALL(CODE "EXECUTE_PROCESS (COMMAND ln -sf protoc-gen-c protoc-c WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)") - ENDIF() - -+IF (WITH_TEST) - INCLUDE(Dart) - - SET(DART_TESTING_TIMEOUT 5) -@@ -147,5 +149,10 @@ ADD_TEST(test-issue220 test-issue220) - ADD_TEST(test-issue251 test-issue251) - ADD_TEST(test-version test-version) - -+ENDIF() -+ -+INSTALL(TARGETS protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c) -+INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include) - - INCLUDE(CPack) diff --git a/ports/protobuf-c/fix-usage-issue.patch b/ports/protobuf-c/fix-usage-issue.patch deleted file mode 100644 index ce5e4cfa212c3a..00000000000000 --- a/ports/protobuf-c/fix-usage-issue.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt -index 7c6a04d..83534cb 100644 ---- a/build-cmake/CMakeLists.txt -+++ b/build-cmake/CMakeLists.txt -@@ -14,6 +14,11 @@ option(BUILD_PROTO3 "BUILD_PROTO3" ON) - INCLUDE(TestBigEndian) - TEST_BIG_ENDIAN(WORDS_BIGENDIAN) - -+ -+IF(CMAKE_HOST_UNIX) -+ FIND_PACKAGE(Threads REQUIRED) -+ENDIF() -+ - SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") - ADD_DEFINITIONS(-DPACKAGE_VERSION="${PACKAGE_VERSION}") - ADD_DEFINITIONS(-DPACKAGE_STRING="${PACKAGE_STRING}") -@@ -67,6 +72,9 @@ FILE(GLOB PROTOC_GEN_C_SRC ${MAIN_DIR}/protoc-c/*.h ${MAIN_DIR}/protoc-c/*.cc ) - ADD_EXECUTABLE(protoc-gen-c ${PROTOC_GEN_C_SRC}) - - TARGET_LINK_LIBRARIES(protoc-gen-c ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY}) -+IF(CMAKE_HOST_UNIX) -+ TARGET_LINK_LIBRARIES(protoc-gen-c ${CMAKE_THREAD_LIBS_INIT}) -+ENDIF() - ENDIF() - - IF(WITH_TEST AND WITH_TOOLS) -@@ -99,6 +107,9 @@ GENERATE_TEST_SOURCES(${TEST_DIR}/test-full.proto t/test-full.pb-c.c t/test-full - - ADD_EXECUTABLE(cxx-generate-packed-data ${TEST_DIR}/generated-code2/cxx-generate-packed-data.cc t/test-full.pb.h t/test-full.pb.cc) - TARGET_LINK_LIBRARIES(cxx-generate-packed-data ${PROTOBUF_LIBRARY}) -+IF (CMAKE_HOST_UNIX) -+ TARGET_LINK_LIBRARIES(cxx-generate-packed-data ${CMAKE_THREAD_LIBS_INIT}) -+ENDIF() - - FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/t/generated-code2) - ADD_CUSTOM_COMMAND(OUTPUT t/generated-code2/test-full-cxx-output.inc diff --git a/ports/protobuf-c/portfile.cmake b/ports/protobuf-c/portfile.cmake index 98f7035f642cff..25b44b19f30240 100644 --- a/ports/protobuf-c/portfile.cmake +++ b/ports/protobuf-c/portfile.cmake @@ -1,32 +1,40 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO protobuf-c/protobuf-c - REF 1390409f4ee4e26d0635310995b516eb702c3f9e #1.3.2 - SHA512 5c60883c4ef064c641875bfe7f89bf255a29dd20b5e0be5878cbaec03f2efd1f926c3e40dc0090cb172b8eef227fddafe86051f08edb3e1c26d0bd6aca673e41 + REF v1.4.0 + SHA512 cba4c6116c0f2ebb034236e8455d493bfaa2517733befcd87b6f8d6d3df0c0149b17fcbf59cd1763fa2318119c664d0dae3d2d3a46ebfe2a0fec3ef4719b033b HEAD_REF master - PATCHES - fix-features.patch - fix-usage-issue.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - tools WITH_TOOLS - test WITH_TEST + FEATURES + tools BUILD_PROTOC + test BUILD_TESTS ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH}/build-cmake - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/build-cmake" DISABLE_PARALLEL_CONFIGURE OPTIONS ${FEATURE_OPTIONS} ) -vcpkg_install_cmake() +vcpkg_cmake_install(ADD_BIN_TO_PATH) +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES protoc-gen-c + AUTO_CLEAN + ) +endif() # Include files should not be duplicated into the /debug/include directory. -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# Remove duplicate PDB files (vcpkg_copy_pdbs already copied them to "bin") +file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/protobuf-c.pdb") +file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/protobuf-c.pdb") # Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) \ No newline at end of file diff --git a/ports/protobuf-c/vcpkg.json b/ports/protobuf-c/vcpkg.json index 548cce39b6c9a7..73fbd998299e2e 100644 --- a/ports/protobuf-c/vcpkg.json +++ b/ports/protobuf-c/vcpkg.json @@ -1,15 +1,18 @@ { "name": "protobuf-c", - "version-string": "1.3.2", - "port-version": 3, + "version-semver": "1.4.0", "description": "This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format.", "homepage": "https://github.com/protobuf-c/protobuf-c", "dependencies": [ - "protobuf" + "protobuf", + { + "name": "vcpkg-cmake", + "host": true + } ], "features": { "test": { - "description": "build test project.", + "description": "Build test project.", "dependencies": [ { "name": "protobuf-c", @@ -20,7 +23,7 @@ ] }, "tools": { - "description": "build tools." + "description": "Build tools (protoc-gen-c)." } } } From 182b070d885070a885861463aa3f725031bc987a Mon Sep 17 00:00:00 2001 From: chausner Date: Sun, 14 Nov 2021 22:54:35 +0100 Subject: [PATCH 2/7] Update CI baseline --- versions/baseline.json | 4 ++-- versions/p-/protobuf-c.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index e311661f8f5377..8ce1c9d9427ebd 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5377,8 +5377,8 @@ "port-version": 0 }, "protobuf-c": { - "baseline": "1.3.2", - "port-version": 3 + "baseline": "1.4.0", + "port-version": 0 }, "protopuf": { "baseline": "2.1.0", diff --git a/versions/p-/protobuf-c.json b/versions/p-/protobuf-c.json index 886b4ec8d5644f..382136a16dfbff 100644 --- a/versions/p-/protobuf-c.json +++ b/versions/p-/protobuf-c.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "7694ae901baa567336d843221749212ff0c76f80", + "version-semver": "1.4.0", + "port-version": 0 + }, { "git-tree": "7786538f69991494262bd14f710e2dd8c6062bea", "version-string": "1.3.2", From c66378dc4bc94f6d33bb4b25f1053783dceba243 Mon Sep 17 00:00:00 2001 From: chausner Date: Sun, 14 Nov 2021 22:56:43 +0100 Subject: [PATCH 3/7] Remove entries from CI baseline --- scripts/ci.baseline.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index bbcb9d010a8a1d..7c5b957046b5e3 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1193,13 +1193,6 @@ poppler:arm64-windows=fail portable-snippets:arm-uwp=fail pqp:arm-uwp=fail pqp:x64-uwp=fail -protobuf-c:x86-windows=fail -protobuf-c:x64-windows=fail -protobuf-c:x64-windows-static=fail -protobuf-c:x64-windows-static-md=fail -protobuf-c:x64-uwp=fail -protobuf-c:arm64-windows=fail -protobuf-c:arm-uwp=fail python2:arm64-windows=fail python2:arm-uwp=fail python2:x64-uwp=fail From a2423d54917f9d0b0a05ba804f1fa5e9b616cbb8 Mon Sep 17 00:00:00 2001 From: chausner Date: Sun, 14 Nov 2021 23:04:59 +0100 Subject: [PATCH 4/7] Fix CRT linkage --- ports/protobuf-c/fix-crt-linkage.patch | 27 ++++++++++++++++++++++++++ ports/protobuf-c/portfile.cmake | 6 ++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 ports/protobuf-c/fix-crt-linkage.patch diff --git a/ports/protobuf-c/fix-crt-linkage.patch b/ports/protobuf-c/fix-crt-linkage.patch new file mode 100644 index 00000000000000..5b0ea24c390ef3 --- /dev/null +++ b/ports/protobuf-c/fix-crt-linkage.patch @@ -0,0 +1,27 @@ +diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt +--- a/build-cmake/CMakeLists.txt ++++ b/build-cmake/CMakeLists.txt +@@ -70,23 +70,6 @@ if (BUILD_PROTO3) + endif() + ENDIF() + +-if (MSVC AND NOT BUILD_SHARED_LIBS) +- # In case we are building static libraries, link also the runtime library statically +- # so that MSVCR*.DLL is not required at runtime. +- # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx +- # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd +- # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F +- foreach(flag_var +- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE +- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO +- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE +- CMAKE_C_FLAGS_MINSIZEREL CMAKE_FLAGS_RELWITHDEBINFO) +- if(${flag_var} MATCHES "/MD") +- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") +- endif(${flag_var} MATCHES "/MD") +- endforeach(flag_var) +-endif (MSVC AND NOT BUILD_SHARED_LIBS) +- + IF(BUILD_PROTOC) + SET(CMAKE_CXX_STANDARD 11) + SET(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/ports/protobuf-c/portfile.cmake b/ports/protobuf-c/portfile.cmake index 25b44b19f30240..4bcce7017d18cc 100644 --- a/ports/protobuf-c/portfile.cmake +++ b/ports/protobuf-c/portfile.cmake @@ -1,9 +1,11 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO protobuf-c/protobuf-c - REF v1.4.0 - SHA512 cba4c6116c0f2ebb034236e8455d493bfaa2517733befcd87b6f8d6d3df0c0149b17fcbf59cd1763fa2318119c664d0dae3d2d3a46ebfe2a0fec3ef4719b033b + REF v1.4.0 + SHA512 cba4c6116c0f2ebb034236e8455d493bfaa2517733befcd87b6f8d6d3df0c0149b17fcbf59cd1763fa2318119c664d0dae3d2d3a46ebfe2a0fec3ef4719b033b HEAD_REF master + PATCHES + fix-crt-linkage.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS From 9ab0e811223378391f1a6bcf39b70b9daf3f780e Mon Sep 17 00:00:00 2001 From: chausner Date: Sun, 14 Nov 2021 23:05:09 +0100 Subject: [PATCH 5/7] Update CI baseline --- versions/p-/protobuf-c.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/p-/protobuf-c.json b/versions/p-/protobuf-c.json index 382136a16dfbff..f9cebae06a7752 100644 --- a/versions/p-/protobuf-c.json +++ b/versions/p-/protobuf-c.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "7694ae901baa567336d843221749212ff0c76f80", + "git-tree": "247c52927f762102352f1f6f383d505ef160aca0", "version-semver": "1.4.0", "port-version": 0 }, From dbd88961a035da115b6457fbe58d81968026f659 Mon Sep 17 00:00:00 2001 From: chausner Date: Mon, 15 Nov 2021 18:50:18 +0100 Subject: [PATCH 6/7] Minimize patch --- ports/protobuf-c/fix-crt-linkage.patch | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/ports/protobuf-c/fix-crt-linkage.patch b/ports/protobuf-c/fix-crt-linkage.patch index 5b0ea24c390ef3..974c6e6200ab9f 100644 --- a/ports/protobuf-c/fix-crt-linkage.patch +++ b/ports/protobuf-c/fix-crt-linkage.patch @@ -1,27 +1,12 @@ diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt --- a/build-cmake/CMakeLists.txt +++ b/build-cmake/CMakeLists.txt -@@ -70,23 +70,6 @@ if (BUILD_PROTO3) +@@ -70,7 +70,7 @@ if (BUILD_PROTO3) endif() ENDIF() -if (MSVC AND NOT BUILD_SHARED_LIBS) -- # In case we are building static libraries, link also the runtime library statically -- # so that MSVCR*.DLL is not required at runtime. -- # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx -- # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd -- # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F -- foreach(flag_var -- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE -- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO -- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE -- CMAKE_C_FLAGS_MINSIZEREL CMAKE_FLAGS_RELWITHDEBINFO) -- if(${flag_var} MATCHES "/MD") -- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") -- endif(${flag_var} MATCHES "/MD") -- endforeach(flag_var) --endif (MSVC AND NOT BUILD_SHARED_LIBS) -- - IF(BUILD_PROTOC) - SET(CMAKE_CXX_STANDARD 11) - SET(CMAKE_CXX_STANDARD_REQUIRED ON) ++if (0) + # In case we are building static libraries, link also the runtime library statically + # so that MSVCR*.DLL is not required at runtime. + # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx From faff2ac4b74c8db564accdb284783dea6de76dc9 Mon Sep 17 00:00:00 2001 From: chausner Date: Mon, 15 Nov 2021 18:50:26 +0100 Subject: [PATCH 7/7] Update CI baseline --- versions/p-/protobuf-c.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/p-/protobuf-c.json b/versions/p-/protobuf-c.json index f9cebae06a7752..7d592e5993b3ab 100644 --- a/versions/p-/protobuf-c.json +++ b/versions/p-/protobuf-c.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "247c52927f762102352f1f6f383d505ef160aca0", + "git-tree": "649c1df0b6207662ec75fed4bbd999a7a42afb4b", "version-semver": "1.4.0", "port-version": 0 },