Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[avro-cpp] Update to latest version (2022-11-07) #27825

Merged
merged 13 commits into from
Nov 21, 2022
Merged
33 changes: 0 additions & 33 deletions ports/avro-cpp/fix-windows-build.patch

This file was deleted.

30 changes: 20 additions & 10 deletions ports/avro-cpp/install.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
index bf764ce4..e84524d0 100644
--- a/lang/c++/CMakeLists.txt
+++ b/lang/c++/CMakeLists.txt
@@ -48,6 +48,8 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
diff --git "a/lang/c++/CMakeLists.txt" "b/lang/c++/CMakeLists.txt"
index 52d6ac8a..39d59cd8 100644
--- "a/lang/c++/CMakeLists.txt"
+++ "b/lang/c++/CMakeLists.txt"
@@ -51,6 +51,8 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
project (Avro-cpp)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})

Expand All @@ -11,7 +11,17 @@ index bf764ce4..e84524d0 100644
if (WIN32 AND NOT CYGWIN AND NOT MSYS)
add_definitions (/EHa)
add_definitions (
@@ -125,12 +127,12 @@ set_target_properties (avrocpp PROPERTIES
@@ -64,7 +66,8 @@ if (WIN32 AND NOT CYGWIN AND NOT MSYS)
endif()

if (CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
+ # Remove " -Werror" because of warning from boost-math (will require C++ 14 soon)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
if (AVRO_ADD_PROTECTOR_FLAGS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector-all -D_GLIBCXX_DEBUG")
# Unset _GLIBCXX_DEBUG for avrogencpp.cc because using Boost Program Options
@@ -131,12 +134,12 @@ set_target_properties (avrocpp PROPERTIES
set_target_properties (avrocpp_s PROPERTIES
VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH})

Expand All @@ -26,7 +36,7 @@ index bf764ce4..e84524d0 100644

macro (gen file ns)
add_custom_command (OUTPUT ${file}.hh
@@ -160,37 +162,42 @@ gen (primitivetypes pt)
@@ -166,37 +169,41 @@ gen (primitivetypes pt)
gen (cpp_reserved_words cppres)

add_executable (avrogencpp impl/avrogencpp.cc)
Expand All @@ -39,8 +49,9 @@ index bf764ce4..e84524d0 100644
+endif()

macro (unittest name)
add_executable (${name} test/${name}.cc)
- add_executable (${name} test/${name}.cc)
- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
+ add_executable (${name} test/${name}.cc impl/json/JsonIO.cc impl/json/JsonDom.cc)
+ target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name})
Expand Down Expand Up @@ -87,12 +98,11 @@ index bf764ce4..e84524d0 100644
+ union_array_union_hh union_map_union_hh union_conflict_hh
+ recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh
+ primitivetypes_hh empty_record_hh)
+
+endif()

include (InstallRequiredSystemLibraries)

@@ -201,9 +208,9 @@ include (CPack)
@@ -207,9 +214,9 @@ include (CPack)
install (TARGETS avrocpp avrocpp_s
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
Expand Down
25 changes: 11 additions & 14 deletions ports/avro-cpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,31 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO apache/avro
REF 2ab8fa85d05f04387bd5d63b10ad1c8fd2243616
SHA512 fd21f0919b0e5e884bdf4d66c4d5ba056f04c426b309ec0b5ab26642a5f6b00d46f4dd965431b10130bc5f0d81699e2195780e90e127f63049ee5763403ef7c8
REF e44b680621328c4e6524bd2983af1ce11afeebed
SHA512 932f642f272997b5c0be467d3a3ccc354c6edf425c36b33aa7e61984f67312c712bb1d74cb1a5fd8066169104851e73830f0ed3fdb450e005a5c5bef33c34f20
HEAD_REF master
MonicaLiu0311 marked this conversation as resolved.
Show resolved Hide resolved
PATCHES
install.patch
fix-windows-build.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
test BUILD_TESTING
INVERTED_FEATURES
snappy CMAKE_DISABLE_FIND_PACKAGE_Snappy
snappy CMAKE_DISABLE_FIND_PACKAGE_Snappy
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/lang/c++
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/lang/c++"
OPTIONS
-DBUILD_TESTING=OFF
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DAVRO_ADD_PROTECTOR_FLAGS=1
)

vcpkg_install_cmake(ADD_BIN_TO_PATH)
vcpkg_cmake_install(ADD_BIN_TO_PATH)

vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL ${SOURCE_PATH}/lang/c++/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/lang/c++/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
9 changes: 9 additions & 0 deletions ports/avro-cpp/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The package avro-cpp can be used from CMake via:

find_path(AVROCPP_INCLUDE_DIRS avro/Encoder.hh)
find_library(AVROCPP_LIBRARY_DEBUG avrocpp PATH_SUFFIXES "debug/lib" REQUIRED)
get_filename_component(AVROCPP_ROOT_FIND_DIR ${AVROCPP_INCLUDE_DIRS} DIRECTORY)
find_library(AVROCPP_LIBRARY_RELEASE avrocpp PATHS "${AVROCPP_ROOT_FIND_DIR}/lib/" REQUIRED NO_DEFAULT_PATH)

target_include_directories(${PROJECT_NAME} PRIVATE "${AVROCPP_INCLUDE_DIRS}")
target_link_libraries(${PROJECT_NAME} PRIVATE optimized "${AVROCPP_LIBRARY_RELEASE}" debug "${AVROCPP_LIBRARY_DEBUG}")
30 changes: 21 additions & 9 deletions ports/avro-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
{
"name": "avro-cpp",
"version-date": "2021-06-01",
"port-version": 1,
"version-date": "2022-11-07",
"description": "Apache Avro is a data serialization system",
"homepage": "https://github.com/apache/avro",
"license": "Apache-2.0",
"supports": "!(windows & static)",
"dependencies": [
"boost-algorithm",
"boost-any",
"boost-crc",
"boost-filesystem",
"boost-format",
"boost-iostreams",
"boost-lexical-cast",
"boost-math",
"boost-program-options",
"boost-random",
"boost-test",
"boost-thread",
"bzip2",
"liblzma",
"libzip",
"zlib",
"zstd"
"boost-tuple",
{
"name": "vcpkg-cmake",
"host": true
},
"zlib"
],
"features": {
"snappy": {
"description": "Support Snappy for compression",
"dependencies": [
"snappy"
]
},
"test": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this feature should exist: vcpkg should not be building tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just following official maintainer-guide, this is an optinal feature which is not build by default. I see that there are already existing a lot of ports with such feature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillyONeal IMO the recommendation needs to be "optional feature", not "this feature shouldn't exist". Given a broad usage of vcpkg ports beyond platforms tested by upstream or vcpkg CI, the lack of an easy way to run tests on demand is a disservice for users.

"description": "Build tests",
"dependencies": [
"boost-asio",
"boost-bind",
"boost-smart-ptr",
"boost-test",
"boost-thread"
]
}
}
}
5 changes: 5 additions & 0 deletions versions/a-/avro-cpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "74c8dbdb975f7a9b5ea80005345e604c89010d39",
"version-date": "2022-11-07",
"port-version": 0
},
{
"git-tree": "7804bfb279bdea0b9e270f010e1683b9b8d7ee38",
"version-date": "2021-06-01",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@
"port-version": 3
},
"avro-cpp": {
"baseline": "2021-06-01",
"port-version": 1
"baseline": "2022-11-07",
"port-version": 0
},
"aws-c-auth": {
"baseline": "0.6.3",
Expand Down