From 5a2f40d48a6fda6b83f788a0f849299bd44b621e Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Jun 2010 03:48:11 +0300 Subject: [PATCH 01/15] Fixes for Opensolaris (to get buildbot green) - Fixed memory leaks in mysqldump - Fixed printf of NULL which caused crashes on OpenSolaris when using --debug - Fixed realloc() problem that caused out of memory when running mysqldump.test on OpenSolaris client/mysqldump.c: Fixed memory leaks Fixed printf of NULL which caused crashes on OpenSolaris when using --debug client/mysqltest.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug include/my_global.h: Added simple macro val_or_null() to simplify detecting of NULL strings for printf sql/handler.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug sql/sql_db.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug Removed testing of 'new_db_name' as this is guranteed never NULL sql/sql_show.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug storage/csv/ha_tina.cc: Fixed realloc() problem that caused out of memory when running mysqldump.test on OpenSolaris (OpenSolaris default malloc() can't handle a lot of reallocs() of strings that are growing one byte at a time) This did speed up logging to cvs with a magnitude for large strings. --- client/mysqldump.c | 8 ++++++-- client/mysqltest.cc | 2 +- include/my_global.h | 3 +++ sql/handler.cc | 3 ++- sql/sql_db.cc | 9 +++------ sql/sql_show.cc | 6 +++--- storage/csv/ha_tina.cc | 3 +++ 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 212baca6be8..a9fe3f8e1fa 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1441,6 +1441,7 @@ static void free_resources() if (md_result_file && md_result_file != stdout) my_fclose(md_result_file, MYF(0)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_host, MYF(MY_ALLOW_ZERO_PTR)); if (hash_inited(&ignore_table)) hash_free(&ignore_table); if (extended_insert) @@ -4222,7 +4223,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root) } mysql_free_result(table_res); } - DBUG_PRINT("exit", ("new_table_name: %s", name)); + DBUG_PRINT("exit", ("new_table_name: %s", val_or_null(name))); DBUG_RETURN(name); } @@ -4818,6 +4819,7 @@ static my_bool get_view_structure(char *table, char* db) field= mysql_fetch_field_direct(table_res, 0); if (strcmp(field->name, "View") != 0) { + mysql_free_result(table_res); switch_character_set_results(mysql, default_charset); verbose_msg("-- It's base table, skipped\n"); DBUG_RETURN(0); @@ -4827,8 +4829,10 @@ static my_bool get_view_structure(char *table, char* db) if (path) { if (!(sql_file= open_sql_file_for_table(table, O_WRONLY))) + { + mysql_free_result(table_res); DBUG_RETURN(1); - + } write_header(sql_file, db); } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index e89f87758c6..a6bfc72070c 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -541,7 +541,7 @@ public: { DBUG_ENTER("LogFile::open"); DBUG_PRINT("enter", ("dir: '%s', name: '%s'", - dir, name)); + val_or_null(dir), val_or_null(name))); if (!name) { m_file= stdout; diff --git a/include/my_global.h b/include/my_global.h index a32db3c87b6..9d9daf5aa1a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -90,6 +90,9 @@ #define IF_WIN(A,B) (B) #endif +/* Make it easier to print null strings */ +#define val_or_null(A) ((A) ? (const char*) (A) : "(null)") + #ifndef EMBEDDED_LIBRARY #ifdef WITH_NDB_BINLOG #define HAVE_NDB_BINLOG 1 diff --git a/sql/handler.cc b/sql/handler.cc index b7903468b69..e455523d508 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3865,7 +3865,8 @@ ha_find_files(THD *thd,const char *db,const char *path, int error= 0; DBUG_ENTER("ha_find_files"); DBUG_PRINT("enter", ("db: '%s' path: '%s' wild: '%s' dir: %d", - db, path, wild ? wild : "NULL", dir)); + val_or_null(db), val_or_null(path), + val_or_null(wild), dir)); st_find_files_args args= {db, path, wild, dir, files}; plugin_foreach(thd, find_files_handlerton, diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 94be8a5f240..b4a0e5c4c7d 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1539,12 +1539,9 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) Security_context *sctx= thd->security_ctx; ulong db_access= sctx->db_access; CHARSET_INFO *db_default_cl; - DBUG_ENTER("mysql_change_db"); - DBUG_PRINT("enter",("name: '%s'", new_db_name->str)); - if (new_db_name == NULL || - new_db_name->length == 0) + if (new_db_name->length == 0) { if (force_switch) { @@ -1553,8 +1550,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) after loading stored program. The thing is that loading of stored program can happen when there is no current database. - TODO: actually, new_db_name and new_db_name->str seem to be always - non-NULL. In case of stored program, new_db_name->str == "" and + In case of stored program, new_db_name->str == "" and new_db_name->length == 0. */ @@ -1569,6 +1565,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) DBUG_RETURN(TRUE); } } + DBUG_PRINT("enter",("name: '%s'", new_db_name->str)); if (is_schema_db(new_db_name->str, new_db_name->length)) { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a288cad88d7..6f59f54fe11 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3563,9 +3563,9 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond) if (get_lookup_field_values(thd, cond, tables, &lookup_field_vals)) DBUG_RETURN(0); - DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'", - lookup_field_vals.db_value.str, - lookup_field_vals.table_value.str)); + DBUG_PRINT("INDEX VALUES",("db_name: %s table_name: %s", + val_or_null(lookup_field_vals.db_value.str), + val_or_null(lookup_field_vals.table_value.str))); if (make_db_list(thd, &db_names, &lookup_field_vals, &with_i_schema)) DBUG_RETURN(1); diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 8a30467f16c..e013440ecca 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -489,6 +489,9 @@ int ha_tina::encode_quote(uchar *buf) ptr= attribute.ptr(); end_ptr= attribute.length() + ptr; + if (buffer.realloc(attribute.length()*2+2)) + return 0; // Failure + buffer.append('"'); while (ptr < end_ptr) From f7d6a2ed654949f662da0a8c33f8e85b6d9e7f41 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Jun 2010 10:33:00 +0300 Subject: [PATCH 02/15] Fixed trival bug introduced in last patch (buffer was not extended) --- storage/csv/ha_tina.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index e013440ecca..4a9754922e5 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -489,7 +489,11 @@ int ha_tina::encode_quote(uchar *buf) ptr= attribute.ptr(); end_ptr= attribute.length() + ptr; - if (buffer.realloc(attribute.length()*2+2)) + /* + Ensure that buffer is big enough. This will also speed things up + as we don't have to do any new allocation in the loop below + */ + if (buffer.realloc(buffer.length() + attribute.length()*2+2)) return 0; // Failure buffer.append('"'); From 5c4e95f83b16caa75e2e93d1b2c9f39a214684d6 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Fri, 25 Jun 2010 15:09:45 +0200 Subject: [PATCH 03/15] Implement an NSIS based installer --- CMakeLists.txt | 75 ++++++++++++++++++++ client/CMakeLists.txt | 2 + extra/CMakeLists.txt | 2 + libmysql/CMakeLists.txt | 8 +++ mysys/CMakeLists.txt | 2 + regex/CMakeLists.txt | 2 + scripts/CMakeLists.txt | 5 ++ server-tools/instance-manager/CMakeLists.txt | 2 + sql/CMakeLists.txt | 5 ++ storage/maria/CMakeLists.txt | 3 + storage/myisam/CMakeLists.txt | 2 + strings/CMakeLists.txt | 2 + tests/CMakeLists.txt | 2 + zlib/CMakeLists.txt | 2 + 14 files changed, 114 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a79051eb706..c8245b886db 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,3 +333,78 @@ IF(WITH_EMBEDDED_SERVER) ADD_SUBDIRECTORY(libmysqld/examples) ENDIF(WITH_EMBEDDED_SERVER) ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) + +# Set up the installer +SET(CPACK_PACKAGE_NAME "MariaDB") +STRING(REPLACE "-MariaDB" "" CPACK_PACKAGE_VERSION ${VERSION}) +SET(CPACK_PACKAGE_VENDOR "Monty Program AB http://www.montyprogram.com") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB") +SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) +SET(CPACK_GENERATOR NSIS) + +# Installer components and grouping +SET(CPACK_COMPONENT_GROUP_SERVER_DESCRIPTION "The files necessary for running the MariaDB server.") +SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files used in development on the MariaDB server.") +SET(CPACK_ALL_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "MariaDB server") +SET(CPACK_COMPONENT_RUNTIME_DESCRIPTION "The server itself. You want to install this one.") +SET(CPACK_COMPONENT_RUNTIME_GROUP "Server") +SET(CPACK_COMPONENT_RUNTIME_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Development headers") +SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Header files for development on MariaDB.") +SET(CPACK_COMPONENT_HEADERS_DEPENDS runtime) +SET(CPACK_COMPONENT_HEADERS_GROUP "Development") +SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Development) +SET(CPACK_COMPONENT_PERLSCRIPTS_DISPLAY_NAME "Server perl scripts") +SET(CPACK_COMPONENT_PERLSCRIPTS_DESCRIPTION "Scripts to controll and modify the server. You need a perl installation for these to work.") +SET(CPACK_COMPONENT_PERLSCRIPTS_DEPENDS runtime) +SET(CPACK_COMPONENT_PERLSCRIPTS_GROUP "Server") +SET(CPACK_COMPONENT_PERLSCRIPTS_INSTALL_TYPES Normal Development) +# TODO: Add debug files +# TODO: Add embedded server files +# TODO: Add test files +# TODO: Add sql-bench + +# Add files to the installer +INSTALL(FILES COPYING EXCEPTIONS-CLIENT DESTINATION .) +INSTALL(FILES support-files/my-huge.ini support-files/my-innodb-heavy-4G.ini DESTINATION .) +INSTALL(FILES support-files/my-large.ini support-files/my-medium.ini DESTINATION .) +INSTALL(FILES support-files/my-small.ini DESTINATION .) +INSTALL(FILES Docs/INSTALL-BINARY DESTINATION Docs) +INSTALL(FILES COPYING DESTINATION Docs) +FILE(GLOB headerfiles "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") +INSTALL(FILES ${headerfiles} DESTINATION include COMPONENT headers) +INSTALL(FILES include/mysql/plugin.h DESTINATION include/mysql COMPONENT headers) +INSTALL(FILES libmysql/libmysql.def DESTINATION include COMPONENT headers) + +# Handle the database files +FILE(GLOB datafiles "${CMAKE_CURRENT_SOURCE_DIR}/win/data/mysql/*") +INSTALL(FILES ${datafiles} DESTINATION data/clean/mysql) +INSTALL(FILES win/data/maria_log.00000001 win/data/maria_log_control DESTINATION data/clean) +INSTALL(DIRECTORY win/data/test DESTINATION data/clean) +SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} + IfFileExists '$INSTDIR\\\\data\\\\mysql\\\\db.frm' 0 CopyDatabaseFiles + MessageBox MB_OK 'There are already database files present in the data directory. Clean database files are not written to the directory' + GoTo EndCopyDatabaseFiles + CopyDatabaseFiles: + CopyFiles '$INSTDIR\\\\data\\\\clean\\\\*' '$INSTDIR\\\\data' + EndCopyDatabaseFiles:") +SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} + MessageBox MB_OK 'This will not delete the database files in $INSTDIR\\\\data'") + +# Files in the share dir +INSTALL(FILES sql/share/errmsg.txt DESTINATION share COMPONENT runtime) +FILE(GLOB charsets sql/share/charsets/*) +INSTALL(FILES ${charsets} DESTINATION share/charsets COMPONENT runtime) +FILE(GLOB share_dirs sql/share/*) +FOREACH(SUBDIR ${share_dirs}) + FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${SUBDIR}) + IF (EXISTS ${SUBDIR}/errmsg.sys) + INSTALL(FILES ${SUBDIR}/errmsg.sys DESTINATION share/${DIRNAME} COMPONENT runtime) + ENDIF(EXISTS ${SUBDIR}/errmsg.sys) +ENDFOREACH(SUBDIR ${share_dirs}) + +INCLUDE(InstallRequiredSystemLibraries) + +# This must always be the last line +INCLUDE(CPack) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e96437d40d0..abd9923d49d 100755 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -83,3 +83,5 @@ IF(EMBED_MANIFESTS) MYSQL_EMBED_MANIFEST("echo" "asInvoker") ENDIF(EMBED_MANIFESTS) +INSTALL(TARGETS mysql mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow + mysqlbinlog mysqladmin mysqlslap echo DESTINATION bin COMPONENT runtime) diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index cec0db6a4ae..ba90492577d 100755 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -53,3 +53,5 @@ 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) diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index b033aeb4665..5a0c0bf9e22 100755 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -129,3 +129,11 @@ TARGET_LINK_LIBRARIES(libmysql wsock32) 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) diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index e9873fb0525..bf0c6551a11 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -49,4 +49,6 @@ 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) diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt index 2e3b18c7bb0..b8a0a953af6 100755 --- a/regex/CMakeLists.txt +++ b/regex/CMakeLists.txt @@ -22,4 +22,6 @@ 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) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 2563c49280e..aa7fa03cf03 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -75,3 +75,8 @@ 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 + mysql_convert_table_format.pl mysql_install_db.pl + mysql_secure_installation.pl mysqld_multi.pl + DESTINATION scripts COMPONENT perlscripts) diff --git a/server-tools/instance-manager/CMakeLists.txt b/server-tools/instance-manager/CMakeLists.txt index 4b9c386afe1..5e61c384254 100755 --- a/server-tools/instance-manager/CMakeLists.txt +++ b/server-tools/instance-manager/CMakeLists.txt @@ -36,3 +36,5 @@ 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) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index fab538dbee4..af9ed5ed8e3 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -154,3 +154,8 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES 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) diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index c0c3a44c7cf..22e0211f052 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -91,4 +91,7 @@ IF(EMBED_MANIFESTS) MYSQL_EMBED_MANIFEST("maria_pack" "asInvoker") ENDIF(EMBED_MANIFESTS) +INSTALL(TARGETS maria_ftdump maria_chk maria_read_log maria_pack maria_dump_log + DESTINATION bin COMPONENT runtime) + ENDIF(NOT SOURCE_SUBLIBS) diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt index 1a667e271af..7744f4337ef 100644 --- a/storage/myisam/CMakeLists.txt +++ b/storage/myisam/CMakeLists.txt @@ -70,4 +70,6 @@ IF(NOT SOURCE_SUBLIBS) MYSQL_EMBED_MANIFEST("myisampack" "asInvoker") ENDIF(EMBED_MANIFESTS) + INSTALL(TARGETS myisam_ftdump myisamchk myisamlog myisampack DESTINATION bin COMPONENT runtime) + ENDIF(NOT SOURCE_SUBLIBS) diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 5ba1c0e5747..339fe7854c7 100755 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -30,4 +30,6 @@ SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c IF(NOT SOURCE_SUBLIBS) ADD_LIBRARY(strings ${STRINGS_SOURCES}) + + INSTALL(TARGETS strings DESTINATION lib/opt COMPONENT runtime) # TODO: Component ENDIF(NOT SOURCE_SUBLIBS) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2093fc0da36..245c9ce8666 100755 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,3 +25,5 @@ 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) diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index 43235b631f6..a4b75bd5744 100755 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -27,4 +27,6 @@ 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) From c77f7c3010be4384d2ba8682cb30b5c818d103ac Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Mon, 28 Jun 2010 15:16:19 +0200 Subject: [PATCH 04/15] Fix installing the localized error messages with cpack --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8245b886db..c1c3fe2722f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,12 +396,12 @@ SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} INSTALL(FILES sql/share/errmsg.txt DESTINATION share COMPONENT runtime) FILE(GLOB charsets sql/share/charsets/*) INSTALL(FILES ${charsets} DESTINATION share/charsets COMPONENT runtime) -FILE(GLOB share_dirs sql/share/*) -FOREACH(SUBDIR ${share_dirs}) - FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${SUBDIR}) - IF (EXISTS ${SUBDIR}/errmsg.sys) - INSTALL(FILES ${SUBDIR}/errmsg.sys DESTINATION share/${DIRNAME} COMPONENT runtime) - ENDIF(EXISTS ${SUBDIR}/errmsg.sys) +FILE(GLOB share_dirs sql/share/*/errmsg.sys) +FOREACH(ERRMSGFILE ${share_dirs}) + STRING(REPLACE "//" "/" ERRMSGFILE ${ERRMSGFILE}) # Work around a cmake bug + FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${ERRMSGFILE}) + STRING(REPLACE "/errmsg.sys" "" DIRNAME ${DIRNAME}) + INSTALL(FILES ${ERRMSGFILE} DESTINATION share/${DIRNAME} COMPONENT runtime) ENDFOREACH(SUBDIR ${share_dirs}) INCLUDE(InstallRequiredSystemLibraries) From 1c0f9f9d7eb2c9985fb3948ee87982673a8c8a80 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Mon, 28 Jun 2010 15:31:47 +0200 Subject: [PATCH 05/15] Fix a loop and install more script files. Renames the perlscripts component to scripts, since it now also has sql scripts. --- CMakeLists.txt | 12 ++++++------ scripts/CMakeLists.txt | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1c3fe2722f..425039ea062 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -355,11 +355,11 @@ SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Header files for development on MariaDB SET(CPACK_COMPONENT_HEADERS_DEPENDS runtime) SET(CPACK_COMPONENT_HEADERS_GROUP "Development") SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Development) -SET(CPACK_COMPONENT_PERLSCRIPTS_DISPLAY_NAME "Server perl scripts") -SET(CPACK_COMPONENT_PERLSCRIPTS_DESCRIPTION "Scripts to controll and modify the server. You need a perl installation for these to work.") -SET(CPACK_COMPONENT_PERLSCRIPTS_DEPENDS runtime) -SET(CPACK_COMPONENT_PERLSCRIPTS_GROUP "Server") -SET(CPACK_COMPONENT_PERLSCRIPTS_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_SCRIPTS_DISPLAY_NAME "Server scripts") +SET(CPACK_COMPONENT_SCRIPTS_DESCRIPTION "SQL and Perl scripts to control and modify the server. You need a perl installation for some of these to work.") +SET(CPACK_COMPONENT_SCRIPTS_DEPENDS runtime) +SET(CPACK_COMPONENT_SCRIPTS_GROUP "Server") +SET(CPACK_COMPONENT_SCRIPTS_INSTALL_TYPES Normal Development) # TODO: Add debug files # TODO: Add embedded server files # TODO: Add test files @@ -402,7 +402,7 @@ FOREACH(ERRMSGFILE ${share_dirs}) FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${ERRMSGFILE}) STRING(REPLACE "/errmsg.sys" "" DIRNAME ${DIRNAME}) INSTALL(FILES ${ERRMSGFILE} DESTINATION share/${DIRNAME} COMPONENT runtime) -ENDFOREACH(SUBDIR ${share_dirs}) +ENDFOREACH(ERRMSGFILE ${share_dirs}) INCLUDE(InstallRequiredSystemLibraries) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index aa7fa03cf03..eee70fdf776 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -79,4 +79,8 @@ CONFIGURE_FILE(mysqlhotcopy.sh INSTALL(FILES 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 perlscripts) + DESTINATION scripts COMPONENT scripts) + +INSTALL(FILES fill_help_tables.sql mysql_fix_privilege_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) From 6a6d87186a5bf74bc4efd3a5bdb2592107164cd7 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Mon, 28 Jun 2010 16:05:34 +0200 Subject: [PATCH 06/15] Install the storage engine plugins --- storage/mysql_storage_engine.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/mysql_storage_engine.cmake b/storage/mysql_storage_engine.cmake index af8c3a85cd1..3aba9773202 100644 --- a/storage/mysql_storage_engine.cmake +++ b/storage/mysql_storage_engine.cmake @@ -38,6 +38,8 @@ IF(NOT SOURCE_SUBLIBS) 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) MESSAGE("build ${engine} as DLL") ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC") ENDIF(NOT SOURCE_SUBLIBS) From 3a2e38aa2829eee3b4b66bd51e43c4be1c11b36b Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Mon, 28 Jun 2010 16:41:43 +0200 Subject: [PATCH 07/15] Install the files for the embedded server --- CMakeLists.txt | 7 +++++-- libmysqld/CMakeLists.txt | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 425039ea062..7a938e73c09 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -355,13 +355,16 @@ SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Header files for development on MariaDB SET(CPACK_COMPONENT_HEADERS_DEPENDS runtime) SET(CPACK_COMPONENT_HEADERS_GROUP "Development") SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Development) +SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded") +SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Files for embedding MariaDB in other projects.") +SET(CPACK_COMPONENT_EMBEDDED_DEPENDS headers) +SET(CPACK_COMPONENT_EMBEDDED_GROUP "Development") +SET(CPACK_COMPONENT_EMBEDDED_INSTALL_TYPES Development) SET(CPACK_COMPONENT_SCRIPTS_DISPLAY_NAME "Server scripts") SET(CPACK_COMPONENT_SCRIPTS_DESCRIPTION "SQL and Perl scripts to control and modify the server. You need a perl installation for some of these to work.") SET(CPACK_COMPONENT_SCRIPTS_DEPENDS runtime) SET(CPACK_COMPONENT_SCRIPTS_GROUP "Server") SET(CPACK_COMPONENT_SCRIPTS_INSTALL_TYPES Normal Development) -# TODO: Add debug files -# TODO: Add embedded server files # TODO: Add test files # TODO: Add sql-bench diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 9adf91c997b..495a8375af8 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -166,3 +166,8 @@ ENDFOREACH(ENGINE_LIB) 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 libmysqld DESTINATION Embedded/DLL COMPONENT embedded) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/Release/libmysqld.exp DESTINATION Embedded/DLL COMPONENT embedded) From e4379c5131233862f085ed49bea812e2f7cfd1a4 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Tue, 29 Jun 2010 11:26:10 +0200 Subject: [PATCH 08/15] Install MTR and SQL-bench with CPack and NSIS --- CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a938e73c09..cc13e198294 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -365,8 +365,16 @@ SET(CPACK_COMPONENT_SCRIPTS_DESCRIPTION "SQL and Perl scripts to control and mod SET(CPACK_COMPONENT_SCRIPTS_DEPENDS runtime) SET(CPACK_COMPONENT_SCRIPTS_GROUP "Server") SET(CPACK_COMPONENT_SCRIPTS_INSTALL_TYPES Normal Development) -# TODO: Add test files -# TODO: Add sql-bench +SET(CPACK_COMPONENT_MYSQLTEST_DISPLAY_NAME "MariaDB test suite") +SET(CPACK_COMPONENT_MYSQLTEST_DESCRIPTION "The MariaDB regression test suite.") +SET(CPACK_COMPONENT_MYSQLTEST_DEPENDS runtime) +SET(CPACK_COMPONENT_MYSQLTEST_GROUP "Testing") +SET(CPACK_COMPONENT_MYSQLTEST_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_SQLBENCH_DISPLAY_NAME "SQL Bench") +SET(CPACK_COMPONENT_SQLBENCH_DESCRIPTION "The MariaDB benchmark suite.") +SET(CPACK_COMPONENT_SQLBENCH_DEPENDS runtime) +SET(CPACK_COMPONENT_SQLBENCH_GROUP "Testing") +SET(CPACK_COMPONENT_SQLBENCH_INSTALL_TYPES Normal Development) # Add files to the installer INSTALL(FILES COPYING EXCEPTIONS-CLIENT DESTINATION .) @@ -407,6 +415,40 @@ FOREACH(ERRMSGFILE ${share_dirs}) INSTALL(FILES ${ERRMSGFILE} DESTINATION share/${DIRNAME} COMPONENT runtime) ENDFOREACH(ERRMSGFILE ${share_dirs}) +# MTR files +FILE(GLOB_RECURSE testfiles mysql-test/*) +FOREACH(testfile ${testfiles}) + FILE(RELATIVE_PATH dirname ${PROJECT_SOURCE_DIR} ${testfile}) + GET_FILENAME_COMPONENT(dirname ${dirname} PATH) + GET_FILENAME_COMPONENT(filename ${testfile} NAME) + GET_FILENAME_COMPONENT(ext ${testfile} EXT) + SET(ok "yes") + IF (NOT "x_${ext}" STREQUAL "x_") + # Test if this is one of the extensions we don't want to install + STRING(TOLOWER ${ext} ext) + IF(${ext} STREQUAL ".dir" OR ${ext} STREQUAL ".vcproj" OR ${ext} STREQUAL ".user" OR ${ext} STREQUAL ".ilk" + OR ${ext} STREQUAL ".idb" OR ${ext} STREQUAL ".map" OR ${ext} STREQUAL ".gcov" + OR ${ext} STREQUAL ".supp" OR ${ext} STREQUAL ".am" OR ${ext} STREQUAL ".stress") + SET(ok "no") + ENDIF() + ENDIF(NOT "x_${ext}" STREQUAL "x_") + IF (${ok} STREQUAL "yes") + # Message("Dir: ${dirname}. File: ${filename}. Ext: ${ext}") + INSTALL(FILES ${testfile} DESTINATION ${dirname} COMPONENT mysqltest) + ENDIF(${ok} STREQUAL "yes") +ENDFOREACH(testfile ${testfiles}) + +# SQL Bench +FILE(GLOB_RECURSE benchfiles sql-bench/*) +FOREACH(testfile ${testfiles}) + FILE(RELATIVE_PATH dirname ${PROJECT_SOURCE_DIR} ${testfile}) + GET_FILENAME_COMPONENT(dirname ${dirname} PATH) + GET_FILENAME_COMPONENT(filename ${testfile} NAME) + IF(NOT ${dirname} STREQUAL "sql-bench" OR ${filename} STREQUAL "README") + INSTALL(FILES ${testfile} DESTINATION ${dirname} COMPONENT sqlbench) + ENDIF() +ENDFOREACH(testfile ${testfiles}) + INCLUDE(InstallRequiredSystemLibraries) # This must always be the last line From ccdbcaeb57d203cc7b16965f0216e3e96a850e56 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Wed, 30 Jun 2010 14:10:40 +0200 Subject: [PATCH 09/15] Install MariaDB as a service with the installer --- CMakeLists.txt | 3 + win/cmake/NSIS.template.in | 995 +++++++++++++++++++++++++++++++++++++ 2 files changed, 998 insertions(+) create mode 100644 win/cmake/NSIS.template.in diff --git a/CMakeLists.txt b/CMakeLists.txt index cc13e198294..5cfe5dc8319 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,6 +342,9 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB") SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) SET(CPACK_GENERATOR NSIS) +# Use our own NSIS template +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/win/cmake" ${CMAKE_MODULE_PATH}) + # Installer components and grouping SET(CPACK_COMPONENT_GROUP_SERVER_DESCRIPTION "The files necessary for running the MariaDB server.") SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files used in development on the MariaDB server.") diff --git a/win/cmake/NSIS.template.in b/win/cmake/NSIS.template.in new file mode 100644 index 00000000000..0c39ba630dc --- /dev/null +++ b/win/cmake/NSIS.template.in @@ -0,0 +1,995 @@ +; CPack install script designed for a nmake build + +;-------------------------------- +; You must define these values + + !define VERSION "@CPACK_PACKAGE_VERSION@" + !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@" + !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" + +;-------------------------------- +;Variables + + Var MUI_TEMP + Var STARTMENU_FOLDER + Var SV_ALLUSERS + Var START_MENU + Var DO_NOT_ADD_TO_PATH + Var ADD_TO_PATH_ALL_USERS + Var ADD_TO_PATH_CURRENT_USER + Var INSTALL_DESKTOP + Var IS_DEFAULT_INSTALLDIR + + Var INSTALL_AS_SERVICE + Var INSTALL_AS_SERVICE_CHECKBOX + +;-------------------------------- +;Include Modern UI + + !include "MUI.nsh" + + ;Default installation folder + InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + +;Include the nsDialogs package + !include nsDialogs.nsh + !include LogicLib.nsh + +;-------------------------------- +;General + + ;Name and file + Name "@CPACK_NSIS_PACKAGE_NAME@" + OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" + + ;Set compression + SetCompressor @CPACK_NSIS_COMPRESSOR@ + +@CPACK_NSIS_DEFINES@ + + !include Sections.nsh + +;--- Component support macros: --- +; The code for the add/remove functionality is from: +; http://nsis.sourceforge.net/Add/Remove_Functionality +; It has been modified slightly and extended to provide +; inter-component dependencies. +Var AR_SecFlags +Var AR_RegFlags +@CPACK_NSIS_SECTION_SELECTED_VARS@ + +; Loads the "selected" flag for the section named SecName into the +; variable VarName. +!macro LoadSectionSelectedIntoVar SecName VarName + SectionGetFlags ${${SecName}} $${VarName} + IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits +!macroend + +; Loads the value of a variable... can we get around this? +!macro LoadVar VarName + IntOp $R0 0 + $${VarName} +!macroend + +; Sets the value of a variable +!macro StoreVar VarName IntValue + IntOp $${VarName} 0 + ${IntValue} +!macroend + +!macro InitSection SecName + ; This macro reads component installed flag from the registry and + ;changes checked state of the section on the components page. + ;Input: section index constant name specified in Section command. + + ClearErrors + ;Reading component status from registry + ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed" + IfErrors "default_${SecName}" + ;Status will stay default if registry value not found + ;(component was never installed) + IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags + IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off + IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit + + ; Note whether this component was installed before + !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags + IntOp $R0 $AR_RegFlags & $AR_RegFlags + + ;Writing modified flags + SectionSetFlags ${${SecName}} $AR_SecFlags + + "default_${SecName}:" + !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected +!macroend + +!macro FinishSection SecName + ; This macro reads section flag set by user and removes the section + ;if it is not selected. + ;Then it writes component installed flag to registry + ;Input: section index constant name specified in Section command. + + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags + ;Checking lowest bit: + IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} + IntCmp $AR_SecFlags 1 "leave_${SecName}" + ;Section is not selected: + ;Calling Section uninstall macro and writing zero installed flag + !insertmacro "Remove_${${SecName}}" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \ + "Installed" 0 + Goto "exit_${SecName}" + + "leave_${SecName}:" + ;Section is selected: + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \ + "Installed" 1 + + "exit_${SecName}:" +!macroend + +!macro RemoveSection SecName + ; This macro is used to call section's Remove_... macro + ;from the uninstaller. + ;Input: section index constant name specified in Section command. + + !insertmacro "Remove_${${SecName}}" +!macroend + +; Determine whether the selection of SecName changed +!macro MaybeSelectionChanged SecName + !insertmacro LoadVar ${SecName}_selected + SectionGetFlags ${${SecName}} $R1 + IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits + + ; See if the status has changed: + IntCmp $R0 $R1 "${SecName}_unchanged" + !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected + + IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" + !insertmacro "Deselect_required_by_${SecName}" + goto "${SecName}_unchanged" + + "${SecName}_was_selected:" + !insertmacro "Select_${SecName}_depends" + + "${SecName}_unchanged:" +!macroend +;--- End of Add/Remove macros --- + +;-------------------------------- +;Interface Settings + + !define MUI_HEADERIMAGE + !define MUI_ABORTWARNING + +;-------------------------------- +; path functions + +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 + +;---------------------------------------- +; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" +;---------------------------------------- +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 +;==================================================== +; get_NT_environment +; Returns: the selected environment +; Output : head of the stack +;==================================================== +!macro select_NT_profile UN +Function ${UN}select_NT_profile + StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single + DetailPrint "Selected environment for all users" + Push "all" + Return + environment_single: + DetailPrint "Selected environment for current user only." + Push "current" + Return +FunctionEnd +!macroend +!insertmacro select_NT_profile "" +!insertmacro select_NT_profile "un." +;---------------------------------------------------- +!define NT_current_env 'HKCU "Environment"' +!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + +!ifndef WriteEnvStr_RegKey + !ifdef ALL_USERS + !define WriteEnvStr_RegKey \ + 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + !else + !define WriteEnvStr_RegKey 'HKCU "Environment"' + !endif +!endif + +; AddToPath - Adds the given dir to the search path. +; Input - head of the stack +; Note - Win9x systems requires reboot + +Function AddToPath + Exch $0 + Push $1 + Push $2 + Push $3 + + # don't add if the path doesn't exist + IfFileExists "$0\*.*" "" AddToPath_done + + ReadEnvStr $1 PATH + ; if the path is too long for a NSIS variable NSIS will return a 0 + ; length string. If we find that, then warn and skip any path + ; modification as it will trash the existing path. + StrLen $2 $1 + IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done + CheckPathLength_ShowPathWarning: + Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" + Goto AddToPath_done + CheckPathLength_Done: + Push "$1;" + Push "$0;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$0\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + GetFullPathName /SHORT $3 $0 + Push "$1;" + Push "$3;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$3\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + + Call IsNT + Pop $1 + StrCmp $1 1 AddToPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" a + FileSeek $1 -1 END + FileReadByte $1 $2 + IntCmp $2 26 0 +2 +2 # DOS EOF + FileSeek $1 -1 END # write over EOF + FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" + FileClose $1 + SetRebootFlag true + Goto AddToPath_done + + AddToPath_NT: + StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey + ReadRegStr $1 ${NT_current_env} "PATH" + Goto DoTrim + ReadAllKey: + ReadRegStr $1 ${NT_all_env} "PATH" + DoTrim: + StrCmp $1 "" AddToPath_NTdoIt + Push $1 + Call Trim + Pop $1 + StrCpy $0 "$1;$0" + AddToPath_NTdoIt: + StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey + WriteRegExpandStr ${NT_current_env} "PATH" $0 + Goto DoSend + WriteAllKey: + WriteRegExpandStr ${NT_all_env} "PATH" $0 + DoSend: + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + AddToPath_done: + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + + +; RemoveFromPath - Remove a given dir from the path +; Input: head of the stack + +Function un.RemoveFromPath + Exch $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + + IntFmt $6 "%c" 26 # DOS EOF + + Call un.IsNT + Pop $1 + StrCmp $1 1 unRemoveFromPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" r + GetTempFileName $4 + FileOpen $2 $4 w + GetFullPathName /SHORT $0 $0 + StrCpy $0 "SET PATH=%PATH%;$0" + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoop: + FileRead $1 $3 + StrCpy $5 $3 1 -1 # read last char + StrCmp $5 $6 0 +2 # if DOS EOF + StrCpy $3 $3 -1 # remove DOS EOF so we can compare + StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "" unRemoveFromPath_dosLoopEnd + FileWrite $2 $3 + Goto unRemoveFromPath_dosLoop + unRemoveFromPath_dosLoopRemoveLine: + SetRebootFlag true + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoopEnd: + FileClose $2 + FileClose $1 + StrCpy $1 $WINDIR 2 + Delete "$1\autoexec.bat" + CopyFiles /SILENT $4 "$1\autoexec.bat" + Delete $4 + Goto unRemoveFromPath_done + + unRemoveFromPath_NT: + StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey + ReadRegStr $1 ${NT_current_env} "PATH" + Goto unDoTrim + unReadAllKey: + ReadRegStr $1 ${NT_all_env} "PATH" + unDoTrim: + StrCpy $5 $1 1 -1 # copy last char + StrCmp $5 ";" +2 # if last char != ; + StrCpy $1 "$1;" # append ; + Push $1 + Push "$0;" + Call un.StrStr ; Find `$0;` in $1 + Pop $2 ; pos of our dir + StrCmp $2 "" unRemoveFromPath_done + ; else, it is in path + # $0 - path to add + # $1 - path var + StrLen $3 "$0;" + StrLen $4 $2 + StrCpy $5 $1 -$4 # $5 is now the part before the path to remove + StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove + StrCpy $3 $5$6 + + StrCpy $5 $3 1 -1 # copy last char + StrCmp $5 ";" 0 +2 # if last char == ; + StrCpy $3 $3 -1 # remove last char + + StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey + WriteRegExpandStr ${NT_current_env} "PATH" $3 + Goto unDoSend + unWriteAllKey: + WriteRegExpandStr ${NT_all_env} "PATH" $3 + unDoSend: + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + unRemoveFromPath_done: + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + +Function InstallServicePage + !insertmacro MUI_HEADER_TEXT "Service Setup" "Run MariaDB automatically." + + nsDialogs::Create /NOUNLOAD 1018 + Pop $0 + + ${If} $0 == error + Abort + ${EndIf} + + ${NSD_CreateLabel} 0u 0u 100% 9u "Should MariaDB be installed as a service?" + Pop $0 + + ${NSD_CreateCheckBox} 0u 14u 100% 16u "&Yes, please install the service." + Pop $INSTALL_AS_SERVICE_CHECKBOX + GetFunctionAddress $0 ServiceCheckBoxClicked + nsDialogs::OnClick /NOUNLOAD $INSTALL_AS_SERVICE_CHECKBOX $0 + + ${NSD_CreateLabel} 0u 30u 100% 35u "If this option is checked, this installer will add MariaDB to the list of services and start it." + Pop $0 + + nsDialogs::Show +FunctionEnd + +Function ServiceCheckBoxClicked + ${NSD_GetState} $INSTALL_AS_SERVICE_CHECKBOX $INSTALL_AS_SERVICE +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Uninstall sutff +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +########################################### +# Utility Functions # +########################################### + +;==================================================== +; IsNT - Returns 1 if the current system is NT, 0 +; otherwise. +; Output: head of the stack +;==================================================== +; IsNT +; no input +; output, top of the stack = 1 if NT or 0 if not +; +; Usage: +; Call IsNT +; Pop $R0 +; ($R0 at this point is 1 or 0) + +!macro IsNT un +Function ${un}IsNT + Push $0 + ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + StrCmp $0 "" 0 IsNT_yes + ; we are not NT. + Pop $0 + Push 0 + Return + + IsNT_yes: + ; NT!!! + Pop $0 + Push 1 +FunctionEnd +!macroend +!insertmacro IsNT "" +!insertmacro IsNT "un." + +; StrStr +; input, top of stack = string to search for +; top of stack-1 = string to search in +; output, top of stack (replaces with the portion of the string remaining) +; modifies no other variables. +; +; Usage: +; Push "this is a long ass string" +; Push "ass" +; Call StrStr +; Pop $R0 +; ($R0 at this point is "ass string") + +!macro StrStr un +Function ${un}StrStr +Exch $R1 ; st=haystack,old$R1, $R1=needle + Exch ; st=old$R1,haystack + Exch $R2 ; st=old$R1,old$R2, $R2=haystack + Push $R3 + Push $R4 + Push $R5 + StrLen $R3 $R1 + StrCpy $R4 0 + ; $R1=needle + ; $R2=haystack + ; $R3=len(needle) + ; $R4=cnt + ; $R5=tmp + loop: + StrCpy $R5 $R2 $R3 $R4 + StrCmp $R5 $R1 done + StrCmp $R5 "" done + IntOp $R4 $R4 + 1 + Goto loop +done: + StrCpy $R1 $R2 "" $R4 + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Exch $R1 +FunctionEnd +!macroend +!insertmacro StrStr "" +!insertmacro StrStr "un." + +Function Trim ; Added by Pelaca + Exch $R1 + Push $R2 +Loop: + StrCpy $R2 "$R1" 1 -1 + StrCmp "$R2" " " RTrim + StrCmp "$R2" "$\n" RTrim + StrCmp "$R2" "$\r" RTrim + StrCmp "$R2" ";" RTrim + GoTo Done +RTrim: + StrCpy $R1 "$R1" -1 + Goto Loop +Done: + Pop $R2 + Exch $R1 +FunctionEnd + +Function ConditionalAddToRegisty + Pop $0 + Pop $1 + StrCmp "$0" "" ConditionalAddToRegisty_EmptyString + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \ + "$1" "$0" + ;MessageBox MB_OK "Set Registry: '$1' to '$0'" + DetailPrint "Set install registry entry: '$1' to '$0'" + ConditionalAddToRegisty_EmptyString: +FunctionEnd + +;-------------------------------- + +!ifdef CPACK_USES_DOWNLOAD +Function DownloadFile + IfFileExists $INSTDIR\* +2 + CreateDirectory $INSTDIR + Pop $0 + + ; Skip if already downloaded + IfFileExists $INSTDIR\$0 0 +2 + Return + + StrCpy $1 "@CPACK_DOWNLOAD_SITE@" + + try_again: + NSISdl::download "$1/$0" "$INSTDIR\$0" + + Pop $1 + StrCmp $1 "success" success + StrCmp $1 "Cancelled" cancel + MessageBox MB_OK "Download failed: $1" + cancel: + Return + success: +FunctionEnd +!endif + +;-------------------------------- +; Installation types +@CPACK_NSIS_INSTALLATION_TYPES@ + +;-------------------------------- +; Component sections +@CPACK_NSIS_COMPONENT_SECTIONS@ + +;-------------------------------- +; Define some macro setting for the gui +@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ +@CPACK_NSIS_INSTALLER_ICON_CODE@ +@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ + +;-------------------------------- +;Pages + !insertmacro MUI_PAGE_WELCOME + + !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" + Page custom InstallOptionsPage + !insertmacro MUI_PAGE_DIRECTORY + + ;Start Menu Folder Page Configuration + !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" + !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER + + @CPACK_NSIS_PAGE_COMPONENTS@ + + Page custom InstallServicePage + + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" ;first language is the default language + !insertmacro MUI_LANGUAGE "Albanian" + !insertmacro MUI_LANGUAGE "Arabic" + !insertmacro MUI_LANGUAGE "Basque" + !insertmacro MUI_LANGUAGE "Belarusian" + !insertmacro MUI_LANGUAGE "Bosnian" + !insertmacro MUI_LANGUAGE "Breton" + !insertmacro MUI_LANGUAGE "Bulgarian" + !insertmacro MUI_LANGUAGE "Croatian" + !insertmacro MUI_LANGUAGE "Czech" + !insertmacro MUI_LANGUAGE "Danish" + !insertmacro MUI_LANGUAGE "Dutch" + !insertmacro MUI_LANGUAGE "Estonian" + !insertmacro MUI_LANGUAGE "Farsi" + !insertmacro MUI_LANGUAGE "Finnish" + !insertmacro MUI_LANGUAGE "French" + !insertmacro MUI_LANGUAGE "German" + !insertmacro MUI_LANGUAGE "Greek" + !insertmacro MUI_LANGUAGE "Hebrew" + !insertmacro MUI_LANGUAGE "Hungarian" + !insertmacro MUI_LANGUAGE "Icelandic" + !insertmacro MUI_LANGUAGE "Indonesian" + !insertmacro MUI_LANGUAGE "Irish" + !insertmacro MUI_LANGUAGE "Italian" + !insertmacro MUI_LANGUAGE "Japanese" + !insertmacro MUI_LANGUAGE "Korean" + !insertmacro MUI_LANGUAGE "Kurdish" + !insertmacro MUI_LANGUAGE "Latvian" + !insertmacro MUI_LANGUAGE "Lithuanian" + !insertmacro MUI_LANGUAGE "Luxembourgish" + !insertmacro MUI_LANGUAGE "Macedonian" + !insertmacro MUI_LANGUAGE "Malay" + !insertmacro MUI_LANGUAGE "Mongolian" + !insertmacro MUI_LANGUAGE "Norwegian" + !insertmacro MUI_LANGUAGE "Polish" + !insertmacro MUI_LANGUAGE "Portuguese" + !insertmacro MUI_LANGUAGE "PortugueseBR" + !insertmacro MUI_LANGUAGE "Romanian" + !insertmacro MUI_LANGUAGE "Russian" + !insertmacro MUI_LANGUAGE "Serbian" + !insertmacro MUI_LANGUAGE "SerbianLatin" + !insertmacro MUI_LANGUAGE "SimpChinese" + !insertmacro MUI_LANGUAGE "Slovak" + !insertmacro MUI_LANGUAGE "Slovenian" + !insertmacro MUI_LANGUAGE "Spanish" + !insertmacro MUI_LANGUAGE "Swedish" + !insertmacro MUI_LANGUAGE "Thai" + !insertmacro MUI_LANGUAGE "TradChinese" + !insertmacro MUI_LANGUAGE "Turkish" + !insertmacro MUI_LANGUAGE "Ukrainian" + !insertmacro MUI_LANGUAGE "Welsh" + + +;-------------------------------- +;Reserve Files + + ;These files should be inserted before other files in the data block + ;Keep these lines before any File command + ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) + + ReserveFile "NSIS.InstallOptions.ini" + !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS + +;-------------------------------- +;Installer Sections + +Section "-Core installation" + ;Use the entire tree produced by the INSTALL target. Keep the + ;list of directories here in sync with the RMDir commands below. + SetOutPath "$INSTDIR" + @CPACK_NSIS_FULL_INSTALL@ + + ;Store installation folder + WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR + + ;Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" + Push "DisplayName" + Push "@CPACK_NSIS_DISPLAY_NAME@" + Call ConditionalAddToRegisty + Push "DisplayVersion" + Push "@CPACK_PACKAGE_VERSION@" + Call ConditionalAddToRegisty + Push "Publisher" + Push "@CPACK_PACKAGE_VENDOR@" + Call ConditionalAddToRegisty + Push "UninstallString" + Push "$INSTDIR\Uninstall.exe" + Call ConditionalAddToRegisty + Push "NoRepair" + Push "1" + Call ConditionalAddToRegisty + + !ifdef CPACK_NSIS_ADD_REMOVE + ;Create add/remove functionality + Push "ModifyPath" + Push "$INSTDIR\AddRemove.exe" + Call ConditionalAddToRegisty + !else + Push "NoModify" + Push "1" + Call ConditionalAddToRegisty + !endif + + ; Optional registration + Push "DisplayIcon" + Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" + Call ConditionalAddToRegisty + Push "HelpLink" + Push "@CPACK_NSIS_HELP_LINK@" + Call ConditionalAddToRegisty + Push "URLInfoAbout" + Push "@CPACK_NSIS_URL_INFO_ABOUT@" + Call ConditionalAddToRegisty + Push "Contact" + Push "@CPACK_NSIS_CONTACT@" + Call ConditionalAddToRegisty + !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + + ;Create shortcuts + CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" +@CPACK_NSIS_CREATE_ICONS@ +@CPACK_NSIS_CREATE_ICONS_EXTRA@ + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + + ;Read a value from an InstallOptions INI file + !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" + + ; Write special uninstall registry entries + Push "StartMenu" + Push "$STARTMENU_FOLDER" + Call ConditionalAddToRegisty + Push "DoNotAddToPath" + Push "$DO_NOT_ADD_TO_PATH" + Call ConditionalAddToRegisty + Push "AddToPathAllUsers" + Push "$ADD_TO_PATH_ALL_USERS" + Call ConditionalAddToRegisty + Push "AddToPathCurrentUser" + Push "$ADD_TO_PATH_CURRENT_USER" + Call ConditionalAddToRegisty + Push "InstallToDesktop" + Push "$INSTALL_DESKTOP" + Call ConditionalAddToRegisty + + !insertmacro MUI_STARTMENU_WRITE_END + +@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ + + ${If} $INSTALL_AS_SERVICE == ${BST_CHECKED} + ;MessageBox MB_OK "Install the service" + nsExec::Exec '"$INSTDIR\bin\mysqld.exe" --install "@CPACK_PACKAGE_NAME@-@CPACK_PACKAGE_VERSION@"' + nsExec::Exec 'net start "@CPACK_PACKAGE_NAME@-@CPACK_PACKAGE_VERSION@"' + ${EndIf} + +SectionEnd + +Section "-Add to path" + Push $INSTDIR\bin + StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath + StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 + Call AddToPath + doNotAddToPath: +SectionEnd + +;-------------------------------- +; Create custom pages +Function InstallOptionsPage + !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" + +FunctionEnd + +;-------------------------------- +; determine admin versus local install +Function un.onInit + + ClearErrors + UserInfo::GetName + IfErrors noLM + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Admin group' + Goto done + StrCmp $1 "Power" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Power Users group' + Goto done + + noLM: + ;Get installation folder from registry if available + + done: + +FunctionEnd + +;--- Add/Remove callback functions: --- +!macro SectionList MacroName + ;This macro used to perform operation on multiple sections. + ;List all of your components in following manner here. +@CPACK_NSIS_COMPONENT_SECTION_LIST@ +!macroend + +Section -FinishComponents + ;Removes unselected components and writes component status to registry + !insertmacro SectionList "FinishSection" + +!ifdef CPACK_NSIS_ADD_REMOVE + ; Get the name of the installer executable + System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' + StrCpy $R3 $R0 + + ; Strip off the last 13 characters, to see if we have AddRemove.exe + StrLen $R1 $R0 + IntOp $R1 $R0 - 13 + StrCpy $R2 $R0 13 $R1 + StrCmp $R2 "AddRemove.exe" addremove_installed + + ; We're not running AddRemove.exe, so install it + CopyFiles $R3 $INSTDIR\AddRemove.exe + + addremove_installed: +!endif +SectionEnd +;--- End of Add/Remove callback functions --- + +;-------------------------------- +; Component dependencies +Function .onSelChange + !insertmacro SectionList MaybeSelectionChanged +FunctionEnd + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + ReadRegStr $START_MENU SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu" + ;MessageBox MB_OK "Start menu is in: $START_MENU" + ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath" + ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers" + ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser" + ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" + ReadRegStr $INSTALL_DESKTOP SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop" + ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " + +@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ + + nsExec::Exec 'net stop "@CPACK_PACKAGE_NAME@-@CPACK_PACKAGE_VERSION@"' + nsExec::Exec '"$INSTDIR\bin\mysqld.exe" --remove "@CPACK_PACKAGE_NAME@-@CPACK_PACKAGE_VERSION@"' + + ;Remove files we installed. + ;Keep the list of directories here in sync with the File commands above. +@CPACK_NSIS_DELETE_FILES@ +@CPACK_NSIS_DELETE_DIRECTORIES@ + +!ifdef CPACK_NSIS_ADD_REMOVE + ;Remove the add/remove program + Delete "$INSTDIR\AddRemove.exe" +!endif + + ;Remove the uninstaller itself. + Delete "$INSTDIR\Uninstall.exe" + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" + + ;Remove the installation directory if it is empty. + RMDir "$INSTDIR" + + ; Remove the registry entries. + DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + + ; Removes all optional components + !insertmacro SectionList "RemoveSection" + + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" +@CPACK_NSIS_DELETE_ICONS@ +@CPACK_NSIS_DELETE_ICONS_EXTRA@ + + ;Delete empty start menu parent diretories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + + startMenuDeleteLoop: + ClearErrors + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + + IfErrors startMenuDeleteLoopDone + + StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop + startMenuDeleteLoopDone: + + ; If the user changed the shortcut, then untinstall may not work. This should + ; try to fix it. + StrCpy $MUI_TEMP "$START_MENU" + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" +@CPACK_NSIS_DELETE_ICONS_EXTRA@ + + ;Delete empty start menu parent diretories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + + secondStartMenuDeleteLoop: + ClearErrors + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + + IfErrors secondStartMenuDeleteLoopDone + + StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop + secondStartMenuDeleteLoopDone: + + DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + + Push $INSTDIR\bin + StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 + Call un.RemoveFromPath + doNotRemoveFromPath: +SectionEnd + +;-------------------------------- +; determine admin versus local install +; Is install for "AllUsers" or "JustMe"? +; Default to "JustMe" - set to "AllUsers" if admin or on Win9x +; This function is used for the very first "custom page" of the installer. +; This custom page does not show up visibly, but it executes prior to the +; first visible page and sets up $INSTDIR properly... +; Choose different default installation folder based on SV_ALLUSERS... +; "Program Files" for AllUsers, "My Documents" for JustMe... + +Function .onInit + ; Reads components status for registry + !insertmacro SectionList "InitSection" + + ; check to see if /D has been used to change + ; the install directory by comparing it to the + ; install directory that is expected to be the + ; default + StrCpy $IS_DEFAULT_INSTALLDIR 0 + StrCmp "$INSTDIR" "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 + StrCpy $IS_DEFAULT_INSTALLDIR 1 + + StrCpy $SV_ALLUSERS "JustMe" + ; if default install dir then change the default + ; if it is installed for JustMe + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + + ClearErrors + UserInfo::GetName + IfErrors noLM + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Admin group' + StrCpy $SV_ALLUSERS "AllUsers" + Goto done + StrCmp $1 "Power" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Power Users group' + StrCpy $SV_ALLUSERS "AllUsers" + Goto done + + noLM: + StrCpy $SV_ALLUSERS "AllUsers" + ;Get installation folder from registry if available + + done: + StrCmp $SV_ALLUSERS "AllUsers" 0 +3 + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + + StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" + + noOptionsPage: +FunctionEnd From 2caed165b119465458a14bca5226efc40ea850e9 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Thu, 1 Jul 2010 12:12:48 +0200 Subject: [PATCH 10/15] Fix cpack run --- CMakeLists.txt | 5 +++++ libmysqld/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cfe5dc8319..a6b52b8fdcc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,6 +342,11 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB") SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) SET(CPACK_GENERATOR NSIS) +# This will set the build type for CPack +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "RelWithDebInfo") +ENDIF() + # Use our own NSIS template set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/win/cmake" ${CMAKE_MODULE_PATH}) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 495a8375af8..1005d6fe032 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -170,4 +170,4 @@ TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32) INSTALL(TARGETS mysqlserver DESTINATION Embedded/static COMPONENT embedded) INSTALL(TARGETS libmysqld DESTINATION Embedded/DLL COMPONENT embedded) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/Release/libmysqld.exp DESTINATION Embedded/DLL COMPONENT embedded) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libmysqld.exp DESTINATION Embedded/DLL COMPONENT embedded) From 916f7c5680ed7ce8f33baf1bfbfcae78bb275a4c Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Thu, 1 Jul 2010 15:50:54 +0200 Subject: [PATCH 11/15] Hardcode the build path for the installer temporarily --- CMakeLists.txt | 5 ----- libmysqld/CMakeLists.txt | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6b52b8fdcc..5cfe5dc8319 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,11 +342,6 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB") SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) SET(CPACK_GENERATOR NSIS) -# This will set the build type for CPack -IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "RelWithDebInfo") -ENDIF() - # Use our own NSIS template set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/win/cmake" ${CMAKE_MODULE_PATH}) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 1005d6fe032..9526c944e50 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -170,4 +170,5 @@ TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32) INSTALL(TARGETS mysqlserver DESTINATION Embedded/static COMPONENT embedded) INSTALL(TARGETS libmysqld DESTINATION Embedded/DLL COMPONENT embedded) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libmysqld.exp DESTINATION Embedded/DLL COMPONENT embedded) + +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/libmysqld.exp DESTINATION Embedded/DLL COMPONENT embedded) From c4636b9df34768561ae24473ec0abee0623d02cf Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Thu, 1 Jul 2010 16:35:50 +0200 Subject: [PATCH 12/15] Remove the file libmysqld.exp from the installer --- libmysqld/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 9526c944e50..332dd206e15 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -170,5 +170,3 @@ TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32) INSTALL(TARGETS mysqlserver DESTINATION Embedded/static COMPONENT embedded) INSTALL(TARGETS libmysqld DESTINATION Embedded/DLL COMPONENT embedded) - -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/libmysqld.exp DESTINATION Embedded/DLL COMPONENT embedded) From 73c3a77b6a2532facc46d6a4318db7401be91154 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 1 Jul 2010 23:50:18 +0200 Subject: [PATCH 13/15] bug lp:578117 - Wrong usage of mutex LOCK_sync and LOCK_active in XA redone locking in TC_LOG_MMAP::log_xid --- mysql-test/suite/pbxt/r/pbxt_xa.result | 1 - mysql-test/suite/pbxt/t/pbxt_xa.test | 5 - sql/log.cc | 131 +++++++++++++++---------- 3 files changed, 77 insertions(+), 60 deletions(-) diff --git a/mysql-test/suite/pbxt/r/pbxt_xa.result b/mysql-test/suite/pbxt/r/pbxt_xa.result index 084a656a6db..8bcab926998 100644 --- a/mysql-test/suite/pbxt/r/pbxt_xa.result +++ b/mysql-test/suite/pbxt/r/pbxt_xa.result @@ -1,5 +1,4 @@ drop table if exists t1, t2; -CALL mtr.add_suppression("Found wrong usage of mutex 'LOCK_sync' and 'LOCK_active'"); CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=pbxt; BEGIN; diff --git a/mysql-test/suite/pbxt/t/pbxt_xa.test b/mysql-test/suite/pbxt/t/pbxt_xa.test index dfe4f0b0094..a9d1c5c38e8 100644 --- a/mysql-test/suite/pbxt/t/pbxt_xa.test +++ b/mysql-test/suite/pbxt/t/pbxt_xa.test @@ -4,11 +4,6 @@ drop table if exists t1, t2; --enable_warnings -# This warning is indication of a real bug, MBug#578117. -# But it is not a regression, so we suppress it to get a clean test run. -# This suppression must be removed as part of MBug#578117 fix. -CALL mtr.add_suppression("Found wrong usage of mutex 'LOCK_sync' and 'LOCK_active'"); - # # bug lp:544173, xa crash with two 2pc-capable storage engines without binlog # diff --git a/sql/log.cc b/sql/log.cc index cc236ef13d2..1b8cd52ebb0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -5285,39 +5285,39 @@ void sql_print_information(const char *format, ...) /********* transaction coordinator log for 2pc - mmap() based solution *******/ /* - the log consists of a file, mmapped to a memory. - file is divided on pages of tc_log_page_size size. - (usable size of the first page is smaller because of log header) - there's PAGE control structure for each page - each page (or rather PAGE control structure) can be in one of three - states - active, syncing, pool. - there could be only one page in active or syncing states, - but many in pool - pool is fifo queue. - usual lifecycle of a page is pool->active->syncing->pool - "active" page - is a page where new xid's are logged. - the page stays active as long as syncing slot is taken. - "syncing" page is being synced to disk. no new xid can be added to it. - when the sync is done the page is moved to a pool and an active page + the log consists of a file, mapped to memory. + file is divided into pages of tc_log_page_size size. + (usable size of the first page is smaller because of the log header) + there is a PAGE control structure for each page + each page (or rather its PAGE control structure) can be in one of + the three states - active, syncing, pool. + there could be only one page in the active or syncing state, + but many in pool - pool is a fifo queue. + the usual lifecycle of a page is pool->active->syncing->pool. + the "active" page is a page where new xid's are logged. + the page stays active as long as the syncing slot is taken. + the "syncing" page is being synced to disk. no new xid can be added to it. + when the syncing is done the page is moved to a pool and an active page becomes "syncing". the result of such an architecture is a natural "commit grouping" - If commits are coming faster than the system can sync, they do not - stall. Instead, all commit that came since the last sync are - logged to the same page, and they all are synced with the next - + stall. Instead, all commits that came since the last sync are + logged to the same "active" page, and they all are synced with the next - one - sync. Thus, thought individual commits are delayed, throughput is not decreasing. - when a xid is added to an active page, the thread of this xid waits + when an xid is added to an active page, the thread of this xid waits for a page's condition until the page is synced. when syncing slot becomes vacant one of these waiters is awaken to take care of syncing. it syncs the page and signals all waiters that the page is synced. PAGE::waiters is used to count these waiters, and a page may never become active again until waiters==0 (that is all waiters from the - previous sync have noticed the sync was completed) + previous sync have noticed that the sync was completed) note, that the page becomes "dirty" and has to be synced only when a new xid is added into it. Removing a xid from a page does not make it - dirty - we don't sync removals to disk. + dirty - we don't sync xid removals to disk. */ ulong tc_log_page_waits= 0; @@ -5383,7 +5383,8 @@ int TC_LOG_MMAP::open(const char *opt_name) inited=2; npages=(uint)file_length/tc_log_page_size; - DBUG_ASSERT(npages >= 3); // to guarantee non-empty pool + if (npages < 3) // to guarantee non-empty pool + goto err; if (!(pages=(PAGE *)my_malloc(npages*sizeof(PAGE), MYF(MY_WME|MY_ZEROFILL)))) goto err; inited=3; @@ -5440,7 +5441,7 @@ err: -# if there're waiters - take the one with the most free space. @todo - TODO page merging. try to allocate adjacent page first, + page merging. try to allocate adjacent page first, so that they can be flushed both in one sync */ @@ -5449,8 +5450,7 @@ void TC_LOG_MMAP::get_active_from_pool() PAGE **p, **best_p=0; int best_free; - if (syncing) - pthread_mutex_lock(&LOCK_pool); + pthread_mutex_lock(&LOCK_pool); do { @@ -5470,20 +5470,21 @@ void TC_LOG_MMAP::get_active_from_pool() } while ((*best_p == 0 || best_free == 0) && overflow()); + safe_mutex_assert_owner(&LOCK_active); active=*best_p; - if (active->free == active->size) // we've chosen an empty page - { - tc_log_cur_pages_used++; - set_if_bigger(tc_log_max_pages_used, tc_log_cur_pages_used); - } if ((*best_p)->next) // unlink the page from the pool *best_p=(*best_p)->next; else pool_last=*best_p; + pthread_mutex_unlock(&LOCK_pool); - if (syncing) - pthread_mutex_unlock(&LOCK_pool); + pthread_mutex_lock(&active->lock); + if (active->free == active->size) // we've chosen an empty page + { + tc_log_cur_pages_used++; + set_if_bigger(tc_log_max_pages_used, tc_log_cur_pages_used); + } } /** @@ -5538,7 +5539,7 @@ int TC_LOG_MMAP::log_xid(THD *thd, my_xid xid) pthread_mutex_lock(&LOCK_active); /* - if active page is full - just wait... + if the active page is full - just wait... frankly speaking, active->free here accessed outside of mutex protection, but it's safe, because it only means we may miss an unlog() for the active page, and we're not waiting for it here - @@ -5550,9 +5551,17 @@ int TC_LOG_MMAP::log_xid(THD *thd, my_xid xid) /* no active page ? take one from the pool */ if (active == 0) get_active_from_pool(); + else + pthread_mutex_lock(&active->lock); p=active; - pthread_mutex_lock(&p->lock); + + /* + p->free is always > 0 here because to decrease it one needs + to take p->lock and before it one needs to take LOCK_active. + But checked that active->free > 0 under LOCK_active and + haven't release it ever since + */ /* searching for an empty slot */ while (*p->ptr) @@ -5566,38 +5575,51 @@ int TC_LOG_MMAP::log_xid(THD *thd, my_xid xid) *p->ptr++= xid; p->free--; p->state= DIRTY; - - /* to sync or not to sync - this is the question */ - pthread_mutex_unlock(&LOCK_active); - pthread_mutex_lock(&LOCK_sync); pthread_mutex_unlock(&p->lock); + pthread_mutex_lock(&LOCK_sync); if (syncing) { // somebody's syncing. let's wait + pthread_mutex_unlock(&LOCK_active); + pthread_mutex_lock(&p->lock); p->waiters++; - /* - note - it must be while (), not do ... while () here - as p->state may be not DIRTY when we come here - */ - while (p->state == DIRTY && syncing) + for (;;) + { + int not_dirty = p->state != DIRTY; + pthread_mutex_unlock(&p->lock); + if (not_dirty || !syncing) + break; pthread_cond_wait(&p->cond, &LOCK_sync); + pthread_mutex_lock(&p->lock); + } p->waiters--; err= p->state == ERROR; if (p->state != DIRTY) // page was synced { + pthread_mutex_unlock(&LOCK_sync); if (p->waiters == 0) pthread_cond_signal(&COND_pool); // in case somebody's waiting - pthread_mutex_unlock(&LOCK_sync); + pthread_mutex_unlock(&p->lock); goto done; // we're done } - } // page was not synced! do it now - DBUG_ASSERT(active == p && syncing == 0); - pthread_mutex_lock(&LOCK_active); - syncing=p; // place is vacant - take it - active=0; // page is not active anymore - pthread_cond_broadcast(&COND_active); // in case somebody's waiting - pthread_mutex_unlock(&LOCK_active); - pthread_mutex_unlock(&LOCK_sync); + DBUG_ASSERT(!syncing); + pthread_mutex_unlock(&p->lock); + syncing = p; + pthread_mutex_unlock(&LOCK_sync); + + pthread_mutex_lock(&LOCK_active); + active=0; // page is not active anymore + pthread_cond_broadcast(&COND_active); + pthread_mutex_unlock(&LOCK_active); + } + else + { + syncing = p; // place is vacant - take it + pthread_mutex_unlock(&LOCK_sync); + active = 0; // page is not active anymore + pthread_cond_broadcast(&COND_active); + pthread_mutex_unlock(&LOCK_active); + } err= sync(); done: @@ -5614,7 +5636,7 @@ int TC_LOG_MMAP::sync() sit down and relax - this can take a while... note - no locks are held at this point */ - err= my_msync(fd, syncing->start, 1, MS_SYNC); + err= my_msync(fd, syncing->start, syncing->size * sizeof(my_xid), MS_SYNC); /* page is synced. let's move it to the pool */ pthread_mutex_lock(&LOCK_pool); @@ -5622,19 +5644,20 @@ int TC_LOG_MMAP::sync() pool_last=syncing; syncing->next=0; syncing->state= err ? ERROR : POOL; - pthread_cond_broadcast(&syncing->cond); // signal "sync done" pthread_cond_signal(&COND_pool); // in case somebody's waiting pthread_mutex_unlock(&LOCK_pool); /* marking 'syncing' slot free */ pthread_mutex_lock(&LOCK_sync); + pthread_cond_broadcast(&syncing->cond); // signal "sync done" syncing=0; /* we check the "active" pointer without LOCK_active. Still, it's safe - "active" can change from NULL to not NULL any time, but it will take LOCK_sync before waiting on active->cond. That is, it can never miss a signal. - And "active" can change to NULL only after LOCK_sync, so this is safe too. + And "active" can change to NULL only by the syncing thread + (the thread that will send a signal below) */ if (active) pthread_cond_signal(&active->cond); // wake up a new syncer @@ -5654,13 +5677,13 @@ void TC_LOG_MMAP::unlog(ulong cookie, my_xid xid) DBUG_ASSERT(*x == xid); DBUG_ASSERT(x >= p->start && x < p->end); - *x=0; pthread_mutex_lock(&p->lock); + *x=0; p->free++; DBUG_ASSERT(p->free <= p->size); set_if_smaller(p->ptr, x); - if (p->free == p->size) // the page is completely empty + if (p->free == p->size) // the page is completely empty statistic_decrement(tc_log_cur_pages_used, &LOCK_status); if (p->waiters == 0) // the page is in pool and ready to rock pthread_cond_signal(&COND_pool); // ping ... for overflow() From 9b703c9112233dcf7f60dd691200790576db7c19 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Fri, 2 Jul 2010 12:25:45 +0200 Subject: [PATCH 14/15] Fix bug 600744 --- storage/xtradb/handler/ha_innodb.cc | 10 +++++----- storage/xtradb/include/univ.i | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 230a4fde81f..5a5e04bc9d7 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -10393,7 +10393,7 @@ static MYSQL_SYSVAR_BOOL(recovery_stats, innobase_recovery_stats, "Output statistics of recovery process after it.", NULL, NULL, FALSE); -static MYSQL_SYSVAR_ULONG(use_purge_thread, srv_use_purge_thread, +static MYSQL_SYSVAR_ULINT(use_purge_thread, srv_use_purge_thread, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Number of purge devoted threads. #### over 1 is EXPERIMENTAL ####", NULL, NULL, 1, 0, 64, 0); @@ -10548,7 +10548,7 @@ static MYSQL_SYSVAR_ULONG(stats_auto_update, srv_stats_auto_update, "(except for ANALYZE TABLE command) 0:disable 1:enable", NULL, NULL, 1, 0, 1, 0); -static MYSQL_SYSVAR_ULONG(stats_update_need_lock, srv_stats_update_need_lock, +static MYSQL_SYSVAR_ULINT(stats_update_need_lock, srv_stats_update_need_lock, PLUGIN_VAR_RQCMDARG, "Enable/Disable InnoDB's update statistics which needs to lock dictionary. " "e.g. Data_free.", @@ -10728,7 +10728,7 @@ static MYSQL_SYSVAR_ULONG(ibuf_accel_rate, srv_ibuf_accel_rate, "Tunes amount of insert buffer processing of background, in addition to innodb_io_capacity. (in percentage)", NULL, NULL, 100, 100, 999999999, 0); -static MYSQL_SYSVAR_ULONG(checkpoint_age_target, srv_checkpoint_age_target, +static MYSQL_SYSVAR_ULINT(checkpoint_age_target, srv_checkpoint_age_target, PLUGIN_VAR_RQCMDARG, "Control soft limit of checkpoint age. (0 : not control)", NULL, NULL, 0, 0, ~0UL, 0); @@ -10822,12 +10822,12 @@ static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit, "Limit the allocated memory for dictionary cache. (0: unlimited)", NULL, NULL, 0, 0, LONG_MAX, 0); -static MYSQL_SYSVAR_ULONG(relax_table_creation, srv_relax_table_creation, +static MYSQL_SYSVAR_ULINT(relax_table_creation, srv_relax_table_creation, PLUGIN_VAR_RQCMDARG, "Relax limitation of column size at table creation as builtin InnoDB.", NULL, NULL, 0, 0, 1, 0); -static MYSQL_SYSVAR_ULONG(pass_corrupt_table, srv_pass_corrupt_table, +static MYSQL_SYSVAR_ULINT(pass_corrupt_table, srv_pass_corrupt_table, PLUGIN_VAR_RQCMDARG, "Pass corruptions of user tables as 'corrupt table' instead of not crashing itself, " "when used with file_per_table. " diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 0d9417fab38..09b28ce72dd 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -326,10 +326,12 @@ macro ULINTPF. */ typedef unsigned __int64 ulint; #define ULINTPF "%I64u" typedef __int64 lint; +#define MYSQL_SYSVAR_ULINT MYSQL_SYSVAR_ULONGLONG #else typedef unsigned long int ulint; #define ULINTPF "%lu" typedef long int lint; +#define MYSQL_SYSVAR_ULINT MYSQL_SYSVAR_ULONG #endif #ifdef __WIN__ From ee45ab069478f532488befac0464c780c2f46f45 Mon Sep 17 00:00:00 2001 From: Bo Thorsen Date: Wed, 7 Jul 2010 13:30:33 +0200 Subject: [PATCH 15/15] Add 64 bit packages to the pack script. 32 bit is still the default --- win/make_mariadb_win_dist | 61 +++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/win/make_mariadb_win_dist b/win/make_mariadb_win_dist index e4cf611c0e3..a7ca8f2c9df 100644 --- a/win/make_mariadb_win_dist +++ b/win/make_mariadb_win_dist @@ -7,6 +7,55 @@ set -e +usage() +{ +cat <