网址: http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide
从mysql5.5起,mysql源码安装开始使用cmake了。下面是介绍configure选项如何映射到CMake的等值参数。
1. 命令语法:
configure commandcmake command
./configurecmake .
./configure �Chelpcmake . -LH or ccmake .
重新编译时,需要清除旧的对象文件和缓存信息
# make clean
# rm -f CMakeCache.txt
2.安装选项
parameterconfigure optioncmake option
Install base dir�Cprefix=/usr/local/mysql-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
Mysqld dir�Clibexecdir=/usr/local/mysql/sbin-DINSTALL_SBINDIR=sbin
Data dir�Cdatadir=/mydata-DMYSQL_DATADIR=/mydata
Config dir�Csysconfdir=/etc/mysql-DSYSCONFDIR=/etc/mysql
Plugin dir�Cwith-plugindir=/usr/local/mysql/lib/mysql/plugin-DINSTALL_PLUGINDIR=lib/mysql/plugin
Manpage dir�Cmandir=/usr/local/mysql/share/man-DINSTALL_MANDIR=share/man
Shared-data dir�Csharedstaedir=/usr/local/mysql/share/mysql-DINSTALL_SHAREDIR=share
Library install dir�Clibdir=/usr/local/mysql/lib/mysql-DINSTALL_LIBDIR=lib/mysql
Header install dir�Cincludedir=/usr/local/mysql/include/mysql-DINSTALL_INCLUDEDIR=include/mysql
Info doc dir�Cinfodir=/usr/local/mysql/share/info-DINSTALL_INFODIR=share/info
CMAKE_INSTALL_PREFIX值是安装的基本目录,其他cmake选项值是不包括前缀,是相对路径名,绝对路径包括CMAKE_INSTALL_PREFIX路径。如-DINSTALL_SBINDIR=sbin的绝对路径是/usr/local/mysql/sbin
3.存储引擎选项
mysql存储引擎是插件式的,因此插件控制选项可以指定那个存储引擎安装。
configure编译插件选项�Cwith-plugins=csv,myisam,myisammrg,heap,innobase,
archive,blackhole在cmake中没有直接对应的相同选项。对于csv,myisam,myisammrg,heap在cmake中是不需要明确指定存储引擎的名称,因为它们是强制性安装。
可以使用以下选择来安装innodb,archive,blackhole存储引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
(1可以使用on代替)
如果既不是-DWITH_<ENGINE>_STORAGE_ENGINE 也不是 -DWITHOUT_<ENGINE>_STORAGE_ENGINE 来指定存储引擎,该存储引擎将安装成共享模块式的。如果不是共享模块式的将排除在外。共享模块安装时必须使用INSTALL PLUGIN语句或�Cplugin-load才可以使用。
4.lib库选项
parameterconfigure optioncmake option
readline library�Cwith-readline-DWITH_READLINE=1
SSL library�Cwith-ssl=/usr-DWITH_SSL=system
zlib library�Cwith-zlib-dir/usr-DWITH_ZLIB=system
Libwrap library�Cwithout-libwrap-DWITH_LIBWRAP=0
有关插件的CMake的选项的其他信息,请查阅:
http://forge.mysql.com/wiki/MySQL_Internals_Support_for_Plug-Ins
5.其他选项
之前MySQL的编译选项大多数都支持。新旧版本之间的安装选项映射成大写字母,删除选项前面破折号,中间字符间的破折号替换成下划线。如:
�Cwith-debug => WITH_DEBUG=1
�Cwith-embedded-server => WITH_EMBEDDED_SERVER
ParameterConfigure optionCmake option
TCP/IP port number�Cwith-tcp-port=3306-DMYSQL_TCP_PORT=3306
UNIX socket file �Cwith-unix-socket-path=/tmp/mysqld.sock -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
Enable LOCAL for LOAD DATA �Cenable-local-infile -DENABLED_LOCAL_INFILE=1
Extra charsets �Cwith-extra-charsets=all -DEXTRA_CHARSETS=all
Default charset�Cwith-charset=utf8 -DDEFAULT_CHARSET=utf8
Default collation �Cwith-collation=utf8_general_ci -DDEFAULT_COLLATION=utf8_general_ci
Build the server �Cwith-server none
Build the embedded server �Cwith-embedded-server -DWITH_EMBEDDED_SERVER=1
libmysqld privilege control �Cwith-embedded-privilege-control none
Install the documentation �Cwithout-docs none
Big tables �Cwith-big-tables, �Cwithout-big-tables none
mysqld user �Cwith-mysqld-user=mysql -DMYSQL_USER=mysql
Debugging �Cwithout-debug -DWITH_DEBUG=0
GIS support �Cwith-geometry none
Community features �Cenable-community-features none
Profiling �Cdisable-profiling -DENABLE_PROFILING=0
pstack �Cwithout-pstack none
Assembler string functions �Cenable-assembler none
Build type �Cbuild=x86_64-pc-linux-gnu no equivalent
Cross-compile host �Chost=x86_64-pc-linux-gnu no equivalent
Client flag �Cwith-client-ldflags=-lstdc++ none
Client flag �Cenable-thread-safe-client none
Comment�Cwith-comment=’string’ -DWITH_COMMENT=’string’
Shared/static binaries �Cenable-shared �Cenable-static none
Memory use �Cwith-low-memory none
6.调试配置过程
使用configure编译完将生成config.log和config.status文件。
使用cmake编译完在CMakeFiles目录下生成CMakeError.log 和CMakeOutput.log文件。
7.第三方接口工具
在之前的版本,第三方工具从MySQL顶层源目录中读取源configure.in文件来确定mysql版本。如:对5.5.7 �C RC版本的AC_INIT线看起来像这样:
AC_INIT([MySQL Server], [5.5.7-rc], [], [mysql])
现在的版本可以直接读取版本文件。如:如果版本是5.5.8,文件看起来像这样的:
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=8
MYSQL_VERSION_EXTRA=
如果源码包不是GA版,MYSQL_VERSION_EXTRA的值将非空。如:对于一个发布RC版本是这样的:
MYSQL_VERSION_EXTRA=rc
构建5位数字的版本号,使用下面公式:
MYSQL_VERSION_MAJOR*10000 + MYSQL_VERSION_MINOR*100 + MYSQL_VERSION_PATCH