From 09665bfd0e83efbc6c67f14852800fb4a0fe1e13 Mon Sep 17 00:00:00 2001 From: Jani Tolonen Date: Wed, 23 Jan 2013 15:52:59 +0100 Subject: [PATCH] MDEV-3931 Cassandra SE packaging Added autodetection for thrift library and includes Added Cassandra Storage Engine rpm --- cmake/cpack_rpm.cmake | 4 +- storage/cassandra/CMakeLists.txt | 67 ++++++++++++++++++++------------ storage/cassandra/cassandra.cnf | 2 + 3 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 storage/cassandra/cassandra.cnf diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index f5017d6c984..94cac6526d9 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -20,12 +20,13 @@ SET(CPACK_COMPONENT_CLIENT_GROUP "client") SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client") SET(CPACK_COMPONENT_README_GROUP "server") SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared") +SET(CPACK_COMPONENT_CASSANDRASELIBRARIES_GROUP "CassandraSE") SET(CPACK_COMPONENT_COMMON_GROUP "common") SET(CPACK_COMPONENT_COMPAT_GROUP "compat") SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts SupportFiles Development ManPagesDevelopment ManPagesTest Readme ManPagesClient Test - Common Client SharedLibraries) + Common Client SharedLibraries CassandraSE) SET(CPACK_RPM_PACKAGE_NAME "MariaDB") SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") @@ -63,6 +64,7 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE} ") SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common") +SET(CPACK_RPM_CassandraSE_PACKAGE_REQUIRES "MariaDB-server") SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d" "%config(noreplace) /etc/my.cnf.d/*") SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf") diff --git a/storage/cassandra/CMakeLists.txt b/storage/cassandra/CMakeLists.txt index 98644b7798b..2fca1803d3c 100644 --- a/storage/cassandra/CMakeLists.txt +++ b/storage/cassandra/CMakeLists.txt @@ -1,32 +1,49 @@ +# use the first path that has Thrift.h included, if found +FIND_PATH(Thrift_INCLUDE_DIRS Thrift.h PATHS +$ENV{THRIFT_INCLUDE} # environment variable to be used optionally +${Thrift_INCLUDE_DIR} # this may be set +/usr/local/include/thrift # list of additional directories to look from +/opt/local/include/thrift +/usr/include/thrift +/opt/include/thrift +) -IF(NOT WITH_CASSANDRA_STORAGE_ENGINE) - SET(WITHOUT_CASSANDRA 1) -ENDIF(NOT WITH_CASSANDRA_STORAGE_ENGINE) +# Verify that thrift linking library is found +FIND_LIBRARY(Thrift_LIBS NAMES thrift PATHS ${Thrift_LIB_PATHS} ${Thrift_LIB}) +IF(EXISTS ${Thrift_LIBS}) + GET_FILENAME_COMPONENT(LINK_DIR ${Thrift_LIBS} PATH ABSOLUTE) +ELSE() + RETURN() +ENDIF() +INCLUDE_DIRECTORIES(AFTER ${Thrift_INCLUDE_DIRS}) +SET(CMAKE_REQUIRED_INCLUDES ${Thrift_INCLUDE_DIRS}) -SET(cassandra_sources - ha_cassandra.cc - ha_cassandra.h - cassandra_se.h - cassandra_se.cc - gen-cpp/Cassandra.cpp - gen-cpp/cassandra_types.h - gen-cpp/cassandra_types.cpp - gen-cpp/cassandra_constants.h - gen-cpp/cassandra_constants.cpp - gen-cpp/Cassandra.h) +CHECK_CXX_SOURCE_COMPILES( +" +#include +int main() { return 0; } +" CASSANDRASE_OK) -#INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) +IF(CASSANDRASE_OK) + SET(cassandra_sources + ha_cassandra.cc + ha_cassandra.h + cassandra_se.h + cassandra_se.cc + gen-cpp/Cassandra.cpp + gen-cpp/cassandra_types.h + gen-cpp/cassandra_types.cpp + gen-cpp/cassandra_constants.h + gen-cpp/cassandra_constants.cpp + gen-cpp/Cassandra.h) -#INCLUDE_DIRECTORIES(AFTER /usr/local/include/thrift) -INCLUDE_DIRECTORIES(AFTER /home/buildbot/build/thrift-inst/include/thrift/) -#INCLUDE_DIRECTORIES(AFTER /home/psergey/cassandra/thrift/include/thrift/) + STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + LINK_DIRECTORIES(${LINK_DIR}) -# -STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -#LINK_DIRECTORIES(/home/psergey/cassandra/thrift/lib) - -MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift) -# was: STORAGE_ENGINE MANDATORY + MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift COMPONENT CassandraSE) + INSTALL(FILES cassandra.cnf DESTINATION ${INSTALL_SYSCONFDIR}/my.cnf.d + COMPONENT CassandraSE) +ENDIF(CASSANDRASE_OK) diff --git a/storage/cassandra/cassandra.cnf b/storage/cassandra/cassandra.cnf new file mode 100644 index 00000000000..8f4b3d6f91e --- /dev/null +++ b/storage/cassandra/cassandra.cnf @@ -0,0 +1,2 @@ +[mariadb] +plugin-load-add=ha_cassandra.so