Commit b19e9986 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MWL#55 : cherrypick MySQL 5.5 CMake/build improvements in order

to be able to build MSI based installer
parent 3edf4dcd
This diff is collapsed.
......@@ -25,63 +25,48 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings)
${CMAKE_SOURCE_DIR}/strings
${CMAKE_CURRENT_BINARY_DIR})
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.cc)
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc DESTINATION bin)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c)
MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient_notls wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
../mysys/mf_tempdir.c
../mysys/my_new.cc
../mysys/my_bit.c
../mysys/my_bitmap.c
../mysys/my_vle.c
../mysys/base64.c)
../mysys/base64.c
DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqlslap mysqlslap.c)
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c DESTINATION bin)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug)
ADD_EXECUTABLE(echo echo.c)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("mysql" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqltest" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqlcheck" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqldump" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqlimport" "asInvoker")
MYSQL_EMBED_MANIFEST("mysql_upgrade" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqlshow" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqlbinlog" "asInvoker")
MYSQL_EMBED_MANIFEST("mysqladmin" "asInvoker")
MYSQL_EMBED_MANIFEST("echo" "asInvoker")
ENDIF(EMBED_MANIFESTS)
ADD_DEFINITIONS(-DHAVE_DLOPEN)
INSTALL(TARGETS mysql mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow
mysqlbinlog mysqladmin mysqlslap echo DESTINATION bin COMPONENT runtime)
MYSQL_ADD_EXECUTABLE(echo echo.c COMPONENT Test)
......@@ -22,19 +22,19 @@ TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h
COMMAND ${COMP_ERR_EXE}
--charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
--out-dir=${PROJECT_SOURCE_DIR}/sql/share/
--header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
--state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
--out-dir=${CMAKE_BINARY_DIR}/sql/share/
--header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h
--name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h
--state_file=${CMAKE_BINARY_DIR}/include/sql_state.h
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt)
ADD_CUSTOM_TARGET(GenError
ALL
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h)
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32)
......@@ -48,8 +48,4 @@ TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32)
ADD_EXECUTABLE(replace replace.c)
TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
ENDIF(EMBED_MANIFESTS)
INSTALL(TARGETS comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT runtime)
MYSQL_INSTALL_TARGETS(comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT Server)
......@@ -2,7 +2,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/extra/libevent
${CMAKE_SOURCE_DIR}/extra/libevent/compat
${CMAKE_SOURCE_DIR}/extra/libevent/WIN32-Code
${CMAKE_SOURCE_DIR}/include)
${CMAKE_BINARY_DIR}/extra/libevent
${CMAKE_SOURCE_DIR}/include
)
IF(MSVC)
ADD_DEFINITIONS("-DWIN32 -DHAVE_CONFIG_H")
......@@ -28,8 +30,14 @@ SET(LIBEVENT_SOURCES
min_heap.h
strlcpy-internal.h
)
IF(WIN32)
# Workaround source distribution bug, remove preconfigured event-config
IF(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
FILE(REMOVE ${CMAKE_SOURCE_DIR}/extra/libevent/event-config.h)
ENDIF()
CONFIGURE_FILE(WIN32-Code/config.h ${CMAKE_BINARY_DIR}/extra/libevent/event-config.h COPYONLY)
ENDIF()
CONFIGURE_FILE(WIN32-Code/config.h ${CMAKE_SOURCE_DIR}/extra/libevent/event-config.h COPYONLY)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(libevent ${LIBEVENT_SOURCES})
ENDIF(NOT SOURCE_SUBLIBS)
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(HEADERS_GEN_CONFIGURE
${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h
#${CMAKE_CURRENT_BINARY_DIR}/my_config.h
${CMAKE_CURRENT_BINARY_DIR}/mysqld_ername.h
${CMAKE_CURRENT_BINARY_DIR}/mysqld_error.h
${CMAKE_CURRENT_BINARY_DIR}/sql_state.h
)
SET(HEADERS_ABI
mysql.h
mysql_com.h
mysql_time.h
my_list.h
my_alloc.h
typelib.h
mysql/plugin.h
mysql/plugin_auth.h
mysql/client_plugin.h
)
SET(HEADERS
${HEADERS_ABI}
config-win.h
my_dbug.h
m_string.h
my_sys.h
my_xml.h
mysql_embed.h
my_pthread.h
my_no_pthread.h
decimal.h
errmsg.h
my_global.h
my_net.h
my_getopt.h
sslopt-longopts.h
my_dir.h
sslopt-vars.h
sslopt-case.h
sql_common.h
keycache.h
m_ctype.h
my_attribute.h
my_compiler.h
${HEADERS_GEN_CONFIGURE}
)
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR}/mysql COMPONENT Development FILES_MATCHING PATTERN "*.h" )
......@@ -46,7 +46,7 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
wqueue.h waiting_threads.h
EXTRA_DIST = mysql.h.pp mysql/plugin_auth.h.pp mysql/client_plugin.h.pp
EXTRA_DIST = mysql.h.pp mysql/plugin_auth.h.pp mysql/client_plugin.h.pp CMakeLists.txt
# Remove built files and the symlinked directories
CLEANFILES = $(BUILT_SOURCES) readline openssl
......
......@@ -124,14 +124,8 @@ ADD_DEPENDENCIES(libmysql GenError)
TARGET_LINK_LIBRARIES(libmysql wsock32)
ADD_DEFINITIONS(-DHAVE_DLOPEN)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
ENDIF(EMBED_MANIFESTS)
# TODO: Install mysqlclient_notls?
# TODO: Which component should these be part of, development?
INSTALL(TARGETS mysqlclient DESTINATION lib/opt COMPONENT runtime)
INSTALL(TARGETS libmysql DESTINATION lib/opt COMPONENT runtime)
# Also install libmysql.dll to the bin dir
INSTALL(TARGETS libmysql DESTINATION bin COMPONENT runtime)
INSTALL(TARGETS mysqlclient DESTINATION lib COMPONENT Development)
INSTALL_DEBUG_SYMBOLS(mysqlclient DESTINATION lib)
INSTALL(TARGETS libmysql DESTINATION lib COMPONENT SharedLibraries)
INSTALL_DEBUG_SYMBOLS(libmysql DESTINATION lib)
......@@ -28,14 +28,15 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/zlib)
${CMAKE_SOURCE_DIR}/zlib
${CMAKE_BINARY_DIR}/sql)
SET(GEN_SOURCES ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
SET(GEN_SOURCES ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${CMAKE_SOURCE_DIR}/sql/message.h
${CMAKE_SOURCE_DIR}/sql/message.rc
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
${CMAKE_SOURCE_DIR}/sql/lex_hash.h)
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
${CMAKE_BINARY_DIR}/sql/lex_hash.h)
SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1)
......@@ -166,6 +167,9 @@ ADD_LIBRARY(libmysqld SHARED cmake_dummy.c libmysqld.def)
ADD_DEPENDENCIES(libmysqld mysqlserver)
TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32)
INSTALL(TARGETS mysqlserver DESTINATION Embedded/static COMPONENT embedded)
INSTALL(TARGETS mysqlserver DESTINATION lib COMPONENT Embedded)
INSTALL_DEBUG_SYMBOLS(mysqlserver)
INSTALL_DEBUG_TARGET(mysqlserver DESTINATION lib/debug COMPONENT Embedded)
INSTALL(TARGETS libmysqld DESTINATION Embedded/DLL COMPONENT embedded)
INSTALL(TARGETS libmysqld DESTINATION lib COMPONENT Embedded)
INSTALL_DEBUG_SYMBOLS(libmysqld)
......@@ -26,16 +26,17 @@ ENDIF(WIN32)
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc)
COMPONENT Test)
TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
TARGET_LINK_LIBRARIES(mysql_embedded libmysqld)
TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc COMPONENT Test)
TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
TARGET_LINK_LIBRARIES(mysqltest_embedded libmysqld)
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver)
ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
MYSQL_ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c COMPONENT Test)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded libmysqld)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver)
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
IF(INSTALL_MYSQLTESTDIR)
INSTALL(
DIRECTORY .
DESTINATION ${INSTALL_MYSQLTESTDIR}
USE_SOURCE_PERMISSIONS
COMPONENT Test
PATTERN "var/" EXCLUDE
PATTERN "lib/My/SafeProcess" EXCLUDE
PATTERN "lib/t*" EXCLUDE
PATTERN "CPack" EXCLUDE
PATTERN "CMake*" EXCLUDE
PATTERN "mtr.out*" EXCLUDE
PATTERN ".cvsignore" EXCLUDE
PATTERN "*.am" EXCLUDE
PATTERN "*.in" EXCLUDE
PATTERN "*.vcproj" EXCLUDE
PATTERN "*.vcxproj" EXCLUDE
PATTERN "*.vcxproj.*" EXCLUDE
)
ENDIF()
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/mtr.out-of-source
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run.pl
@ONLY
)
ENDIF()
IF(UNIX)
EXECUTE_PROCESS(
COMMAND chmod +x mysql-test-run.pl
COMMAND ${CMAKE_COMMAND} -E create_symlink
./mysql-test-run.pl mtr
COMMAND ${CMAKE_COMMAND} -E create_symlink
./mysql-test-run.pl mysql-test-run
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
IF(INSTALL_MYSQLTESTDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
DESTINATION ${INSTALL_MYSQLTESTDIR}
COMPONENT Test)
ENDIF()
ENDIF()
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(SETCONFIG_COMMAND set MTR_VS_CONFIG=${CMAKE_CFG_INTDIR})
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
SET(SETCONFIG_COMMAND export MTR_VS_CONFIG=${CMAKE_CFG_INTDIR})
ELSE()
SET(SETCONFIG_COMMAND echo Running tests)
ENDIF()
IF(CYGWIN)
# On cygwin, pretend to be "Unix" system
SET(SETOS_COMMAND export MTR_CYGWIN_IS_UNIX=1)
ELSE()
SET(SETOS_COMMAND echo OS=${CMAKE_SYSTEM_NAME})
ENDIF()
SET(EXP --experimental=collections/default.experimental)
IF(WIN32)
SET(SET_ENV set)
ELSE()
SET(SET_ENV export)
ENDIF()
SET(MTR_FORCE perl ./mysql-test-run.pl --force)
IF(EXISTS ${CMAKE_SOURCE_DIR}/mysql-test/suite/nist)
SET(TEST_NIST ${MTR_FORCE} --comment=nist suite=nist ${EXP} &&
${MTR_FORCE} --comment=nist --force --suite=nist+ps ${EXP})
ELSE()
SET(TEST_NIST echo "NIST tests not found")
ENDIF()
IF(WITH_EMBEDDED_SERVER)
SET(TEST_EMBEDDED ${MTR_FORCE} --comment=embedded --timer --embedded-server
--skip-rpl --skip-ndbcluster $(EXP))
ELSE()
SET(TEST_EMBEDDED echo "Can not test embedded, not compiled in")
ENDIF()
SET(TEST_BT_START
COMMAND ${SETCONFIG_COMMAND}
COMMAND ${SETOS_COMMAND}
COMMAND ${SET_ENV} MTR_BUILD_THREAD=auto
)
ADD_CUSTOM_TARGET(test-force
${TEST_BT_START}
COMMAND ${MTR_FORCE}
)
ADD_CUSTOM_TARGET(test-bt
${TEST_BT_START}
COMMAND ${MTR_FORCE} --comment=normal --timer --skip-ndbcluster --report-features ${EXP}
COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol ${EXP}
COMMAND ${MTR_FORCE} --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 ${EXP}
COMMAND ${MTR_FORCE} --comment=funcs2 --suite=funcs_2 ${EXP}
COMMAND ${MTR_FORCE} --comment=partitions --suite=parts ${EXP}
COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP}
COMMAND ${MTR_FORCE} --force --comment=jp --suite=jp ${EXP}
COMMAND ${TEST_NIST}
COMMAND ${TEST_EMBEDDED}
)
ADD_CUSTOM_TARGET(test-bt-fast
${TEST_BT_START}
COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol --report-features ${EXP}
COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP}
)
ADD_CUSTOM_TARGET(test-bt-debug
${TEST_BT_START}
COMMAND ${MTR_FORCE} --comment=debug --timer --skip-ndbcluster --skip-rpl --report-features ${EXP}
)
......@@ -72,7 +72,9 @@ SUBDIRS = lib/My/SafeProcess
EXTRA_DIST = README README.suites \
$(test_SCRIPTS) \
$(nobase_test_DATA)
$(nobase_test_DATA) \
CMakeLists.txt \
mtr.out-of-source
# List of directories containing test + result files and the
# related test data files that should be copied
......@@ -109,7 +111,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r \
suite/innodb_plugin/include \
suite/handler \
suite/percona suite/handler \
suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \
......
......@@ -37,6 +37,15 @@ sub get_testdir {
return $testdir;
}
# Retrive build directory (which is different from basedir in out-of-source build)
sub get_bindir {
if (defined $ENV{MTR_BINDIR})
{
return $ENV{MTR_BINDIR};
}
my ($self, $group)= @_;
return $self->get_basedir($group);
}
sub fix_charset_dir {
my ($self, $config, $group_name, $group)= @_;
......@@ -46,7 +55,7 @@ sub fix_charset_dir {
sub fix_language {
my ($self, $config, $group_name, $group)= @_;
return my_find_dir($self->get_basedir($group),
return my_find_dir($self->get_bindir($group),
\@share_locations, "english");
}
......@@ -339,6 +348,7 @@ my @mysql_upgrade_rules=
sub post_check_client_group {
my ($self, $config, $client_group_name, $mysqld_group_name)= @_;
# Settings needed for client, copied from its "mysqld"
my %client_needs=
(
......@@ -348,7 +358,6 @@ sub post_check_client_group {
user => '#user',
password => '#password',
);
my $group_to_copy_from= $config->group($mysqld_group_name);
while (my ($name_to, $name_from)= each( %client_needs )) {
my $option= $group_to_copy_from->option($name_from);
......
......@@ -84,23 +84,34 @@ sub is_child {
my @safe_process_cmd;
my $safe_kill;
my $bindir;
if(defined $ENV{MTR_BINDIR})
{
# This is an out-of-source build. Build directory
# is given in MTR_BINDIR env.variable
$bindir = $ENV{MTR_BINDIR}."/mysql-test";
}
else
{
$bindir = ".";
}
# Find the safe process binary or script
sub find_bin {
if (IS_WIN32PERL or IS_CYGWIN)
{
# Use my_safe_process.exe
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
$safe_kill= my_find_bin($bindir, "lib/My/SafeProcess", "my_safe_kill");
}
else
{
# Use my_safe_process
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
}
......
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -13,5 +13,16 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
SET(INSTALL_ARGS
DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess"
COMPONENT Test
)
IF (WIN32)
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
ELSE()
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
ENDIF()
INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
#!/usr/bin/perl
# Call mtr in out-of-source build
$ENV{MTR_BINDIR} = "@CMAKE_BINARY_DIR@";
chdir("@CMAKE_SOURCE_DIR@/mysql-test");
exit(system($^X, "@CMAKE_SOURCE_DIR@/mysql-test/mysql-test-run.pl", @ARGV) >> 8);
\ No newline at end of file
......@@ -95,6 +95,7 @@ $SIG{INT}= sub { mtr_error("Got ^C signal"); };
our $mysql_version_id;
our $glob_mysql_test_dir;
our $basedir;
our $bindir;
our $path_charsetsdir;
our $path_client_bindir;
......@@ -513,7 +514,7 @@ sub run_test_server ($$$) {
my $completed= [];
my %running;
my $result;
my $exe_mysqld= find_mysqld($basedir) || ""; # Used as hint to CoreDump
my $exe_mysqld= find_mysqld($bindir) || ""; # Used as hint to CoreDump
my $suite_timeout= start_timer(suite_timeout());
......@@ -855,7 +856,7 @@ sub run_worker ($) {
stop_all_servers($opt_shutdown_timeout);
}
if ( $opt_gprof ) {
gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
gprof_collect (find_mysqld($bindir), keys %gprof_dirs);
}
exit(0);
}
......@@ -1092,6 +1093,10 @@ sub command_line_setup {
$basedir= dirname($basedir);
}
# Respect MTR_BINDIR variable, which is typically set in to the
# build directory in out-of-source builds.
$bindir=$ENV{MTR_BINDIR}||$basedir;
fix_vs_config_dir();
# Look for the client binaries directory
......@@ -1102,21 +1107,25 @@ sub command_line_setup {
}
else
{
$path_client_bindir= mtr_path_exists("$basedir/client_release",
"$basedir/client_debug",
"$basedir/client$opt_vs_config",
"$basedir/client",
"$basedir/bin");
$path_client_bindir= mtr_path_exists("$bindir/client_release",
"$bindir/client_debug",
"$bindir/client$opt_vs_config",
"$bindir/client",
"$bindir/bin");
}
# Look for language files and charsetsdir, use same share
$path_language= mtr_path_exists("$basedir/share/mariadb/english",
"$basedir/share/mysql/english",
"$basedir/sql/share/english",
"$basedir/share/english");
$path_language= mtr_path_exists("$bindir/share/mariadb/english",
"$bindir/share/mysql/english",
"$bindir/sql/share/english",
"$bindir/share/english");
my $path_share= dirname($path_language);
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
$path_charsetsdir= mtr_path_exists("$basedir/share/charsets",
"$basedir/share/mysql/charsets",
"$basedir/sql/share/charsets",
"$basedir/share/charsets");
if ( $opt_comment )
{
......@@ -1268,7 +1277,15 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Set the "var/" directory, the base for everything else
# --------------------------------------------------------------------------
if(defined $ENV{MTR_BINDIR})
{
$default_vardir= "$ENV{MTR_BINDIR}/mysql-test/var";
}
else
{
$default_vardir= "$glob_mysql_test_dir/var";
}
if ( ! $opt_vardir )
{
$opt_vardir= $default_vardir;
......@@ -1339,19 +1356,6 @@ sub command_line_setup {
# --------------------------------------------------------------------------
if ( $opt_embedded_server )
{
if ( IS_WINDOWS )
{
# Add the location for libmysqld.dll to the path.
my $separator= ";";
my $lib_mysqld=
mtr_path_exists("$basedir/libmysqld$opt_vs_config");
if ( IS_CYGWIN )
{
$lib_mysqld= posix_path($lib_mysqld);
$separator= ":";
}
$ENV{'PATH'}= "$ENV{'PATH'}".$separator.$lib_mysqld;
}
$opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
$opt_skip_ssl= 1; # Turn off use of SSL
......@@ -1645,7 +1649,7 @@ sub collect_mysqld_features {
mtr_add_arg($args, "--user=root");
}
my $exe_mysqld= find_mysqld($basedir);
my $exe_mysqld= find_mysqld($bindir);
my $cmd= join(" ", $exe_mysqld, @$args);
my $list= `$cmd`;
......@@ -1770,7 +1774,7 @@ sub find_mysqld {
unshift(@mysqld_names, "mysqld-debug");
}
return my_find_bin($mysqld_basedir,
return my_find_bin($bindir,
["sql", "libexec", "sbin", "bin"],
[@mysqld_names]);
}
......@@ -1820,7 +1824,7 @@ sub executable_setup () {
if ( $opt_embedded_server )
{
$exe_mysqltest=
mtr_exe_exists("$basedir/libmysqld/examples$opt_vs_config/mysqltest_embedded",
mtr_exe_exists("$bindir/libmysqld/examples$opt_vs_config/mysqltest_embedded",
"$path_client_bindir/mysqltest_embedded");
}
else
......@@ -1930,11 +1934,11 @@ sub mysql_client_test_arguments(){
# mysql_client_test executable may _not_ exist
if ( $opt_embedded_server ) {
$exe= mtr_exe_maybe_exists(
"$basedir/libmysqld/examples$opt_vs_config/mysql_client_test_embedded",
"$basedir/bin/mysql_client_test_embedded");
"$bindir/libmysqld/examples$opt_vs_config/mysql_client_test_embedded",
"$bindir/bin/mysql_client_test_embedded");
} else {
$exe= mtr_exe_maybe_exists("$basedir/tests$opt_vs_config/mysql_client_test",
"$basedir/bin/mysql_client_test");
$exe= mtr_exe_maybe_exists("$bindir/tests$opt_vs_config/mysql_client_test",
"$bindir/bin/mysql_client_test");
}
my $args;
......@@ -1946,13 +1950,13 @@ sub mysql_client_test_arguments(){
mtr_add_arg($args, "--testcase");
mtr_add_arg($args, "--vardir=$opt_vardir");
client_debug_arg($args,"mysql_client_test");
return mtr_args2str($exe, @$args);
my $ret=mtr_args2str($exe, @$args);
return $ret;
}
sub tool_arguments ($$) {
my($sedir, $tool_name) = @_;
my $exe= my_find_bin($basedir,
my $exe= my_find_bin($bindir,
[$sedir, "bin"],
$tool_name);
......@@ -1966,7 +1970,7 @@ sub tool_arguments ($$) {
# scripts to run the mysqld binary to test invalid server startup options.
sub mysqld_client_arguments () {
my $default_mysqld= default_mysqld();
my $exe = find_mysqld($basedir);
my $exe = find_mysqld($bindir);
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
......@@ -2147,24 +2151,24 @@ sub environment_setup {
# some versions, test using it should be skipped
# ----------------------------------------------------
my $exe_bug25714=
mtr_exe_maybe_exists("$basedir/tests$opt_vs_config/bug25714");
mtr_exe_maybe_exists("$bindir/tests$opt_vs_config/bug25714");
$ENV{'MYSQL_BUG25714'}= native_path($exe_bug25714);
# ----------------------------------------------------
# mysql_fix_privilege_tables.sql
# ----------------------------------------------------
my $file_mysql_fix_privilege_tables=
mtr_file_exists("$basedir/scripts/mysql_fix_privilege_tables.sql",
"$basedir/share/mysql_fix_privilege_tables.sql",
"$basedir/share/mariadb/mysql_fix_privilege_tables.sql",
"$basedir/share/mysql/mysql_fix_privilege_tables.sql");
mtr_file_exists("$bindir/scripts/mysql_fix_privilege_tables.sql",
"$bindir/share/mysql_fix_privilege_tables.sql",
"$bindir/share/mariadb/mysql_fix_privilege_tables.sql",
"$bindir/share/mysql/mysql_fix_privilege_tables.sql");
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
# ----------------------------------------------------
# my_print_defaults
# ----------------------------------------------------
my $exe_my_print_defaults=
mtr_exe_exists("$basedir/extra$opt_vs_config/my_print_defaults",
mtr_exe_exists("$bindir/extra$opt_vs_config/my_print_defaults",
"$path_client_bindir/my_print_defaults");
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= native_path($exe_my_print_defaults);
......@@ -2189,7 +2193,7 @@ sub environment_setup {
# mysqlhotcopy
# ----------------------------------------------------
my $mysqlhotcopy=
mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy");
mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy");
# Since mysqltest interprets the real path as "false" in an if,
# use 1 ("true") to indicate "not exists" so it can be tested for
$ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1;
......@@ -2197,7 +2201,7 @@ sub environment_setup {
# ----------------------------------------------------
# perror
# ----------------------------------------------------
my $exe_perror= mtr_exe_exists("$basedir/extra$opt_vs_config/perror",
my $exe_perror= mtr_exe_exists("$bindir/extra$opt_vs_config/perror",
"$path_client_bindir/perror");
$ENV{'MY_PERROR'}= native_path($exe_perror);
......@@ -2378,9 +2382,9 @@ sub setup_vardir() {
mkpath($plugindir);
if (IS_WINDOWS)
{
for (<../storage/*$opt_vs_config/*.dll>,
<../plugin/*$opt_vs_config/*.dll>,
<../sql$opt_vs_config/*.dll>)
for (<$bindir/storage/*$opt_vs_config/*.dll>,
<$bindir/plugin/*$opt_vs_config/*.dll>,
<$bindir/sql$opt_vs_config/*.dll>)
{
my $pname=basename($_);
copy rel2abs($_), "$plugindir/$pname";
......@@ -2389,7 +2393,7 @@ sub setup_vardir() {
}
else
{
for (<../storage/*/.libs/*.so>,<../plugin/*/.libs/*.so>,<../sql/.libs/*.so>)
for (<$bindir/storage/*/.libs/*.so>,<$bindir/plugin/*/.libs/*.so>,<$bindir/sql/.libs/*.so>)
{
my $pname=basename($_);
symlink rel2abs($_), "$plugindir/$pname";
......@@ -2400,8 +2404,8 @@ sub setup_vardir() {
else
{
# hm, what paths work for debs and for rpms ?
for (<$basedir/lib/mysql/plugin/*.so>,
<$basedir/lib/plugin/*.dll>)
for (<$bindir/lib/mysql/plugin/*.so>,
<$bindir/lib/plugin/*.dll>)
{
my $pname=basename($_);
set_plugin_var($pname);
......@@ -2516,7 +2520,7 @@ sub fix_vs_config_dir () {
$opt_vs_config="";
for (<$basedir/sql/*/mysqld.exe>) {
for (<$bindir/sql/*/mysqld.exe>) {
if (-M $_ < $modified)
{
$modified = -M _;
......
......@@ -138,6 +138,7 @@ Tables_in_test
DROP TABLE `@`;
CREATE TABLE `я` (a INT);
SET NAMES DEFAULT;
call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
mysqlcheck --default-character-set="latin1" --databases test
test.?
Error : Table doesn't exist
......
......@@ -136,6 +136,7 @@ DROP TABLE `@`;
CREATE TABLE `я` (a INT);
SET NAMES DEFAULT;
call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
--echo mysqlcheck --default-character-set="latin1" --databases test
# Error returned depends on platform, replace it with "Table doesn't exist"
--replace_result "Can't find file: './test/@003f.frm' (errno: 22)" "Table doesn't exist" "Table 'test.?' doesn't exist" "Table doesn't exist"
......
......@@ -48,6 +48,4 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(mysys ${MYSYS_SOURCES})
INSTALL(TARGETS mysys DESTINATION lib/opt COMPONENT runtime) # TODO: Component?
ENDIF(NOT SOURCE_SUBLIBS)
......@@ -20,6 +20,4 @@ SET(REGEX_SOURCES regcomp.c regerror.c regexec.c regfree.c reginit.c)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(regex ${REGEX_SOURCES})
INSTALL(TARGETS regex DESTINATION lib/opt COMPONENT runtime) # TODO: Component
ENDIF(NOT SOURCE_SUBLIBS)
......@@ -14,10 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Build mysql_fix_privilege_tables.sql
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql
COMMAND copy /b
mysql_system_tables.sql + mysql_system_tables_fix.sql
mysql_fix_privilege_tables.sql
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
native_outfile )
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables.sql
COMMAND COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql
${native_outfile}
DEPENDS
${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables.sql
${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables_fix.sql)
......@@ -29,24 +31,26 @@ TARGET_LINK_LIBRARIES(comp_sql debug dbug mysys strings)
# Use comp_sql to build mysql_fix_privilege_tables_sql.c
GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables_sql.c
COMMAND ${COMP_SQL_EXE}
mysql_fix_privilege_tables
mysql_fix_privilege_tables.sql
${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
mysql_fix_privilege_tables_sql.c
DEPENDS comp_sql ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql
${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables.sql)
# Add dummy target for the above to be built
ADD_CUSTOM_TARGET(GenFixPrivs
ALL
DEPENDS ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c)
DEPENDS ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables_sql.c)
# ----------------------------------------------------------------------
# Replace some variables @foo@ in the .in/.sh file, and write the new script
# ----------------------------------------------------------------------
SET(CFLAGS "-D_WINDOWS ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
SET(prefix "${CMAKE_INSTALL_PREFIX}/MySQL Server ${MYSQL_BASE_VERSION}")
SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(sysconfdir ${prefix})
SET(bindir ${prefix}/bin)
SET(libexecdir ${prefix}/bin)
......@@ -76,11 +80,14 @@ CONFIGURE_FILE(mysqldumpslow.sh
CONFIGURE_FILE(mysqlhotcopy.sh
${CMAKE_BINARY_DIR}/scripts/mysqlhotcopy.pl ESCAPE_QUOTES @ONLY)
INSTALL(FILES mysqldumpslow.pl mysqlhotcopy.pl mysql_config.pl
FOREACH(f mysqldumpslow.pl mysqlhotcopy.pl mysql_config.pl
mysql_convert_table_format.pl mysql_install_db.pl
mysql_secure_installation.pl mysqld_multi.pl
DESTINATION scripts COMPONENT scripts)
mysql_secure_installation.pl mysqld_multi.pl)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f}
DESTINATION scripts COMPONENT Server_Scripts)
ENDFOREACH()
INSTALL(FILES fill_help_tables.sql mysql_fix_privilege_tables.sql mysql_system_tables.sql
INSTALL(FILES fill_help_tables.sql mysql_system_tables.sql
mysql_system_tables_data.sql mysql_system_tables_fix.sql mysql_test_data_timezone.sql
DESTINATION share COMPONENT scripts)
DESTINATION share COMPONENT Server)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql DESTINATION share COMPONENT Server)
\ No newline at end of file
......@@ -25,6 +25,10 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
/* Compiler-dependent constant for maximum string constant */
#define MAX_STRING_CONSTANT_LENGTH 65535
FILE *in, *out;
......@@ -58,21 +62,55 @@ static void die(const char *fmt, ...)
int main(int argc, char *argv[])
{
char buff[512];
struct stat st;
char* struct_name= argv[1];
char* infile_name= argv[2];
char* outfile_name= argv[3];
if (argc != 4)
die("Usage: comp_sql <struct_name> <sql_filename> <c_filename>");
/* Open input and output file */
if (!(in= fopen(infile_name, "r")))
die("Failed to open SQL file '%s'", infile_name);
if (!(out= fopen(outfile_name, "w")))
die("Failed to open output file '%s'", outfile_name);
fprintf(out, "const char %s[]={\n",struct_name);
/*
Some compilers have limitations how long a string constant can be.
We'll output very long strings as hexadecimal arrays, and short ones
as strings (prettier)
*/
stat(infile_name, &st);
if (st.st_size > MAX_STRING_CONSTANT_LENGTH)
{
int cnt=0;
int c;
int first_char= 1;
for(cnt=0;;cnt++)
{
c= fgetc(in);
if (c== -1)
break;
if(cnt != 0)
fputc(',', out);
fprintf(out, "const char* %s={\n\"", struct_name);
/* Put line break after each 16 hex characters */
if(cnt && (cnt%16 == 0))
fputc('\n', out);
fprintf(out,"0x%02x",c);
}
fprintf(out,",0x00",c);
}
else
{
fprintf(out,"\"");
while (fgets(buff, sizeof(buff), in))
{
char *curr= buff;
......@@ -113,9 +151,10 @@ int main(int argc, char *argv[])
fprintf(out, "\"\n\"");
}
}
fprintf(out, "\\\n\"");
}
fprintf(out, "\\\n\"};\n");
fprintf(out, "};\n");
fclose(in);
fclose(out);
......
......@@ -360,7 +360,7 @@ my $hostname = hostname();
my $resolved;
if ( !$opt->{'cross-bootstrap'} and !$opt->{rpm} and !$opt->{force} )
{
my $resolveip;
my $resolveip = $bindir/resolveip;
$resolved = `$resolveip $hostname 2>&1`;
if ( $? != 0 )
......@@ -418,9 +418,7 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap,
"--bootstrap",
"--basedir=$opt->{basedir}",
"--datadir=$opt->{ldata}",
"--skip-innodb",
"--skip-bdb",
"--skip-ndbcluster",
"--loose-skip-innodb",
"--max_allowed_packet=8M",
"--net_buffer_length=16K",
@args,
......
......@@ -34,5 +34,3 @@ TARGET_LINK_LIBRARIES(mysqlmanager debug dbug mysys strings taocrypt vio yassl z
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("mysqlmanager" "asInvoker")
ENDIF(EMBED_MANIFESTS)
INSTALL(TARGETS mysqlmanager DESTINATION bin COMPONENT runtime)
......@@ -22,16 +22,18 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/extra/libevent
${CMAKE_BINARY_DIR}/extra/libevent
${CMAKE_CURRENT_BINARY_DIR}
)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
${CMAKE_SOURCE_DIR}/include/mysql_version.h
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
${CMAKE_SOURCE_DIR}/sql/lex_hash.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
${PROJECT_SOURCE_DIR}/include/sql_state.h
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
${CMAKE_BINARY_DIR}/include/mysql_version.h
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
${CMAKE_BINARY_DIR}/sql/lex_hash.h
${CMAKE_BINARY_DIR}/include/mysqld_error.h
${CMAKE_BINARY_DIR}/include/mysqld_ername.h
${CMAKE_BINARY_DIR}/include/sql_state.h
PROPERTIES GENERATED 1)
ADD_DEFINITIONS(-DMYSQL_SERVER -D_CONSOLE -DHAVE_DLOPEN -DHAVE_EVENT_SCHEDULER)
......@@ -74,20 +76,22 @@ SET (SQL_SOURCE
sql_connect.cc scheduler.cc
sql_profile.cc event_parse_data.cc opt_table_elimination.cc
create_options.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
${PROJECT_SOURCE_DIR}/include/sql_state.h
${PROJECT_SOURCE_DIR}/include/mysql_version.h
${PROJECT_SOURCE_DIR}/sql/sql_builtin.cc
${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${CMAKE_BINARY_DIR}/include/mysqld_error.h
${CMAKE_BINARY_DIR}/include/mysqld_ername.h
${CMAKE_BINARY_DIR}/include/sql_state.h
${CMAKE_BINARY_DIR}/include/mysql_version.h
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
${CMAKE_BINARY_DIR}/sql/lex_hash.h)
ADD_LIBRARY(sql ${SQL_SOURCE})
IF (NOT EXISTS cmake_dummy.cc)
FILE (WRITE cmake_dummy.cc "")
ENDIF (NOT EXISTS cmake_dummy.cc)
ADD_EXECUTABLE(mysqld cmake_dummy.cc message.rc)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/cmake/dummy.in cmake_dummy.cc COPYONLY)
MYSQL_ADD_EXECUTABLE(mysqld cmake_dummy.cc message.rc DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
INSTALL_DEBUG_TARGET(mysqld
DESTINATION ${INSTALL_SBINDIR}
PDB_DESTINATION ${INSTALL_SBINDIR}/debug
RENAME mysqld-debug)
SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX})
SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
......@@ -111,17 +115,17 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK
COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js
${PLATFORM} ${LIB_LOCATIONS} > mysqld.def
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/sql)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
ADD_DEPENDENCIES(sql GenError)
# Sql Parser custom command
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
OUTPUT ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
COMMAND bison ARGS -y -p MYSQL --defines=sql_yacc.h
--output=sql_yacc.cc sql_yacc.yy
--output=sql_yacc.cc "${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy"
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy)
......@@ -130,17 +134,15 @@ ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
TARGET_LINK_LIBRARIES(gen_lex_hash debug dbug mysqlclient strings wsock32)
GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h
OUTPUT ${CMAKE_BINARY_DIR}/sql/lex_hash.h
COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
DEPENDS ${GEN_LEX_HASH_EXE})
ADD_CUSTOM_TARGET(
GenServerSource ALL
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/message.h
${PROJECT_SOURCE_DIR}/sql/message.rc
${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
DEPENDS ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
${CMAKE_BINARY_DIR}/sql/lex_hash.h)
ADD_DEPENDENCIES(mysqld GenServerSource)
......@@ -152,7 +154,88 @@ ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
ADD_DEPENDENCIES(udf_example strings GenError)
TARGET_LINK_LIBRARIES(udf_example strings wsock32)
INSTALL(TARGETS mysqld
RUNTIME DESTINATION bin COMPONENT runtime
LIBRARY DESTINATION lib COMPONENT runtime
ARCHIVE DESTINATION lib COMPONENT runtime)
ADD_SUBDIRECTORY(share)
IF(WIN32)
SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql)
FILE(TO_NATIVE_PATH ${my_bootstrap_sql} native_outfile)
# Create bootstrapper SQL script
ADD_CUSTOM_COMMAND(OUTPUT
${my_bootstrap_sql}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts
cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql ${native_outfile}
DEPENDS
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql
${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
COMMAND comp_sql
mysql_bootstrap_sql
${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql
mysql_bootstrap_sql.c
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql ${my_bootstrap_sql})
MYSQL_ADD_EXECUTABLE(mysql_install_db
mysql_install_db.cc
${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
COMPONENT Server)
TARGET_LINK_LIBRARIES(mysql_install_db mysys strings dbug)
MYSQL_ADD_EXECUTABLE(mysql_upgrade_service
mysql_upgrade_service.cc
COMPONENT Server)
TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys strings dbug)
# mysql_install_db should be in the same directory as mysqld
# to work correctly
GET_TARGET_PROPERTY(MYSQLD_EXECUTABLE mysqld LOCATION)
IF(NOT MYSQLD_EXECUTABLE)
MESSAGE(FATAL_ERROR "Unexpected")
ENDIF()
ENDIF()
# We need to create empty directories (data/test) the installation.
# This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767
# Avoid completely empty directories and install dummy file instead.
SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty )
FILE(WRITE ${DUMMY_FILE} "")
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test COMPONENT DataFiles)
# Install initial database on windows
IF(NOT CMAKE_CROSSCOMPILING)
GET_TARGET_PROPERTY(MYSQLD_EXECUTABLE mysqld LOCATION)
ENDIF()
IF(WIN32 AND MYSQLD_EXECUTABLE)
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/win/cmake/create_initial_db.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
@ONLY
)
IF(MSVC_IDE OR CMAKE_GENERATOR MATCHES "Xcode")
SET (CONFIG_PARAM -DCONFIG=${CMAKE_CFG_INTDIR})
ENDIF()
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
ADD_CUSTOM_COMMAND(
OUTPUT initdb.dep
COMMAND ${CMAKE_COMMAND}
${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
ALL
DEPENDS initdb.dep
)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE)
ELSE()
# Not windows or cross compiling, just install an empty directory
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)
ENDIF()
......@@ -151,7 +151,7 @@ DEFS = -DMYSQL_SERVER \
BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
nt_servc.cc nt_servc.h \
nt_servc.cc nt_servc.h mysql_install_db.cc mysql_upgrade_service.cc \
message.mc message.h message.rc MSG00001.bin \
CMakeLists.txt
......
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET (dirs
danish
german
slovak
dutch
greek
norwegian
spanish
english
hungarian
norwegian-ny
swedish
italian
polish
ukrainian
japanese
portuguese
romanian
estonian
korean
russian
czech
french
serbian
)
SET(files
errmsg.txt
)
FOREACH (dir ${dirs})
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir}
DESTINATION share COMPONENT Server)
ENDFOREACH()
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION share COMPONENT Server
PATTERN "languages.html" EXCLUDE
)
INSTALL(FILES ${files} DESTINATION share COMPONENT Server)
......@@ -15,7 +15,7 @@
## Process this file with automake to create Makefile.in
EXTRA_DIST= errmsg.txt
EXTRA_DIST= errmsg.txt CMakeLists.txt
dist-hook:
for dir in charsets @AVAILABLE_LANGUAGES@; do \
......
......@@ -48,23 +48,25 @@ SET(ARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
MYSQL_STORAGE_ENGINE(ARIA)
IF(NOT SOURCE_SUBLIBS)
ADD_DEPENDENCIES(aria GenError)
ADD_EXECUTABLE(aria_ftdump maria_ftdump.c)
MYSQL_ADD_EXECUTABLE(aria_ftdump maria_ftdump.c)
TARGET_LINK_LIBRARIES(aria_ftdump aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(aria_chk maria_chk.c)
MYSQL_ADD_EXECUTABLE(aria_chk maria_chk.c)
TARGET_LINK_LIBRARIES(aria_chk aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(aria_read_log maria_read_log.c)
MYSQL_ADD_EXECUTABLE(aria_read_log maria_read_log.c)
TARGET_LINK_LIBRARIES(aria_read_log aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(aria_pack maria_pack.c)
MYSQL_ADD_EXECUTABLE(aria_pack maria_pack.c)
TARGET_LINK_LIBRARIES(aria_pack aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c)
MYSQL_ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c)
TARGET_LINK_LIBRARIES(aria_dump_log aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(ma_test1 ma_test1.c)
TARGET_LINK_LIBRARIES(ma_test1 aria myisam mysys dbug strings zlib wsock32)
......@@ -79,15 +81,4 @@ TARGET_LINK_LIBRARIES(ma_rt_test aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(ma_sp_test ma_sp_test.c)
TARGET_LINK_LIBRARIES(ma_sp_test aria myisam mysys dbug strings zlib wsock32)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("aria_ftdump" "asInvoker")
MYSQL_EMBED_MANIFEST("aria_chk" "asInvoker")
MYSQL_EMBED_MANIFEST("aria_read_log" "asInvoker")
MYSQL_EMBED_MANIFEST("aria_pack" "asInvoker")
ENDIF(EMBED_MANIFESTS)
INSTALL(TARGETS aria_ftdump aria_chk aria_read_log aria_pack aria_dump_log
DESTINATION bin COMPONENT runtime)
ENDIF(NOT SOURCE_SUBLIBS)
......@@ -31,16 +31,16 @@ SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
MYSQL_STORAGE_ENGINE(MYISAM)
IF(NOT SOURCE_SUBLIBS)
ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
MYSQL_ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamchk myisamchk.c)
MYSQL_ADD_EXECUTABLE(myisamchk myisamchk.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisamchk myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamlog myisamlog.c)
MYSQL_ADD_EXECUTABLE(myisamlog myisamlog.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisamlog myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(myisampack myisampack.c)
MYSQL_ADD_EXECUTABLE(myisampack myisampack.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisampack myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(mi_test1 mi_test1.c)
......@@ -60,13 +60,4 @@ IF(NOT SOURCE_SUBLIBS)
SET_TARGET_PROPERTIES(myisamchk myisampack PROPERTIES LINK_FLAGS "setargv.obj")
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("myisam_ftdump" "asInvoker")
MYSQL_EMBED_MANIFEST("myisamchk" "asInvoker")
MYSQL_EMBED_MANIFEST("myisamlog" "asInvoker")
MYSQL_EMBED_MANIFEST("myisampack" "asInvoker")
ENDIF(EMBED_MANIFESTS)
INSTALL(TARGETS myisam_ftdump myisamchk myisamlog myisampack DESTINATION bin COMPONENT runtime)
ENDIF(NOT SOURCE_SUBLIBS)
......@@ -16,7 +16,10 @@ IF(NOT SOURCE_SUBLIBS)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include)
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_BINARY_DIR}/include
${CMAKE_BINARY_DIR}/sql
)
STRING(TOUPPER ${engine} engine)
STRING(TOLOWER ${engine} libname)
IF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
......@@ -33,13 +36,13 @@ IF(NOT SOURCE_SUBLIBS)
#Create a DLL.The name of the dll is ha_<storage_engine>.dll
#The dll is linked to the mysqld executable
SET(dyn_libname ha_${libname})
ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
ADD_LIBRARY(${dyn_libname} MODULE ${${engine}_SOURCES})
TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld)
IF(${engine}_LIBS)
TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
ENDIF(${engine}_LIBS)
# Install the plugin
INSTALL(TARGETS ${dyn_libname} DESTINATION lib/plugin COMPONENT runtime)
MYSQL_INSTALL_TARGETS(${dyn_libname} DESTINATION lib/plugin COMPONENT Server)
MESSAGE("build ${engine} as DLL")
ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
ENDIF(NOT SOURCE_SUBLIBS)
......
......@@ -28,6 +28,4 @@ SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(strings ${STRINGS_SOURCES})
INSTALL(TARGETS strings DESTINATION lib/opt COMPONENT runtime) # TODO: Component
ENDIF(NOT SOURCE_SUBLIBS)
......@@ -25,4 +25,4 @@ TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient_notls wsock32)
ADD_EXECUTABLE(bug25714 bug25714.c)
TARGET_LINK_LIBRARIES(bug25714 mysqlclient_notls wsock32)
INSTALL(TARGETS mysql_client_test bug25714 DESTINATION bin COMPONENT runtime)
INSTALL(TARGETS mysql_client_test DESTINATION bin COMPONENT Test)
......@@ -18,5 +18,39 @@ EXTRA_DIST = build-vs71.bat build-vs8.bat build-vs8_x64.bat build-vs9.bat \
build-vs9_x64.bat configure.js README mysql_manifest.cmake \
create_manifest.js create_def_file.js build-nmake.bat \
build-nmake-x64.bat configure-mariadb.sh make_mariadb_win_dist \
build-vs10.bat build-vs10_x64.bat
build-vs10.bat build-vs10_x64.bat \
cmake/cmake_parse_arguments.cmake \
cmake/cpack_source_ignore_files.cmake \
cmake/create_initial_db.cmake.in \
cmake/install_layout.cmake \
cmake/install_macros.cmake \
cmake/mysql_add_executable.cmake \
cmake/mysql_version.cmake \
cmake/package_name.cmake \
cmake/versioninfo.rc.in \
cmake/dummy.in \
packaging/CMakeLists.txt \
packaging/CPackWixConfig.cmake \
packaging/create_msi.cmake.in \
packaging/custom_ui.wxs \
packaging/extra.wxs.in \
packaging/COPYING.rtf \
packaging/mysql_server.wxs.in \
packaging/ca/CMakeLists.txt \
packaging/ca/CustomAction.cpp \
packaging/ca/CustomAction.def \
packaging/ca/CustomAction.rc \
packaging/WixUIBannerBmp.jpg \
packaging/WixUIDialogBmp.jpg \
upgrade_wizard/resource.h \
upgrade_wizard/stdafx.h \
upgrade_wizard/targetver.h \
upgrade_wizard/upgrade.cpp \
upgrade_wizard/upgrade.h \
upgrade_wizard/upgrade.rc \
upgrade_wizard/upgradeDlg.cpp \
upgrade_wizard/upgradeDlg.h \
upgrade_wizard/upgrade_wizard.exe.manifest \
upgrade_wizard/CMakeLists.txt \
upgrade_wizard/res/upgrade.ico \
upgrade_wizard/res/upgrade.rc2
set build_64_bit=
set build_msi=
set generator=
set scriptdir=%~dp0
:: Process all the arguments from the command line
::
:process_arguments
if "%~1"=="" goto :do_work
if "%~1"=="-h" goto :help
if "%~1"=="-msi" set build_msi=1
if "%~1"=="-G" set generator=-G "%~2"
shift
goto :process_arguments
:help
echo "build_maria_release [-h] [-msi] [-G <Generator>]"
:die
echo error occured.
popd
exit /b 1
:do_work
:: We're doing out-of-source build to ensure nobody has broken it:)
pushd %scriptdir%
cd ..
rd /s /q xxx
mkdir xxx
cd xxx
cmake .. -DWITH_EMBEDDED_SERVER=1 %generator%
if %ERRORLEVEL% NEQ 0 goto :die
cmake --build . --config Debug
if %ERRORLEVEL% NEQ 0 goto :die
cmake --build . --config RelWithDebInfo --target package
if %ERRORLEVEL% NEQ 0 goto :die
if "%build_msi%"=="1" (
cmake --build . --config RelWithDebInfo --target win\packaging\msi
if %ERRORLEVEL% NEQ 0 goto :die
)
xcopy /y *.zip ..
xcopy /y *.msi ..
popd
\ No newline at end of file
# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems,Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Handy macro to parse macro arguments
MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names)
SET(DEFAULT_ARGS)
FOREACH(arg_name ${arg_names})
SET(${prefix}_${arg_name})
ENDFOREACH(arg_name)
FOREACH(option ${option_names})
SET(${prefix}_${option} FALSE)
ENDFOREACH(option)
SET(current_arg_name DEFAULT_ARGS)
SET(current_arg_list)
FOREACH(arg ${ARGN})
SET(larg_names ${arg_names})
LIST(FIND larg_names "${arg}" is_arg_name)
IF (is_arg_name GREATER -1)
SET(${prefix}_${current_arg_name} ${current_arg_list})
SET(current_arg_name ${arg})
SET(current_arg_list)
ELSE (is_arg_name GREATER -1)
SET(loption_names ${option_names})
LIST(FIND loption_names "${arg}" is_option)
IF (is_option GREATER -1)
SET(${prefix}_${arg} TRUE)
ELSE (is_option GREATER -1)
SET(current_arg_list ${current_arg_list} ${arg})
ENDIF (is_option GREATER -1)
ENDIF (is_arg_name GREATER -1)
ENDFOREACH(arg)
SET(${prefix}_${current_arg_name} ${current_arg_list})
ENDMACRO()
\ No newline at end of file
SET(CPACK_SOURCE_IGNORE_FILES
\\\\.bzr/
\\\\.bzr-mysql
\\\\.bzrignore
CMakeCache\\\\.txt
cmake_dist\\\\.cmake
CPackSourceConfig\\\\.cmake
CPackConfig.cmake
/cmake_install\\\\.cmake
/CTestTestfile\\\\.cmake
/CMakeFiles/
/version_resources/
/_CPack_Packages/
$\\\\.gz
$\\\\.zip
/CMakeFiles/
/version_resources/
/_CPack_Packages/
scripts/make_binary_distribution$
scripts/msql2mysql$
scripts/mysql_config$
scripts/mysql_convert_table_format$
scripts/mysql_find_rows$
scripts/mysql_fix_extensions$
scripts/mysql_install_db$
scripts/mysql_secure_installation$
scripts/mysql_setpermission$
scripts/mysql_zap$
scripts/mysqlaccess$
scripts/mysqld_multi$
scripts/mysqld_safe$
scripts/mysqldumpslow$
scripts/mysqlhotcopy$
Makefile$
include/config\\\\.h$
include/my_config\\\\.h$
/autom4te\\\\.cache/
errmsg\\\\.sys$
#
)
# Copyright (C) 2009 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This script creates initial database for packaging on Windows
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
SET(MYSQLD_EXECUTABLE "@MYSQLD_EXECUTABLE@")
SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
SET(WIN32 "@WIN32@")
# Force Visual Studio to output to stdout
IF(ENV{VS_UNICODE_OUTPUT})
SET ($ENV{VS_UNICODE_OUTPUT})
ENDIF()
IF(CMAKE_CFG_INTDIR AND CONFIG)
#Resolve build configuration variables
STRING(REPLACE "${CMAKE_CFG_INTDIR}" ${CONFIG} MYSQLD_EXECUTABLE
"${MYSQLD_EXECUTABLE}")
ENDIF()
# Create bootstrapper SQL script
FILE(WRITE bootstrap.sql "use mysql;\n" )
FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql)
FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
FOREACH(STR ${CONTENTS})
IF(NOT STR MATCHES "@current_hostname")
FILE(APPEND bootstrap.sql "${STR}\n")
ENDIF()
ENDFOREACH()
ENDFOREACH()
FILE(READ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql CONTENTS)
FILE(APPEND bootstrap.sql ${CONTENTS})
FILE(REMOVE_RECURSE mysql)
MAKE_DIRECTORY(mysql)
IF(WIN32)
SET(CONSOLE --console)
ENDIF()
SET(BOOTSTRAP_COMMAND
${MYSQLD_EXECUTABLE}
--no-defaults
${CONSOLE}
--bootstrap
--language=${CMAKE_CURRENT_BINARY_DIR}/share/english
--basedir=.
--datadir=.
--default-storage-engine=MyISAM
--loose-skip-innodb
--loose-skip-pbxt
--loose-skip-ndbcluster
--max_allowed_packet=8M
--net_buffer_length=16K
)
GET_FILENAME_COMPONENT(CWD . ABSOLUTE)
EXECUTE_PROCESS(
COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND}
)
EXECUTE_PROCESS (
COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD}
)
EXECUTE_PROCESS (
COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT
ERROR_VARIABLE ERR
RESULT_VARIABLE RESULT
)
IF(NOT RESULT EQUAL 0)
MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
ENDIF()
# Copyright (C) 2010 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# The purpose of this file is to set the default installation layout.
#
# The current choices of installation layout are:
#
# STANDALONE
# Build with prefix=/usr/local/mysql, create tarball with install prefix="."
# and relative links. Windows zip uses the same tarball layout but without
# the build prefix.
#
# RPM
# Build as per default RPM layout, with prefix=/usr
#
# DEB
# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor
#
# SVR4
# Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql
#
# To force a directory layout, use -DINSTALL_LAYOUT=<layout>.
#
# The default is STANDALONE.
#
# There is the possibility to further fine-tune installation directories.
# Several variables can be overwritten:
#
# - INSTALL_BINDIR (directory with client executables and scripts)
# - INSTALL_SBINDIR (directory with mysqld)
# - INSTALL_SCRIPTDIR (several scripts, rarely used)
#
# - INSTALL_LIBDIR (directory with client end embedded libraries)
# - INSTALL_PLUGINDIR (directory for plugins)
#
# - INSTALL_INCLUDEDIR (directory for MySQL headers)
#
# - INSTALL_DOCDIR (documentation)
# - INSTALL_DOCREADMEDIR (readme and similar)
# - INSTALL_MANDIR (man pages)
# - INSTALL_INFODIR (info pages)
#
# - INSTALL_SHAREDIR (location of aclocal/mysql.m4)
# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages)
# - INSTALL_MYSQLTESTDIR (mysql-test)
# - INSTALL_SQLBENCHDIR (sql-bench)
# - INSTALL_SUPPORTFILESDIR (various extra support files)
#
# - INSTALL_MYSQLDATADIR (data directory)
#
# When changing this page, _please_ do not forget to update public Wiki
# http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths
IF(NOT INSTALL_LAYOUT)
SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
ENDIF()
SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4")
IF(UNIX)
IF(INSTALL_LAYOUT MATCHES "RPM")
SET(default_prefix "/usr")
ELSEIF(INSTALL_LAYOUT MATCHES "DEB")
SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}")
# This is required to avoid "cpack -GDEB" default of prefix=/usr
SET(CPACK_SET_DESTDIR ON)
ELSEIF(INSTALL_LAYOUT MATCHES "SVR4")
SET(default_prefix "/opt/mysql/mysql")
ELSE()
SET(default_prefix "/usr/local/mysql")
ENDIF()
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX ${default_prefix}
CACHE PATH "install prefix" FORCE)
ENDIF()
SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4")
LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind)
IF(ind EQUAL -1)
MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}."
" Choose between ${VALID_INSTALL_LAYOUTS}" )
ENDIF()
SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
CACHE PATH "config directory (for my.cnf)")
MARK_AS_ADVANCED(SYSCONFDIR)
ENDIF()
#
# STANDALONE layout
#
SET(INSTALL_BINDIR_STANDALONE "bin")
SET(INSTALL_SBINDIR_STANDALONE "bin")
SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
#
SET(INSTALL_LIBDIR_STANDALONE "lib")
SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
#
SET(INSTALL_INCLUDEDIR_STANDALONE "include")
#
SET(INSTALL_DOCDIR_STANDALONE "docs")
SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
SET(INSTALL_MANDIR_STANDALONE "man")
SET(INSTALL_INFODIR_STANDALONE "docs")
#
SET(INSTALL_SHAREDIR_STANDALONE "share")
SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share")
SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test")
SET(INSTALL_SQLBENCHDIR_STANDALONE ".")
SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
#
SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
#
# RPM layout
#
SET(INSTALL_BINDIR_RPM "bin")
SET(INSTALL_SBINDIR_RPM "sbin")
SET(INSTALL_SCRIPTDIR_RPM "bin")
#
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
SET(INSTALL_LIBDIR_RPM "lib64")
SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin")
ELSE()
SET(INSTALL_LIBDIR_RPM "lib")
SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin")
ENDIF()
#
SET(INSTALL_INCLUDEDIR_RPM "include/mysql")
#
#SET(INSTALL_DOCDIR_RPM unset - installed directly by RPM)
#SET(INSTALL_DOCREADMEDIR_RPM unset - installed directly by RPM)
SET(INSTALL_INFODIR_RPM "share/info")
SET(INSTALL_MANDIR_RPM "share/man")
#
SET(INSTALL_SHAREDIR_RPM "share")
SET(INSTALL_MYSQLSHAREDIR_RPM "share/mysql")
SET(INSTALL_MYSQLTESTDIR_RPM "share/mysql-test")
SET(INSTALL_SQLBENCHDIR_RPM "")
SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql")
#
SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql")
#
# DEB layout
#
SET(INSTALL_BINDIR_DEB "bin")
SET(INSTALL_SBINDIR_DEB "bin")
SET(INSTALL_SCRIPTDIR_DEB "scripts")
#
SET(INSTALL_LIBDIR_DEB "lib")
SET(INSTALL_PLUGINDIR_DEB "lib/plugin")
#
SET(INSTALL_INCLUDEDIR_DEB "include")
#
SET(INSTALL_DOCDIR_DEB "docs")
SET(INSTALL_DOCREADMEDIR_DEB ".")
SET(INSTALL_MANDIR_DEB "man")
SET(INSTALL_INFODIR_DEB "docs")
#
SET(INSTALL_SHAREDIR_DEB "share")
SET(INSTALL_MYSQLSHAREDIR_DEB "share")
SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
SET(INSTALL_SQLBENCHDIR_DEB ".")
SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
#
SET(INSTALL_MYSQLDATADIR_DEB "data")
#
# SVR4 layout
#
SET(INSTALL_BINDIR_SVR4 "bin")
SET(INSTALL_SBINDIR_SVR4 "bin")
SET(INSTALL_SCRIPTDIR_SVR4 "scripts")
#
SET(INSTALL_LIBDIR_SVR4 "lib")
SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin")
#
SET(INSTALL_INCLUDEDIR_SVR4 "include")
#
SET(INSTALL_DOCDIR_SVR4 "docs")
SET(INSTALL_DOCREADMEDIR_SVR4 ".")
SET(INSTALL_MANDIR_SVR4 "man")
SET(INSTALL_INFODIR_SVR4 "docs")
#
SET(INSTALL_SHAREDIR_SVR4 "share")
SET(INSTALL_MYSQLSHAREDIR_SVR4 "share")
SET(INSTALL_MYSQLTESTDIR_SVR4 "mysql-test")
SET(INSTALL_SQLBENCHDIR_SVR4 ".")
SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files")
#
SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql")
# Clear cached variables if install layout was changed
IF(OLD_INSTALL_LAYOUT)
IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUT)
SET(FORCE FORCE)
ENDIF()
ENDIF()
SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
# Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR
# will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE
# layout is chosen)
FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN
INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA)
SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
CACHE STRING "${var} installation directory" ${FORCE})
MARK_AS_ADVANCED(INSTALL_${var}DIR)
ENDFOREACH()
This diff is collapsed.
# Copyright (C) 2009 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Add executable plus some additional MySQL specific stuff
# Usage (same as for standard CMake's ADD_EXECUTABLE)
#
# MYSQL_ADD_EXECUTABLE(target source1...sourceN)
#
# MySQL specifics:
# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory
# On Windows :
# - add version resource
# - instruct CPack to do autenticode signing if SIGNCODE is set
INCLUDE(cmake_parse_arguments)
FUNCTION (MYSQL_ADD_EXECUTABLE)
# Pass-through arguments for ADD_EXECUTABLE
MYSQL_PARSE_ARGUMENTS(ARG
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
""
${ARGN}
)
LIST(GET ARG_DEFAULT_ARGS 0 target)
LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
SET(sources ${ARG_DEFAULT_ARGS})
ADD_VERSION_INFO(${target} EXECUTABLE sources)
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL)
IF(NOT ARG_DESTINATION)
SET(ARG_DESTINATION ${INSTALL_BINDIR})
ENDIF()
IF(ARG_COMPONENT)
SET(COMP COMPONENT ${ARG_COMPONENT})
ELSEIF(MYSQL_INSTALL_COMPONENT)
SET(COMP COMPONENT ${MYSQL_INSTALL_COMPONENT})
ELSE()
SET(COMP COMPONENT Client)
ENDIF()
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP})
ENDIF()
ENDFUNCTION()
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=")
IF(str)
STRING(REPLACE "${keyword}=" "" str ${str})
STRING(REGEX REPLACE "[ ].*" "" str ${str})
SET(${var} ${str} CACHE INTERNAL "Config variable")
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
# Read mysql version for configure script
MACRO(GET_MYSQL_VERSION)
IF(NOT VERSION_STRING)
IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE")
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}")
IF(NOT VERSION_STRING)
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
IF(NOT VERSION_STRING)
FILE(STRINGS configure.in str REGEX "AC_INIT\\(")
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zA-Z0-9]+" VERSION_STRING "${str}")
IF(NOT VERSION_STRING)
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDIF()
IF(NOT VERSION_STRING)
MESSAGE(FATAL_ERROR
"VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra"
"when calling cmake")
ENDIF()
SET(VERSION ${VERSION_STRING})
STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}")
# Remove trailing (non-numeric) part of the version string
STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING})
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}")
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}")
MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}")
MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH})
ENDMACRO()
# Get mysql version and other interesting variables
GET_MYSQL_VERSION()
MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION)
MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT)
MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT)
MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION)
IF(NOT MYSQL_TCP_PORT_DEFAULT)
SET(MYSQL_TCP_PORT_DEFAULT "3306")
ENDIF()
IF(NOT MYSQL_TCP_PORT)
SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
SET(MYSQL_TCP_PORT_DEFAULT "0")
ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
SET(MYSQL_TCP_PORT_DEFAULT "0")
ENDIF()
IF(NOT MYSQL_UNIX_ADDR)
SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
ENDIF()
IF(NOT COMPILATION_COMMENT)
SET(COMPILATION_COMMENT "Source distribution")
ENDIF()
INCLUDE(package_name)
IF(NOT CPACK_PACKAGE_FILE_NAME)
GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME)
ENDIF()
IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}")
ENDIF()
SET(CPACK_PACKAGE_CONTACT "MariaDB team <build@mysql.com>")
SET(CPACK_PACKAGE_VENDOR "Monty Program AB")
SET(CPACK_SOURCE_GENERATOR "TGZ")
INCLUDE(cpack_source_ignore_files)
# Defintions for windows version resources
SET(PRODUCTNAME "MariaDB Server")
SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR})
# Windows 'date' command has unpredictable output, so cannot rely on it to
# set MYSQL_COPYRIGHT_YEAR - if someone finds a portable way to do so then
# it might be useful
#IF (WIN32)
# EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE TMP_DATE)
# STRING(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" MYSQL_COPYRIGHT_YEAR ${TMP_DATE})
IF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE MYSQL_COPYRIGHT_YEAR OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()
# Add version information to the exe and dll files
# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
# for more info.
IF(MSVC)
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
SET(FILETYPE VFT_APP)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
SET(FILETYPE VFT_DLL)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
FUNCTION(ADD_VERSION_INFO target target_type sources_var)
IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE")
SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
ELSEIF("${target_type}" MATCHES "EXE")
SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
ENDIF()
SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE)
ENDFUNCTION()
ELSE()
FUNCTION(ADD_VERSION_INFO)
ENDFUNCTION()
ENDIF()
# Copyright (C) 2010 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Produce meaningful package name for the binary package
# The logic is rather involved with special cases for different OSes
INCLUDE(CheckTypeSize)
CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
MACRO(GET_PACKAGE_FILE_NAME Var)
IF(NOT VERSION)
MESSAGE(FATAL_ERROR
"Variable VERSION needs to be set prior to calling GET_PACKAGE_FILE_NAME")
ENDIF()
IF(NOT SYSTEM_NAME_AND_PROCESSOR)
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1)
SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME})
SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
IF(SIZEOF_VOIDP EQUAL 8)
SET(64BIT 1)
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
SET(DEFAULT_PLATFORM "win")
IF(64BIT)
SET(DEFAULT_MACHINE "x64")
ELSE()
SET(DEFAULT_MACHINE "32")
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
SET(DEFAULT_MACHINE "i686")
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# SunOS 5.10=> solaris10
STRING(REPLACE "5." "" VER "${CMAKE_SYSTEM_VERSION}")
SET(DEFAULT_PLATFORM "solaris${VER}")
IF(64BIT)
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
SET(DEFAULT_MACHINE "x86_64")
ELSE()
SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
ENDIF()
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
STRING(REPLACE "B." "" VER "${CMAKE_SYSTEM_VERSION}")
SET(DEFAULT_PLATFORM "hpux${VER}")
IF(64BIT)
SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}5.${CMAKE_SYSTEM_VERSION}")
IF(64BIT)
SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
STRING(REGEX MATCH "[0-9]+\\.[0-9]+" VER "${CMAKE_SYSTEM_VERSION}")
SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}${VER}")
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
SET(DEFAULT_MACHINE "x86_64")
IF(NOT 64BIT)
SET(DEFAULT_MACHINE "i386")
ENDIF()
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(DEFAULT_PLATFORM "osx${CMAKE_OSX_DEPLOYMENT_TARGET}")
ELSE()
SET(VER "${CMAKE_SYSTEM_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VER "${VER}")
# Subtract 4 from Darwin version to get correct osx10.X
MATH(EXPR VER "${VER} -4")
SET(DEFAULT_PLATFORM "osx10.${VER}")
ENDIF()
LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN)
IF(LEN GREATER 1)
SET(DEFAULT_MACHINE "universal")
ELSE()
SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
IF(NOT DEFAULT_MACHINE)
IF(CMAKE_SIZEOF_VOIPD EQUAL 4)
SET(DEFAULT_MACHINE "i386")
ELSE()
SET(DEFAULT_MACHINE "x86_64")
ENDIF()
ENDIF()
ENDIF()
IF(DEFAULT_MACHINE MATCHES "i386")
SET(DEFAULT_MACHINE "x86")
ENDIF()
ENDIF()
IF(NOT PLATFORM)
SET(PLATFORM ${DEFAULT_PLATFORM})
ENDIF()
IF(NOT MACHINE)
SET(MACHINE ${DEFAULT_MACHINE})
ENDIF()
IF(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE)
SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}-${MACHINE}")
ELSE()
SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}${MACHINE}")
ENDIF()
ENDIF()
IF(SHORT_PRODUCT_TAG)
SET(PRODUCT_TAG "-${SHORT_PRODUCT_TAG}")
ELSEIF(MYSQL_SERVER_SUFFIX)
SET(PRODUCT_TAG "${MYSQL_SERVER_SUFFIX}") # Already has a leading dash
ELSE()
SET(PRODUCT_TAG)
ENDIF()
SET(package_name "mariadb${PRODUCT_TAG}-${MYSQL_NO_DASH_VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
# Sometimes package suffix is added (something like "-icc-glibc23")
IF(PACKAGE_SUFFIX)
SET(package_name "${package_name}${PACKAGE_SUFFIX}")
ENDIF()
STRING(TOLOWER ${package_name} package_name)
SET(${Var} ${package_name})
ENDMACRO()
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE @FILETYPE@
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
......@@ -19,6 +19,13 @@ The default is to the builds and create 32 bit packages.
EOF
}
if test -f win/build_maria_release.bat
then
cmd /c win\\build_maria_release.bat "$@"
exit $?
fi
# The default settings
CMAKE_GENERATOR="Visual Studio 9 2008"
ARCH="win32"
......
......@@ -27,6 +27,4 @@ SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.
zutil.c zutil.h)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(zlib ${ZLIB_SOURCES})
INSTALL(TARGETS zlib DESTINATION lib/opt COMPONENT runtime) # TODO: Component
ENDIF(NOT SOURCE_SUBLIBS)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment