Skip to content

Commit

Permalink
Auto-update thrift to v0.21.0 (xmake-io#5429)
Browse files Browse the repository at this point in the history
* Update thrift to v0.21.0

* add patch

---------

Co-authored-by: star9029 <[email protected]>
  • Loading branch information
waruqi and star-hengxing authored Oct 7, 2024
1 parent f79c590 commit 540dacc
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
90 changes: 90 additions & 0 deletions packages/t/thrift/patches/0.21.0/cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
diff --git a/build/cmake/DefineInstallationPaths.cmake b/build/cmake/DefineInstallationPaths.cmake
index d6b66e59..a089a790 100644
--- a/build/cmake/DefineInstallationPaths.cmake
+++ b/build/cmake/DefineInstallationPaths.cmake
@@ -22,11 +22,7 @@
set(BIN_INSTALL_DIR "bin" CACHE PATH "The binary install dir (default: bin)")
# For MSVC builds, install shared libs to bin/, while keeping the install
# dir for static libs as lib/.
-if(MSVC AND BUILD_SHARED_LIBS)
- set(LIB_INSTALL_DIR "bin${LIB_SUFFIX}" CACHE PATH "The library install dir (default: bin${LIB_SUFFIX})")
-else()
- set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The library install dir (default: lib${LIB_SUFFIX})")
-endif()
+set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The library install dir (default: lib${LIB_SUFFIX})")
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "The library install dir (default: include)")
set(CMAKE_INSTALL_DIR "lib/cmake" CACHE PATH "The subdirectory to install cmake config files (default: cmake)")
set(PKGCONFIG_INSTALL_DIR "lib/pkgconfig" CACHE PATH "The subdirectory to install pkgconfig config files (default: lib/pkgconfig)")
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index b59292cd3..23caa09fe 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -39,10 +39,7 @@ option(BUILD_LIBRARIES "Build Thrift libraries" ON)
# and enables the library if all are found. This means the default is to build as
# much as possible but leaving out libraries if their dependencies are not met.

-if (NOT Boost_USE_STATIC_LIBS)
- add_definitions(-DBOOST_ALL_DYN_LINK)
- add_definitions(-DBOOST_TEST_DYN_LINK)
-endif()
+

# as3
option(WITH_AS3 "Build ActionScript 3 Thrift Library" ON)
diff --git a/lib/c_glib/CMakeLists.txt b/lib/c_glib/CMakeLists.txt
index 35571233d..ac6fc1d52 100644
--- a/lib/c_glib/CMakeLists.txt
+++ b/lib/c_glib/CMakeLists.txt
@@ -71,7 +71,8 @@ set(thrift_c_glib_zlib_SOURCES
)

# If OpenSSL is not found just ignore the OpenSSL stuff
-if(OPENSSL_FOUND AND WITH_OPENSSL)
+if(WITH_OPENSSL)
+ find_package(OpenSSL REQUIRED)
list(APPEND thrift_c_glib_SOURCES
src/thrift/c_glib/transport/thrift_ssl_socket.c
)
@@ -83,8 +84,7 @@ if(OPENSSL_FOUND AND WITH_OPENSSL)
list(APPEND SYSLIBS OpenSSL::Crypto)
endif()
else()
- include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
- list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}")
+ list(APPEND SYSLIBS OpenSSL::SSL OpenSSL::Crypto)
endif()
endif()

diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index c2f15dd57..3f36a23c1 100644
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -97,7 +97,8 @@ else()
endif()

# If OpenSSL is not found or disabled just ignore the OpenSSL stuff
-if(OPENSSL_FOUND AND WITH_OPENSSL)
+if(WITH_OPENSSL)
+ find_package(OpenSSL REQUIRED)
list(APPEND thriftcpp_SOURCES
src/thrift/transport/TSSLSocket.cpp
src/thrift/transport/TSSLServerSocket.cpp
@@ -112,8 +113,7 @@ if(OPENSSL_FOUND AND WITH_OPENSSL)
list(APPEND SYSLIBS OpenSSL::Crypto)
endif()
else()
- include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
- list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}")
+ list(APPEND SYSLIBS OpenSSL::SSL OpenSSL::Crypto)
endif()
endif()

@@ -174,7 +174,7 @@ if(WITH_LIBEVENT)
target_link_libraries(thriftnb PUBLIC thrift)
if(TARGET libevent::core AND TARGET libevent::extra)
# libevent was found via its cmake config, use modern style targets
- target_link_libraries(thriftnb PUBLIC libevent::core libevent::extra)
+ target_link_libraries(thriftnb PUBLIC libevent::core libevent::extra)
else()
target_link_libraries(thriftnb PUBLIC ${LIBEVENT_LIBRARIES})
endif()
5 changes: 4 additions & 1 deletion packages/t/thrift/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ package("thrift")
add_urls("https://github.com/apache/thrift/archive/refs/tags/$(version).tar.gz",
"https://github.com/apache/thrift.git")

add_versions("v0.21.0", "31e46de96a7b36b8b8a457cecd2ee8266f81a83f8e238a9d324d8c6f42a717bc")
add_versions("v0.20.0", "cd7b829d3d9d87f9f7d708e004eef7629789591ee1d416f4741913bc33e5c27d")
add_versions("v0.19.0", "6428911db505702c51f7d993155a4a4c8afee83fdd021b52f2eccd8d34780629")
add_versions("v0.18.1", "9cea30b9700153329ae1926cc05a20bbe3e8451ae270b0c8c5c5fe9929924cb3")
add_versions("v0.18.0", "b42a659ebe3711a78de4b14a117ea44558106223593c3f09c0d8dbe8a1b26848")
add_versions("v0.17.0", "f5888bcd3b8de40c2c2ab86896867ad9b18510deb412cba3e5da76fb4c604c29")
add_versions("v0.16.0", "df2931de646a366c2e5962af679018bca2395d586e00ba82d09c0379f14f8e7b")

add_patches(">=0.16.0", "patches/0.16.0/cmake.patch", "8dd82f54d52a37487e64aa3529f4dbcedcda671ab46fcb7a8c0f2c521ee0be9b")
add_patches(">=0.21.0", "patches/0.21.0/cmake.patch", "506f7f70d76e092a62e87ada5290410a203241a08ba362eb82afa6200fae0881")
add_patches(">=0.16.0 <=0.20.0", "patches/0.16.0/cmake.patch", "8dd82f54d52a37487e64aa3529f4dbcedcda671ab46fcb7a8c0f2c521ee0be9b")

add_configs("compiler", {description = "Build compiler", default = false, type = "boolean"})

Expand Down Expand Up @@ -70,6 +72,7 @@ package("thrift")
table.insert(configs, "-DBUILD_COMPILER=" .. (package:config("compiler") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DWITH_MT=" .. (package:has_runtime("MT") and "ON" or "OFF"))
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
end
import("package.tools.cmake").install(package, configs)
end)
Expand Down

0 comments on commit 540dacc

Please sign in to comment.