[duckdb] new port (#43717)

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Matthias Kuhn 2025-02-12 19:06:03 +01:00 committed by GitHub
parent 33e9c99208
commit cefd534f32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 212 additions and 0 deletions

14
ports/duckdb/bigobj.patch Normal file
View File

@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2624479..4496860 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -727,6 +727,9 @@ function(add_library_unity NAME MODE)
enable_unity_build(${NAME} SRCS)
endif()
add_library(${NAME} OBJECT ${SRCS})
+ if(MSVC)
+ target_compile_options(${NAME} PRIVATE /bigobj)
+ endif()
endfunction()
function(disable_target_warnings NAME)

View File

@ -0,0 +1,72 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO duckdb/duckdb
REF v${VERSION}
SHA512 f5bca7a3b6f763b4b1a1f39e53c6f818925584fb44886e291ac3546fe50de545e80d16b4120f0126020e44b601a1b9193f4faad7a3dc8799cda843b1965038f2
HEAD_REF master
PATCHES
bigobj.patch
unvendor_icu_and_find_dependency.patch # https://github.com/duckdb/duckdb/pull/16176 + https://github.com/duckdb/duckdb/pull/16197
)
# Remove vendored dependencies which are not properly namespaced
file(REMOVE_RECURSE
"${SOURCE_PATH}/third_party/catch"
"${SOURCE_PATH}/third_party/imdb"
"${SOURCE_PATH}/third_party/snowball"
"${SOURCE_PATH}/third_party/tpce-tool"
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" DUCKDB_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" DUCKDB_BUILD_DYNAMIC)
set(EXTENSION_LIST "autocomplete;httpfs;icu;json;tpcds;tpch")
set(BUILD_EXTENSIONS "")
foreach(EXT ${EXTENSION_LIST})
if(${EXT} IN_LIST FEATURES)
list(APPEND BUILD_EXTENSIONS ${EXT})
endif()
endforeach()
if(NOT "${BUILD_EXTENSIONS}" STREQUAL "")
set(BUILD_EXTENSIONS_FLAG "-DBUILD_EXTENSIONS='${BUILD_EXTENSIONS}'")
endif()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DOVERRIDE_GIT_DESCRIBE=v${VERSION}
-DDUCKDB_EXPLICIT_VERSION=v${VERSION}
-DBUILD_UNITTESTS=OFF
-DBUILD_SHELL=FALSE
"${BUILD_EXTENSIONS_FLAG}"
-DENABLE_EXTENSION_AUTOLOADING=1
-DENABLE_EXTENSION_AUTOINSTALL=1
-DWITH_INTERNAL_ICU=OFF
-DENABLE_SANITIZER=OFF
-DENABLE_THREAD_SANITIZER=OFF
-DENABLE_UBSAN=OFF
)
vcpkg_cmake_install()
if(EXISTS "${CURRENT_PACKAGES_DIR}/CMake")
vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
elseif(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/DuckDB")
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/DuckDB")
elseif(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/${PORT}")
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/include/duckdb/main/capi/header_generation"
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/duckdb/storage/serialization")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -0,0 +1,62 @@
diff --git a/DuckDBConfig.cmake.in b/DuckDBConfig.cmake.in
index ef61b6b..2e5270e 100644
--- a/DuckDBConfig.cmake.in
+++ b/DuckDBConfig.cmake.in
@@ -4,6 +4,12 @@
# DuckDB_INCLUDE_DIRS - include directories for DuckDB
# DuckDB_LIBRARIES - libraries to link against
+include(CMakeFindDependencyMacro)
+find_dependency(Threads)
+if(NOT @WITH_INTERNAL_ICU@)
+ find_dependency(ICU COMPONENTS i18n uc)
+endif()
+
# Compute paths
get_filename_component(DuckDB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(DuckDB_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
diff --git a/extension/icu/CMakeLists.txt b/extension/icu/CMakeLists.txt
index 65cbe38..6a38f93 100644
--- a/extension/icu/CMakeLists.txt
+++ b/extension/icu/CMakeLists.txt
@@ -3,10 +3,13 @@ cmake_minimum_required(VERSION 2.8.12...3.29)
project(ICUExtension)
include_directories(include)
-include_directories(third_party/icu/common)
-include_directories(third_party/icu/i18n)
+option(WITH_INTERNAL_ICU "Use vendored copy of icu" TRUE)
+if(WITH_INTERNAL_ICU)
+ include_directories(third_party/icu/common)
+ include_directories(third_party/icu/i18n)
-add_subdirectory(third_party)
+ add_subdirectory(third_party)
+endif()
set(ICU_EXTENSION_FILES
${ICU_LIBRARY_FILES}
@@ -26,6 +29,10 @@ set(ICU_EXTENSION_FILES
build_static_extension(icu ${ICU_EXTENSION_FILES})
link_threads(icu_extension)
+if(NOT WITH_INTERNAL_ICU)
+ find_package(ICU COMPONENTS i18n uc REQUIRED)
+ target_link_libraries(icu_extension ICU::i18n ICU::uc)
+endif()
disable_target_warnings(icu_extension)
set(PARAMETERS "-no-warnings")
build_loadable_extension(icu ${PARAMETERS} ${ICU_EXTENSION_FILES})
diff --git a/extension/icu/icu-datefunc.cpp b/extension/icu/icu-datefunc.cpp
index 995f594..a8092b6 100644
--- a/extension/icu/icu-datefunc.cpp
+++ b/extension/icu/icu-datefunc.cpp
@@ -72,7 +72,7 @@ unique_ptr<FunctionData> ICUDateFunc::Bind(ClientContext &context, ScalarFunctio
}
void ICUDateFunc::SetTimeZone(icu::Calendar *calendar, const string_t &tz_id) {
- auto tz = icu_66::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(icu::StringPiece(tz_id.GetString())));
+ auto tz = icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(icu::StringPiece(tz_id.GetString())));
if (*tz == icu::TimeZone::getUnknown()) {
delete tz;
throw NotImplementedException("Unknown TimeZone '%s'", tz_id.GetString());

4
ports/duckdb/usage Normal file
View File

@ -0,0 +1,4 @@
The package DuckDB provides CMake targets:
find_package(DuckDB CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:duckdb>,duckdb,duckdb_static>)

47
ports/duckdb/vcpkg.json Normal file
View File

@ -0,0 +1,47 @@
{
"name": "duckdb",
"version": "1.2.0",
"description": "High-performance in-process analytical database system",
"homepage": "https://duckdb.org",
"license": "MIT",
"supports": "!(uwp | android | (windows & arm64))",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"autocomplete": {
"description": "Statically link the autocomplete extension into DuckDB"
},
"httpfs": {
"description": "Statically link the httpfs extension into DuckDB",
"dependencies": [
"openssl"
]
},
"icu": {
"description": "Statically link the icu extension into DuckDB",
"dependencies": [
{
"name": "icu",
"default-features": false
}
]
},
"json": {
"description": "Statically link the json extension into DuckDB"
},
"tpcds": {
"description": "Statically link the tpcds extension into DuckDB"
},
"tpch": {
"description": "Statically link the tpch extension into DuckDB"
}
}
}

View File

@ -2420,6 +2420,10 @@
"baseline": "1.21",
"port-version": 0
},
"duckdb": {
"baseline": "1.2.0",
"port-version": 0
},
"duckx": {
"baseline": "1.2.2",
"port-version": 1

9
versions/d-/duckdb.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "02e6c406fafcd36a23c51998c14c1e95653b2254",
"version": "1.2.0",
"port-version": 0
}
]
}