summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Tolonen <jani.k.tolonen@gmail.com>2013-01-23 15:52:59 +0100
committerJani Tolonen <jani.k.tolonen@gmail.com>2013-01-23 15:52:59 +0100
commit09665bfd0e83efbc6c67f14852800fb4a0fe1e13 (patch)
tree1d141932803417e5d6a8250b4403700b1afa82d6
parent2b0f4bdf44904c5211f879edd477f0b3b80df0ef (diff)
downloadmariadb-git-09665bfd0e83efbc6c67f14852800fb4a0fe1e13.tar.gz
MDEV-3931 Cassandra SE packaging
Added autodetection for thrift library and includes Added Cassandra Storage Engine rpm
-rw-r--r--cmake/cpack_rpm.cmake4
-rw-r--r--storage/cassandra/CMakeLists.txt81
-rw-r--r--storage/cassandra/cassandra.cnf2
3 files changed, 54 insertions, 33 deletions
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 @@
-
-
-IF(NOT WITH_CASSANDRA_STORAGE_ENGINE)
- SET(WITHOUT_CASSANDRA 1)
-ENDIF(NOT WITH_CASSANDRA_STORAGE_ENGINE)
-
-
-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(BEFORE ${Boost_INCLUDE_DIRS})
-
-#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(/home/psergey/cassandra/thrift/lib)
-
-MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES thrift)
-# was: STORAGE_ENGINE MANDATORY
+# 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
+)
+
+# 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})
+
+CHECK_CXX_SOURCE_COMPILES(
+"
+#include <Thrift.h>
+int main() { return 0; }
+" CASSANDRASE_OK)
+
+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)
+
+ 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})
+
+ 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