MySQL5.5 编译 configure向cmake过渡

1、命令语法

configure Command CMake Command
./configure cmake .
./configure --help cmake . -LH or ccmake .

 

重新编译时,需要清除旧的对象文件和缓存信息

shell> make clean
shell> rm -f  CMakeCache.txt

 

2、安装选项

Parameter configure Option CMake Option CMake Notes
Installation base directory --prefix=/usr -DCMAKE_INSTALL_PREFIX=/usr
mysqld directory --libexecdir=/usr/sbin -DINSTALL_SBINDIR=sbin interpreted relative to prefix
Data directory --localstatedir=/var/lib/mysql -DMYSQL_DATADIR=/var/lib/mysql
Config directory (for my.cnf) --sysconfdir=/etc/mysql -DSYSCONFDIR=/etc/mysql
Plugin directory --with-plugindir=/usr/lib64/mysql/plugin -DINSTALL_PLUGINDIR=lib64/mysql/plugin interpreted relative to prefix
Man page directory --mandir=/usr/share/man -DINSTALL_MANDIR=share/man interpreted relative to prefix
Shared-data directory --sharedstatedir=/usr/share/mysql -DINSTALL_SHAREDIR=share this is where aclocal/mysql.m4 should be installed
Library installation directory --libdir=/usr/lib64/mysql -DINSTALL_LIBDIR=lib64/mysql interpreted relative to prefix
Header installation directory --includedir=/usr/include/mysql -DINSTALL_INCLUDEDIR=include/mysql interpreted relative to prefix
Info doc directory --infodir=/usr/share/info -DINSTALL_INFODIR=share/info interpreted relative to prefix

CMAKE_INSTALL_PREFIX值是安装的基本目录,其他cmake选项值若不包括前缀("/"),则是相对路径名。它的绝对路径包括CMAKE_INSTALL_PREFIX路径,如-DINSTALL_SBINDIR=sbin的绝对路径是/usr/local/mysql/sbin。


3、存储引擎选项


mysql存储引擎是插件式的,因此插件控制选项可以指定安装哪个存储引擎。

 

在使用configure时可以使用--with-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

    (在以后的版本中,可以使用on代替1)

 

在configure中使用--without-plugin-<engine>来指定不安装哪种存储引擎,对应cmake中的

-DWITHOUT_<ENGINE>_STORAGE_ENGINE


如果既不是-DWITH_<ENGINE>_STORAGE_ENGINE 也不是 -DWITHOUT_<ENGINE>_STORAGE_ENGINE 来指定存储引擎,该存储引擎将安装成共享模块式的。如果不是共享模块式的将排除在外。共享模块安装时必须使用INSTALL PLUGIN语句或--plugin-load才可以使用。


有关插件的CMake的选项的其他信息,请查阅:
http://forge.mysql.com/wiki/MySQL_Internals_Support_for_Plug-Ins


4.lib库选项

 

Parameter configure Option CMake Option CMake Notes
readline library --with-readline -DWITH_READLINE=1
SSL library --with-ssl=/usr -DWITH_SSL=system
zlib library --with-zlib-dir=/usr -DWITH_ZLIB=system
libwrap library --without-libwrap -DWITH_LIBWRAP=0

 

5、其它选项

之前MySQL的编译选项大多数都支持。新旧版本之间的安装选项映射成大写字母,删除选项前面破折号,中间字符间的破折号替换成下划线。如:
    --with-debug => WITH_DEBUG=1
    --with-embedded-server => WITH_EMBEDDED_SERVER

 

Parameter configure Option CMake Option CMake Notes
TCP/IP port number --with-tcp-port-=3306 -DMYSQL_TCP_PORT=3306
UNIX socket file --with-unix-socket-path=/tmp/mysqld.sock -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
Enable LOCAL for LOAD DATA --enable-local-infile -DENABLED_LOCAL_INFILE=1
Extra charsets --with-extra-charsets=all -DEXTRA_CHARSETS=all default is "all"
Default charset --with-charset=utf8 -DDEFAULT_CHARSET=utf8
Default collation --with-collation=utf8_general_ci -DDEFAULT_COLLATION=utf8_general_ci
Build the server --with-server none
Build the embedded server --with-embedded-server -DWITH_EMBEDDED_SERVER=1
libmysqld privilege control --with-embedded-privilege-control none always enabled?
Install the documentation --without-docs none
Big tables --with-big-tables, --without-big-tables none tables are big by default
mysqld user --with-mysqld-user=mysql -DMYSQL_USER=mysql mysql is the default
Debugging --without-debug -DWITH_DEBUG=0 default is debugging disabled
GIS support --with-geometry none always enabled?
Community features --enable-community-features none always enabled
Profiling --disable-profiling -DENABLE_PROFILING=0 enabled by default
pstack --without-pstack none pstack is removed
Assembler string functions --enable-assembler none
Build type --build=x86_64-pc-linux-gnu no equivalent unneeded?
Cross-compile host --host=x86_64-pc-linux-gnu no equivalent unneeded?
Client flag --with-client-ldflags=-lstdc++ none unneeded
Client flag --enable-thread-safe-client none unneeded, clients are always thread safe
Comment --with-comment='string' -DWITH_COMMENT='string'
Shared/static binaries --enable-shared --enable-static none there is only DISABLE_SHARED
Memory use --with-low-memory none unneeded

 

6、调试配置过程
    使用configure编译完将生成config.log和config.status文件。
    使用cmake编译完在CMakeFiles目录下生成CMakeError.log 和CMakeOutput.log文件。

7、第三方接口工具

    在之前的版本,第三方工具从MySQL顶层源目录中读取源configure.in文件来确定mysql版本。如:对5.5.7 - 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

猜你喜欢

转载自codejm.iteye.com/blog/1408547