From 0c59106f3196b3519ab738c393d585cc08717b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 25 Jul 2024 11:47:39 +0200 Subject: [PATCH 1/7] GH-43416: [CI] Upgrade our vcpkg version on .env --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 21f904c3208f6..3657ff9f6ef62 100644 --- a/.env +++ b/.env @@ -89,7 +89,7 @@ TZ=UTC # Used through docker-compose.yml and serves as the default version for the # ci/scripts/install_vcpkg.sh script. Prefer to use short SHAs to keep the # docker tags more readable. -VCPKG="943c5ef1c8f6b5e6ced092b242c8299caae2ff01" # 2024.04.26 Release +VCPKG="1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12 Release # This must be updated when we update # ci/docker/python-wheel-windows-vs2019.dockerfile. From e20f9037b7485318157c526f27a6eba4f0c6e152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 25 Jul 2024 12:52:49 +0200 Subject: [PATCH 2/7] Fix patches --- ci/vcpkg/ports.patch | 63 ++++---------------------------------------- 1 file changed, 5 insertions(+), 58 deletions(-) diff --git a/ci/vcpkg/ports.patch b/ci/vcpkg/ports.patch index 67fb2a4a3ea76..c5b8ceae9dcb6 100644 --- a/ci/vcpkg/ports.patch +++ b/ci/vcpkg/ports.patch @@ -29,17 +29,17 @@ index a79c72a59..6b7fa6a66 100644 vcpkg_cmake_install(ADD_BIN_TO_PATH) diff --git a/ports/snappy/portfile.cmake b/ports/snappy/portfile.cmake -index 0c7098082..c603c3653 100644 +index c33046b..14d2ae3 100644 --- a/ports/snappy/portfile.cmake +++ b/ports/snappy/portfile.cmake -@@ -10,6 +10,7 @@ vcpkg_from_github( - PATCHES +@@ -8,6 +8,7 @@ vcpkg_from_github( fix_clang-cl_build.patch no-werror.patch + pkgconfig.diff + "snappy-disable-bmi.patch" ) - - vcpkg_cmake_configure( + file(COPY "${CURRENT_PORT_DIR}/snappy.pc.in" DESTINATION "${SOURCE_PATH}") + diff --git a/ports/snappy/snappy-disable-bmi.patch b/ports/snappy/snappy-disable-bmi.patch new file mode 100644 index 000000000..e839c93a4 @@ -65,56 +65,3 @@ index 000000000..e839c93a4 + } + + static inline bool LeftShiftOverflows(uint8_t value, uint32_t shift) { -diff --git a/ports/thrift/portfile.cmake b/ports/thrift/portfile.cmake -index 1501782..71d2147 100644 ---- a/ports/thrift/portfile.cmake -+++ b/ports/thrift/portfile.cmake -@@ -12,7 +12,7 @@ vcpkg_find_acquire_program(BISON) - vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO apache/thrift -- REF "${VERSION}" -+ REF "v${VERSION}" - SHA512 5e4ee9870b30fe5ba484d39781c435716f7f3903793dc8aae96594ca813b1a5a73363b84719038ca8fa3ab8ef0a419a28410d936ff7b3bbadf36fc085a6883ae - HEAD_REF master - PATCHES -diff --git a/ports/thrift/vcpkg.json b/ports/thrift/vcpkg.json -index 2d5a854..9ff49ec 100644 ---- a/ports/thrift/vcpkg.json -+++ b/ports/thrift/vcpkg.json -@@ -1,6 +1,7 @@ - { - "name": "thrift", - "version": "0.20.0", -+ "port-version": 1, - "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", -diff --git a/versions/baseline.json b/versions/baseline.json -index c6ce736..9ad1d63 100644 ---- a/versions/baseline.json -+++ b/versions/baseline.json -@@ -8622,7 +8622,7 @@ - }, - "thrift": { - "baseline": "0.20.0", -- "port-version": 0 -+ "port-version": 1 - }, - "tidy-html5": { - "baseline": "5.8.0", -diff --git a/versions/t-/thrift.json b/versions/t-/thrift.json -index 3db38c5..7464bde 100644 ---- a/versions/t-/thrift.json -+++ b/versions/t-/thrift.json -@@ -1,5 +1,10 @@ - { - "versions": [ -+ { -+ "git-tree": "13757a6b05741cf3c9c39e3a1dcc5e5cd685e025", -+ "version": "0.20.0", -+ "port-version": 1 -+ }, - { - "git-tree": "6855be1ce96497811d4eb0a9879baf6cf1b3610c", - "version": "0.20.0", From 888022682d21a8db19b12de814b7ef9a3a0c4f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 26 Jul 2024 12:00:22 +0200 Subject: [PATCH 3/7] Apply orc patch in order to make CMake happy --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +++ cpp/cmake_modules/orc.diff | 22 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 cpp/cmake_modules/orc.diff diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 63e2c036c9a6f..4f187aa8e5acb 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -4512,9 +4512,12 @@ function(build_orc) message(STATUS "Building Apache ORC from source") if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.29) + find_program(PATCH patch REQUIRED) + set(ORC_PATCH_COMMAND ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/orc.diff) fetchcontent_declare(orc ${FC_DECLARE_COMMON_OPTIONS} URL ${ORC_SOURCE_URL} + PATCH_COMMAND ${ORC_PATCH_COMMAND} URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}") prepare_fetchcontent() diff --git a/cpp/cmake_modules/orc.diff b/cpp/cmake_modules/orc.diff new file mode 100644 index 0000000000000..a875e75c4fde6 --- /dev/null +++ b/cpp/cmake_modules/orc.diff @@ -0,0 +1,22 @@ +diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake +index aa520ff..01ab294 100644 +--- a/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cmake_modules/ThirdpartyToolchain.cmake +@@ -464,7 +464,7 @@ add_library (orc::protoc ALIAS orc_protoc) + + if (ORC_PACKAGE_KIND STREQUAL "conan") + target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES}) +-elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB}) ++elseif (ORC_PREFER_STATIC_PROTOBUF AND DEFINED PROTOBUF_STATIC_LIB) + target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB}) + else () + target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY}) +@@ -476,7 +476,7 @@ else () + endif () + + if (NOT ORC_PACKAGE_KIND STREQUAL "conan") +- if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB}) ++ if (ORC_PREFER_STATIC_PROTOBUF AND DEFINED PROTOC_STATIC_LIB) + target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB}) + else () + target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY}) From dce3329e1cba73c31dd0843e3e9f8bbe89f29465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 26 Jul 2024 12:27:46 +0200 Subject: [PATCH 4/7] Add license to patch file --- cpp/cmake_modules/orc.diff | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cpp/cmake_modules/orc.diff b/cpp/cmake_modules/orc.diff index a875e75c4fde6..460732c27676f 100644 --- a/cpp/cmake_modules/orc.diff +++ b/cpp/cmake_modules/orc.diff @@ -1,3 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake index aa520ff..01ab294 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake From 4d155c844a7199d721f4246cacd3e059266c0281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 26 Jul 2024 12:43:24 +0200 Subject: [PATCH 5/7] Make Windows happy with the patch --- ci/vcpkg/ports.patch | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/vcpkg/ports.patch b/ci/vcpkg/ports.patch index c5b8ceae9dcb6..91f1a9556e824 100644 --- a/ci/vcpkg/ports.patch +++ b/ci/vcpkg/ports.patch @@ -29,17 +29,19 @@ index a79c72a59..6b7fa6a66 100644 vcpkg_cmake_install(ADD_BIN_TO_PATH) diff --git a/ports/snappy/portfile.cmake b/ports/snappy/portfile.cmake -index c33046b..14d2ae3 100644 +index c33046b..baf2c5e 100644 --- a/ports/snappy/portfile.cmake +++ b/ports/snappy/portfile.cmake -@@ -8,6 +8,7 @@ vcpkg_from_github( +@@ -8,7 +8,9 @@ vcpkg_from_github( fix_clang-cl_build.patch no-werror.patch pkgconfig.diff + "snappy-disable-bmi.patch" ) ++ file(COPY "${CURRENT_PORT_DIR}/snappy.pc.in" DESTINATION "${SOURCE_PATH}") - + + vcpkg_cmake_configure( diff --git a/ports/snappy/snappy-disable-bmi.patch b/ports/snappy/snappy-disable-bmi.patch new file mode 100644 index 000000000..e839c93a4 From a0e017fded71c37ac635dbcac296a2736800db3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 29 Jul 2024 11:00:39 +0200 Subject: [PATCH 6/7] Update patch --- cpp/cmake_modules/orc.diff | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/orc.diff b/cpp/cmake_modules/orc.diff index 460732c27676f..3ee1f64aeb170 100644 --- a/cpp/cmake_modules/orc.diff +++ b/cpp/cmake_modules/orc.diff @@ -24,7 +24,7 @@ index aa520ff..01ab294 100644 if (ORC_PACKAGE_KIND STREQUAL "conan") target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES}) -elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB}) -+elseif (ORC_PREFER_STATIC_PROTOBUF AND DEFINED PROTOBUF_STATIC_LIB) ++elseif (ORC_PREFER_STATIC_PROTOBUF AND PROTOBUF_STATIC_LIB) target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB}) else () target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY}) @@ -33,7 +33,7 @@ index aa520ff..01ab294 100644 if (NOT ORC_PACKAGE_KIND STREQUAL "conan") - if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB}) -+ if (ORC_PREFER_STATIC_PROTOBUF AND DEFINED PROTOC_STATIC_LIB) ++ if (ORC_PREFER_STATIC_PROTOBUF AND PROTOC_STATIC_LIB) target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB}) else () target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY}) From e939b3d3aa14bc3b248612d9bb9fdae1a5e0e645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 30 Jul 2024 11:28:12 +0200 Subject: [PATCH 7/7] New snippet to fix orc --- cpp/cmake_modules/orc.diff | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/cpp/cmake_modules/orc.diff b/cpp/cmake_modules/orc.diff index 3ee1f64aeb170..a4b0557847d88 100644 --- a/cpp/cmake_modules/orc.diff +++ b/cpp/cmake_modules/orc.diff @@ -16,24 +16,25 @@ # under the License. diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake -index aa520ff..01ab294 100644 +index aa520ff..7bd75d1 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake -@@ -464,7 +464,7 @@ add_library (orc::protoc ALIAS orc_protoc) - - if (ORC_PACKAGE_KIND STREQUAL "conan") - target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES}) --elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB}) -+elseif (ORC_PREFER_STATIC_PROTOBUF AND PROTOBUF_STATIC_LIB) - target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB}) +@@ -416,6 +416,18 @@ endif () + if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan") + find_package (Protobuf REQUIRED) + set(PROTOBUF_VENDORED FALSE) ++ if (Protobuf_FOUND AND NOT PROTOBUF_STATIC_LIB) ++ get_target_property (target_type protobuf::libprotobuf TYPE) ++ if (target_type STREQUAL "STATIC_LIBRARY") ++ set(PROTOBUF_STATIC_LIB protobuf::libprotobuf) ++ endif () ++ endif() ++ if (Protobuf_FOUND AND NOT PROTOC_STATIC_LIB) ++ get_target_property (target_type protobuf::libprotoc TYPE) ++ if (target_type STREQUAL "STATIC_LIBRARY") ++ set (PROTOC_STATIC_LIB protobuf::libprotoc) ++ endif () ++ endif() else () - target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY}) -@@ -476,7 +476,7 @@ else () - endif () - - if (NOT ORC_PACKAGE_KIND STREQUAL "conan") -- if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB}) -+ if (ORC_PREFER_STATIC_PROTOBUF AND PROTOC_STATIC_LIB) - target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB}) - else () - target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY}) + set(PROTOBUF_PREFIX "${THIRDPARTY_DIR}/protobuf_ep-install") + set(PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include")