From 59c519f93bb99b8ce01930b0acebafb34db78832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Mon, 28 Dec 2020 13:19:50 -0800 Subject: [protobuf] Fix the default proto file path (#15246) --- ports/protobuf/CONTROL | 1 + ports/protobuf/fix-default-proto-file-path.patch | 20 ++++++++++++++++++++ ports/protobuf/portfile.cmake | 1 + 3 files changed, 22 insertions(+) create mode 100644 ports/protobuf/fix-default-proto-file-path.patch diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL index 7d67ac742..967503724 100644 --- a/ports/protobuf/CONTROL +++ b/ports/protobuf/CONTROL @@ -1,5 +1,6 @@ Source: protobuf Version: 3.14.0 +Port-Version: 1 Homepage: https://github.com/protocolbuffers/protobuf Description: Protocol Buffers - Google's data interchange format diff --git a/ports/protobuf/fix-default-proto-file-path.patch b/ports/protobuf/fix-default-proto-file-path.patch new file mode 100644 index 000000000..a5af918b3 --- /dev/null +++ b/ports/protobuf/fix-default-proto-file-path.patch @@ -0,0 +1,20 @@ +diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc +index f192ae6..22900ed 100644 +--- a/src/google/protobuf/compiler/command_line_interface.cc ++++ b/src/google/protobuf/compiler/command_line_interface.cc +@@ -260,11 +260,15 @@ void AddDefaultProtoPaths( + return; + } + // Check if the upper level directory has an "include" subdirectory. ++ // change "'$/bin' is next to 'include'" assumption to "'$/bin/tools' is next to 'include'" ++ for (int i = 0; i < 2; i++) ++ { + pos = path.find_last_of("/\\"); + if (pos == std::string::npos || pos == 0) { + return; + } + path = path.substr(0, pos); ++ } + if (IsInstalledProtoPath(path + "/include")) { + paths->push_back( + std::pair("", path + "/include")); diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index d364878db..a79a34ef8 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-static-build.patch + fix-default-proto-file-path.patch ) if(CMAKE_HOST_WIN32 AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x86") -- cgit v1.2.3