diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/thrift | |
Diffstat (limited to 'vcpkg/ports/thrift')
| -rw-r--r-- | vcpkg/ports/thrift/fix_missing_quotes_in_config_and_bin_path.patch | 51 | ||||
| -rw-r--r-- | vcpkg/ports/thrift/pc-suffix.patch | 44 | ||||
| -rw-r--r-- | vcpkg/ports/thrift/portfile.cmake | 93 | ||||
| -rw-r--r-- | vcpkg/ports/thrift/vcpkg.json | 26 |
4 files changed, 214 insertions, 0 deletions
diff --git a/vcpkg/ports/thrift/fix_missing_quotes_in_config_and_bin_path.patch b/vcpkg/ports/thrift/fix_missing_quotes_in_config_and_bin_path.patch new file mode 100644 index 0000000..e459b6b --- /dev/null +++ b/vcpkg/ports/thrift/fix_missing_quotes_in_config_and_bin_path.patch @@ -0,0 +1,51 @@ +diff --git a/build/cmake/ThriftConfig.cmake.in b/build/cmake/ThriftConfig.cmake.in +index f52480104..616dbeda6 100644 +--- a/build/cmake/ThriftConfig.cmake.in ++++ b/build/cmake/ThriftConfig.cmake.in +@@ -25,8 +25,8 @@ set_and_check(THRIFT_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}") + + set_and_check(THRIFT_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@/thrift") + +-if(@BUILD_COMPILER@) +- set_and_check(THRIFT_BIN_DIR "@PACKAGE_BIN_INSTALL_DIR@") ++if("@BUILD_COMPILER@") ++ set_and_check(THRIFT_BIN_DIR "@PACKAGE_BIN_INSTALL_DIR@/../tools/thrift") + if(NOT DEFINED THRIFT_COMPILER) + set(THRIFT_COMPILER "${THRIFT_BIN_DIR}/thrift@CMAKE_EXECUTABLE_SUFFIX@") + endif() +@@ -37,14 +37,14 @@ if (NOT TARGET thrift::thrift) + endif() + set(THRIFT_LIBRARIES thrift::thrift) + +-if(@ZLIB_FOUND@ AND @WITH_ZLIB@) ++if("@ZLIB_FOUND@" AND "@WITH_ZLIB@") + if (NOT TARGET thriftz::thriftz) + include("${THRIFT_CMAKE_DIR}/thriftzTargets.cmake") + endif() + set(THRIFT_LIBRARIES thriftz::thriftz) + endif() + +-if(@Qt5_FOUND@ AND @WITH_QT5@) ++if("@Qt5_FOUND@" AND "@WITH_QT5@") + if (NOT TARGET thriftqt5::thriftqt5) + include("${THRIFT_CMAKE_DIR}/thriftqt5Targets.cmake") + endif() +@@ -61,15 +61,15 @@ endif() + + include(CMakeFindDependencyMacro) + +-if(@ZLIB_FOUND@ AND @WITH_ZLIB@) ++if("@ZLIB_FOUND@" AND "@WITH_ZLIB@") + find_dependency(ZLIB) + endif() + +-if(@OPENSSL_FOUND@ AND @WITH_OPENSSL@) ++if("@OPENSSL_FOUND@" AND "@WITH_OPENSSL@") + find_dependency(OpenSSL) + endif() + +-if(@Libevent_FOUND@ AND @WITH_LIBEVENT@) ++if("@Libevent_FOUND@" AND "@WITH_LIBEVENT@") + if(DEFINED CMAKE_MODULE_PATH) + set(THRIFT_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH}) + else() diff --git a/vcpkg/ports/thrift/pc-suffix.patch b/vcpkg/ports/thrift/pc-suffix.patch new file mode 100644 index 0000000..8fb0dc6 --- /dev/null +++ b/vcpkg/ports/thrift/pc-suffix.patch @@ -0,0 +1,44 @@ +diff --git a/lib/cpp/thrift-nb.pc.in b/lib/cpp/thrift-nb.pc.in +index 2c6a96973..e99eff2bc 100644 +--- a/lib/cpp/thrift-nb.pc.in ++++ b/lib/cpp/thrift-nb.pc.in +@@ -26,5 +26,5 @@ Name: Thrift + Description: Thrift Nonblocking API + Version: @VERSION@ + Requires: thrift = @VERSION@ +-Libs: -L${libdir} -lthriftnb ++Libs: -L${libdir} -lthriftnb@THRIFT_RUNTIME_POSTFIX@ + Cflags: -I${includedir} +diff --git a/lib/cpp/thrift-qt5.pc.in b/lib/cpp/thrift-qt5.pc.in +index a8b16663e..2720bea79 100644 +--- a/lib/cpp/thrift-qt5.pc.in ++++ b/lib/cpp/thrift-qt5.pc.in +@@ -26,5 +26,5 @@ Name: Thrift + Description: Thrift Qt5 API + Version: @VERSION@ + Requires: thrift = @VERSION@ +-Libs: -L${libdir} -lthriftqt5 ++Libs: -L${libdir} -lthriftqt5@THRIFT_RUNTIME_POSTFIX@ + Cflags: -I${includedir} +diff --git a/lib/cpp/thrift-z.pc.in b/lib/cpp/thrift-z.pc.in +index 467d2e11c..cde44158a 100644 +--- a/lib/cpp/thrift-z.pc.in ++++ b/lib/cpp/thrift-z.pc.in +@@ -26,5 +26,5 @@ Name: Thrift + Description: Thrift Zlib API + Version: @VERSION@ + Requires: thrift = @VERSION@ +-Libs: -L${libdir} -lthriftz ++Libs: -L${libdir} -lthriftz@THRIFT_RUNTIME_POSTFIX@ + Cflags: -I${includedir} +diff --git a/lib/cpp/thrift.pc.in b/lib/cpp/thrift.pc.in +index d11e6db29..77da61c3e 100644 +--- a/lib/cpp/thrift.pc.in ++++ b/lib/cpp/thrift.pc.in +@@ -25,5 +25,5 @@ includedir=@includedir@ + Name: Thrift + Description: Thrift C++ API + Version: @VERSION@ +-Libs: -L${libdir} -lthrift ++Libs: -L${libdir} -lthrift@THRIFT_RUNTIME_POSTFIX@ + Cflags: -I${includedir} diff --git a/vcpkg/ports/thrift/portfile.cmake b/vcpkg/ports/thrift/portfile.cmake new file mode 100644 index 0000000..6bb7c1a --- /dev/null +++ b/vcpkg/ports/thrift/portfile.cmake @@ -0,0 +1,93 @@ +# We currently insist on static only because: +# - Thrift doesn't yet support building as a DLL on Windows, +# - x64-linux only builds static anyway. +# From https://github.com/apache/thrift/blob/master/CHANGES.md +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_find_acquire_program(FLEX) +vcpkg_find_acquire_program(BISON) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO apache/thrift + REF "v${VERSION}" + SHA512 6dedcf48a8900e3a1dabfa73a4577a4d2482527b45ad8b77fec3fa7fdd8ea21b9249b3602c1e3e54bcee98143a9bb325b59e345423dc6dd8c9365889095615e2 + HEAD_REF master + PATCHES + "pc-suffix.patch" + "fix_missing_quotes_in_config_and_bin_path.patch" +) + +if (VCPKG_TARGET_IS_OSX) + message(WARNING "${PORT} requires bison version greater than 2.5,\n\ +please use command \`brew install bison\` to install bison") +endif() + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" shared_lib) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" static_lib) + +# note we specify values for WITH_STATIC_LIB and WITH_SHARED_LIB because even though +# they're marked as deprecated, Thrift incorrectly hard-codes a value for BUILD_SHARED_LIBS. +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + NO_CHARSET_FLAG + OPTIONS + --trace-expand + -DLIB_INSTALL_DIR:PATH=lib + -DWITH_SHARED_LIB=${shared_lib} + -DWITH_STATIC_LIB=${static_lib} + -DBUILD_TESTING=OFF + -DBUILD_JAVA=OFF + -DWITH_C_GLIB=OFF + -DBUILD_C_GLIB=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_GLIB=TRUE + -DBUILD_PYTHON=OFF + -DBUILD_CPP=ON + -DWITH_CPP=ON + -DWITH_ZLIB=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_ZLIB=TRUE + -DWITH_LIBEVENT=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_Libevent=TRUE + -DWITH_OPENSSL=ON + -DCMAKE_REQUIRE_FIND_PACKAGE_OpenSSL=TRUE + -DBUILD_TUTORIALS=OFF + -DFLEX_EXECUTABLE=${FLEX} + -DWITH_QT5=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_Qt5=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_Gradle=TRUE + -DCMAKE_DISABLE_FIND_PACKAGE_Java=TRUE + -DBUILD_JAVASCRIPT=OFF + -DBUILD_NODEJS=OFF + -DBISON_EXECUTABLE=${BISON} + MAYBE_UNUSED_VARIABLES + CMAKE_DISABLE_FIND_PACKAGE_GLIB + CMAKE_DISABLE_FIND_PACKAGE_Gradle + CMAKE_REQUIRE_FIND_PACKAGE_Libevent + CMAKE_REQUIRE_FIND_PACKAGE_OpenSSL + CMAKE_REQUIRE_FIND_PACKAGE_ZLIB + +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +# Move CMake config files to the right place +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") +vcpkg_fixup_pkgconfig() + +file(GLOB COMPILER "${CURRENT_PACKAGES_DIR}/bin/thrift" "${CURRENT_PACKAGES_DIR}/bin/thrift.exe") +if(COMPILER) + vcpkg_copy_tools(TOOL_NAMES thrift AUTO_CLEAN) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + +if ("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") +endif() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/thrift/vcpkg.json b/vcpkg/ports/thrift/vcpkg.json new file mode 100644 index 0000000..7cd5e20 --- /dev/null +++ b/vcpkg/ports/thrift/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "thrift", + "version": "0.22.0", + "description": "Apache Thrift is a software project spanning a variety of programming languages and use cases. Our goal is to make reliable, performant communication and data serialization across languages as efficient and seamless as possible.", + "homepage": "https://github.com/apache/thrift", + "license": "Apache-2.0", + "dependencies": [ + "boost-date-time", + "boost-locale", + "boost-range", + "boost-scope-exit", + "boost-smart-ptr", + "boost-uuid", + "libevent", + "openssl", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ] +} |