Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
[submodule "storage/columnstore/columnstore"]
path = storage/columnstore/columnstore
url = https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
[submodule "storage/duckdb/duckdb"]
path = storage/duckdb/duckdb
url = https://github.com/drrtuy/duckdb-engine
5 changes: 5 additions & 0 deletions cmake/make_dist.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ IF(GIT_EXECUTABLE)
IF(NOT RESULT EQUAL 0)
SET(GIT_EXECUTABLE)
ENDIF()
EXECUTE_PROCESS(
COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/storage/duckdb/duckdb/$path/"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/storage/duckdb/duckdb
RESULT_VARIABLE RESULT
)
ENDIF()

CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h
Expand Down
8 changes: 8 additions & 0 deletions debian/autobake-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ then
fi
fi

# Enable DuckDB storage engine plugin packaging
if grep -q "$architecture" storage/duckdb/duckdb/debian/control
then
cp -v storage/duckdb/duckdb/debian/mariadb-plugin-duckdb.* debian/
echo >> debian/control
cat storage/duckdb/duckdb/debian/control >> debian/control
fi

if [ -n "${AUTOBAKE_PREP_CONTROL_RULES_ONLY:-}" ]
then
exit 0
Expand Down
73 changes: 73 additions & 0 deletions storage/duckdb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
IF(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/duckdb/CMakeLists.txt)
return()
ENDIF()

IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
return()
ENDIF()

IF(NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))
return()
ENDIF()

# Check C++17 compiler support
MY_CHECK_CXX_COMPILER_FLAG("-std=c++17")
IF(NOT have_CXX__std_c__17)
MESSAGE(STATUS "DuckDB: C++ compiler does not support -std=c++17, skipping")
RETURN()
ENDIF()

# libduckdb_bundle.a is built without debug STL wrappers.
# Mismatched _GLIBCXX_DEBUG changes sizeof(std::vector) → SIGSEGV.
SET(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -U_GLIBCXX_DEBUG -U_GLIBCXX_ASSERTIONS")

add_subdirectory(duckdb)

IF(TARGET duckdb)
# MTR discovers plugins at storage/<name>/, not storage/<name>/<submodule>/
SET_TARGET_PROPERTIES(duckdb PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
INSTALL_MYSQL_TEST("${CMAKE_CURRENT_SOURCE_DIR}/duckdb/mysql-test/"
"plugin/duckdb")
Comment thread
drrtuy marked this conversation as resolved.

# MYSQL_ADD_PLUGIN runs in storage/duckdb/duckdb/ and bumps CPACK_* vars
# one level up (here). Re-bump them to the root scope so include(CPack)
# sees them. Without this, no MariaDB-duckdb-engine.spec is generated.
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} PARENT_SCOPE)
SET(CPACK_COMPONENT_DUCKDB-ENGINE_GROUP
${CPACK_COMPONENT_DUCKDB-ENGINE_GROUP} PARENT_SCOPE)
SET(CPACK_COMPONENT_DUCKDB-ENGINESYMLINKS_GROUP
${CPACK_COMPONENT_DUCKDB-ENGINESYMLINKS_GROUP} PARENT_SCOPE)
SET(CPACK_RPM_duckdb-engine_PACKAGE_REQUIRES
${CPACK_RPM_duckdb-engine_PACKAGE_REQUIRES} PARENT_SCOPE)

IF(RPM)
SET(CPACK_RPM_duckdb-engine_PACKAGE_SUMMARY
"MariaDB DuckDB storage engine" PARENT_SCOPE)
SET(CPACK_RPM_duckdb-engine_PACKAGE_DESCRIPTION
"The MariaDB DuckDB storage engine embeds DuckDB, an in-process analytical database, as a MariaDB storage engine for fast OLAP queries over local data." PARENT_SCOPE)

# Mark common parent directories as %ignore so the duckdb-engine RPM
# does not claim ownership of dirs owned by MariaDB-server/-common.
# The "%define ignore \#" macro is already set by cmake/cpack_rpm.cmake.
SET(CPACK_RPM_duckdb-engine_USER_FILELIST
"%ignore /etc"
"%ignore /etc/my.cnf.d"
"%ignore /usr"
"%ignore /usr/lib64"
"%ignore /usr/lib64/mysql"
"%ignore /usr/lib64/mysql/plugin"
"%ignore /usr/share"
"%ignore /usr/share/mysql"
PARENT_SCOPE)

# Apply DuckDB-specific CPack overrides at packaging time.
# CPACK_PROJECT_CONFIG_FILE is included by CPack after CPackConfig.cmake,
# letting these settings override the main project's.
SET(CPACK_PROJECT_CONFIG_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/duckdb/cmake/cpack_overrides.cmake"
CACHE FILEPATH "DuckDB CPack overrides" FORCE)
ENDIF()
ENDIF()
1 change: 1 addition & 0 deletions storage/duckdb/duckdb
Submodule duckdb added at a54145
Loading