maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #03252
Patch to build xtradb and federatedx statically on Windows
Hi everyone,
Recently, we found out that xtradb and federatedx were compiled as
plugins on Windows. This is not correct because they are core storage
engines and should be linked statically instead.
On Unix, it's possible to build both types, but the CMake files doesn't
really handle this. They just look in plug.in, and if there is a dynamic
line, the storage engine is built dynamically. I'm hesitant to fix this
properly, as it's probably already done in MySQL 5.5, or at least it
will be. I see no reason to come up with a good solution for a temporary
problem - there are many other issues on Windows that are more pressing.
FederatedX couldn't compile as a statically linked plugin at all on
Windows. I have fixed this now, but I *really* don't like the way we do
these hacks on Windows. It's absurdly difficult to keep track of when a
variable says xtradb and when it says innobase. And debugging
CMakeLists.txt files is not too much fun. Anyway, I did the same thing
on FederatedX as is done in XtraDB, and it works now.
Finally, I removed a subdir that didn't have a CMakeLists.txt. Removed a
warning during the cmake run.
With this patch, the Windows zip file release build should work
correctly and produce a MariaDB with both XtraDB and FederatedX in it.
Should I check this into ~maria-captains/maria/5.1, or is there a branch
more suitable at the moment?
Bo Thorsen.
Monty Program AB.
--
MariaDB: MySQL replacement
Community developed. Feature enhanced. Backward compatible.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2010-03-04 08:03:07 +0000
+++ CMakeLists.txt 2010-06-09 07:39:42 +0000
@@ -235,15 +235,15 @@
STRING (REGEX MATCH "MYSQL_PLUGIN_DYNAMIC" MYSQL_PLUGIN_DYNAMIC ${PLUGIN_FILE_CONTENT})
STRING (REGEX MATCH "MYSQL_PLUGIN_MANDATORY" MYSQL_PLUGIN_MANDATORY ${PLUGIN_FILE_CONTENT})
STRING (REGEX MATCH "MYSQL_PLUGIN_STATIC" MYSQL_PLUGIN_STATIC ${PLUGIN_FILE_CONTENT})
-
- #
- # XTRADB is located in storage/xtradb, but it says everywhere it is 'innobase' (e.g.
+
+ #
+ # XTRADB is located in storage/xtradb, but it says everywhere it is 'innobase' (e.g.
# it declares 'builtin_innobase_plugin', not builtin_xtradb_plugin).
- # Extract the intended plugin name from MYSQL_STORAGE_ENGINE definition and use it
- # where appropriate.
- STRING (REGEX MATCH "MYSQL_STORAGE_ENGINE.[a-z]*" PLUGIN_NAME ${PLUGIN_FILE_CONTENT})
- STRING (REGEX REPLACE "MYSQL_STORAGE_ENGINE.(.*)" "\\1" PLUGIN_NAME ${PLUGIN_NAME})
-
+ # Extract the intended plugin name from MYSQL_STORAGE_ENGINE definition and use it
+ # where appropriate.
+ STRING (REGEX MATCH "MYSQL_STORAGE_ENGINE.[a-z]*" PLUGIN_NAME ${PLUGIN_FILE_CONTENT})
+ STRING (REGEX REPLACE "MYSQL_STORAGE_ENGINE.(.*)" "\\1" PLUGIN_NAME ${PLUGIN_NAME})
+
# Also remember this "xtradb"/"innobase" name discrepancy for libmysqld/CMakeLists.txt:
SET (plugin_dir_${PLUGIN_NAME} ${DIRNAME})
@@ -253,6 +253,8 @@
IF (WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
SET(ENGINE_BUILD_TYPE "STATIC")
+ ELSEIF (${PLUGIN_NAME} STREQUAL "innobase" OR ${PLUGIN_NAME} STREQUAL "federated")
+ SET(ENGINE_BUILD_TYPE "STATIC")
ELSEIF(NOT WITHOUT_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_DYNAMIC AND NOT WITHOUT_DYNAMIC_PLUGINS)
SET(ENGINE_BUILD_TYPE "DYNAMIC")
ELSE(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
@@ -264,7 +266,7 @@
SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${PLUGIN_NAME})
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
- SET (${ENGINE}_DIR ${DIRNAME})
+ SET (${ENGINE}_DIR ${DIRNAME})
ENDIF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
ENDIF(EXISTS ${SUBDIR}/plug.in)
@@ -327,7 +329,6 @@
ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(unittest/mytap)
-ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys)
IF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(libmysqld)
=== modified file 'storage/federatedx/CMakeLists.txt'
--- storage/federatedx/CMakeLists.txt 2009-11-14 19:33:59 +0000
+++ storage/federatedx/CMakeLists.txt 2010-06-09 07:38:32 +0000
@@ -1,3 +1,3 @@
INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
-SET(FEDERATEDX_SOURCES ha_federatedx.cc federatedx_txn.cc federatedx_io.cc federatedx_io_null.cc federatedx_io_mysql.cc)
-MYSQL_STORAGE_ENGINE(FEDERATEDX)
+SET(FEDERATED_SOURCES ha_federatedx.cc federatedx_txn.cc federatedx_io.cc federatedx_io_null.cc federatedx_io_mysql.cc)
+MYSQL_STORAGE_ENGINE(FEDERATED)
=== modified file 'storage/federatedx/plug.in'
--- storage/federatedx/plug.in 2009-11-14 19:33:59 +0000
+++ storage/federatedx/plug.in 2010-06-09 07:33:21 +0000
@@ -1,5 +1,6 @@
MYSQL_STORAGE_ENGINE(federated,,[FederatedX Storage Engine],
[FederatedX Storage Engine], [max,max-no-ndb])
+MYSQL_PLUGIN_DIRECTORY(federated, [storage/federatedx])
MYSQL_PLUGIN_DYNAMIC(federated, [ha_federatedx.la])
MYSQL_PLUGIN_STATIC(federated, [libfederatedx.a])
MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federated, [ha_federatedx.cc])
=== modified file 'storage/mysql_storage_engine.cmake'
--- storage/mysql_storage_engine.cmake 2009-10-08 12:54:11 +0000
+++ storage/mysql_storage_engine.cmake 2010-06-09 08:10:50 +0000
@@ -23,6 +23,7 @@
ADD_DEFINITIONS(-DWITH_${engine}_STORAGE_ENGINE -DMYSQL_SERVER)
#Create static library. The name of the library is <storage_engine>.lib
ADD_LIBRARY(${libname} ${${engine}_SOURCES})
+ MESSAGE("Building library ${libname} for engine ${engine}")
ADD_DEPENDENCIES(${libname} GenError)
IF(${engine}_LIBS)
TARGET_LINK_LIBRARIES(${libname} ${${engine}_LIBS})
Follow ups