diff options
-rw-r--r-- | client/mysqlbinlog.cc | 5 | ||||
-rw-r--r-- | extra/comp_err.c | 3 | ||||
-rw-r--r-- | include/my_dbug.h | 1 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 35 | ||||
-rw-r--r-- | mysql-test/t/system_mysql_db_fix.test | 3 | ||||
-rw-r--r-- | mysys/my_seek.c | 3 | ||||
-rwxr-xr-x | scripts/make_win_bin_dist | 345 | ||||
-rw-r--r-- | sql/ha_archive.cc | 2 |
8 files changed, 382 insertions, 15 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9cecdb4eafc..c04c2ecabd6 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1490,14 +1490,13 @@ int main(int argc, char** argv) the server */ -#ifdef __WIN__ #include "my_decimal.h" #include "decimal.c" + +#if defined(__WIN__) && !defined(CMAKE_BUILD) #include "my_decimal.cpp" #include "log_event.cpp" #else -#include "my_decimal.h" -#include "decimal.c" #include "my_decimal.cc" #include "log_event.cc" #endif diff --git a/extra/comp_err.c b/extra/comp_err.c index 65fc131a5fc..14774c87a28 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -188,8 +188,9 @@ int main(int argc, char *argv[]) DBUG_RETURN(1); } clean_up(lang_head, error_head); + DBUG_LEAVE; /* we can't call my_end after DBUG_RETURN */ my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); - DBUG_RETURN(0); + return(0); } } diff --git a/include/my_dbug.h b/include/my_dbug.h index 6e60b599f53..bf2e8d9969b 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -97,6 +97,7 @@ extern void _db_unlock_file(void); #define DBUG_UNLOCK_FILE #define DBUG_OUTPUT(A) #define DBUG_ASSERT(A) {} +#define DBUG_LEAVE #endif #ifdef __cplusplus } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 24a3949130f..7bca21e3ff6 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1042,20 +1042,30 @@ sub executable_setup () { if ( $glob_win32 ) { $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", - "$glob_basedir/client_debug", + "$glob_basedir/client_debug", + "$glob_basedir/client/release", + "$glob_basedir/client/debug", "$glob_basedir/bin",); $exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max-nt", "$path_client_bindir/mysqld-max", "$path_client_bindir/mysqld-nt", "$path_client_bindir/mysqld", "$path_client_bindir/mysqld-debug", - "$path_client_bindir/mysqld-max"); - $path_language= mtr_path_exists("$glob_basedir/share/english/"); - $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); + "$path_client_bindir/mysqld-max", + "$glob_basedir/sql/release/mysqld", + "$glob_basedir/sql/debug/mysqld"); + $path_language= mtr_path_exists("$glob_basedir/share/english/", + "$glob_basedir/sql/share/english/"); + $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets", + "$glob_basedir/sql/share/charsets/"); $exe_my_print_defaults= - mtr_exe_exists("$path_client_bindir/my_print_defaults"); + mtr_exe_exists("$path_client_bindir/my_print_defaults", + "$glob_basedir/extra/release/my_print_defaults", + "$glob_basedir/extra/debug/my_print_defaults"); $exe_perror= - mtr_exe_exists("$path_client_bindir/perror"); + mtr_exe_exists("$path_client_bindir/perror", + "$glob_basedir/extra/release/perror", + "$glob_basedir/extra/debug/perror"); } else { @@ -1086,6 +1096,9 @@ sub executable_setup () { $exe_mysql_client_test= mtr_exe_exists("$glob_basedir/tests/mysql_client_test", "$path_client_bindir/mysql_client_test", + "$glob_basedir/tests/release/mysql_client_test", + "$glob_basedir/tests/debug/mysql_client_test", + "$path_client_bindir/mysql_client_test", "/usr/bin/false"); } $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); @@ -1096,7 +1109,8 @@ sub executable_setup () { $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); $exe_mysql_fix_system_tables= - mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables"); + mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", + "/usr/bin/false"); $path_ndb_tools_dir= mtr_path_exists("$glob_basedir/ndb/tools"); $exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm"; $lib_udf_example= @@ -1114,7 +1128,8 @@ sub executable_setup () { $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); $exe_mysql_fix_system_tables= mtr_script_exists("$path_client_bindir/mysql_fix_privilege_tables", - "$glob_basedir/scripts/mysql_fix_privilege_tables"); + "$glob_basedir/scripts/mysql_fix_privilege_tables", + "/usr/bin/false"); $exe_my_print_defaults= mtr_exe_exists("$path_client_bindir/my_print_defaults"); $exe_perror= @@ -1148,7 +1163,9 @@ sub executable_setup () { } else { - $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); + $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest", + "$glob_basedir/client/release/mysqltest", + "$glob_basedir/client/debug/mysqltest"); $exe_mysql_client_test= mtr_exe_exists("$path_client_bindir/mysql_client_test", "/usr/bin/false"); # FIXME temporary diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix.test index 0a2ab180806..fa44b454b4f 100644 --- a/mysql-test/t/system_mysql_db_fix.test +++ b/mysql-test/t/system_mysql_db_fix.test @@ -1,6 +1,9 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +# Windows doesn't support execution of shell scripts (to fix!!) +--source include/not_windows.inc + # # This is the test for mysql_fix_privilege_tables # diff --git a/mysys/my_seek.c b/mysys/my_seek.c index 6af65d70fd0..8035312496d 100644 --- a/mysys/my_seek.c +++ b/mysys/my_seek.c @@ -29,7 +29,8 @@ my_off_t my_seek(File fd, my_off_t pos, int whence, whence, MyFlags)); DBUG_ASSERT(pos != MY_FILEPOS_ERROR); /* safety check */ - newpos=lseek(fd, pos, whence); + if (-1 != fd) + newpos=lseek(fd, pos, whence); if (newpos == (os_off_t) -1) { my_errno=errno; diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist new file mode 100755 index 00000000000..cc75245e5d9 --- /dev/null +++ b/scripts/make_win_bin_dist @@ -0,0 +1,345 @@ +#!/bin/sh + +# Exit if failing to copy, we want exact specifications, not +# just "what happen to be built". +set -e + +# ---------------------------------------------------------------------- +# Read first argument that is the base name of the resulting TAR file. +# See usage() function below for a description on the arguments. +# +# NOTE: We will read the rest of the command line later on. +# NOTE: Pattern matching with "{..,..}" can't be used, not portable. +# ---------------------------------------------------------------------- + +# FIXME FIXME "debug", own build or handled here? +# FIXME FIXME add way to copy from other builds executables + +usage() +{ + echo <<EOF +Usage: make_win_bin_dist [ options ] package-base-name [ copy-defs... ] + +This is a script to run from the top of a source tree built on Windows. +The "package-base-name" argument should be something like + + mysql-noinstall-5.0.25-win32 (or winx64) + +and will be the name of the directory of the unpacked ZIP (stripping +away the "noinstall" part of the ZIP file name if any) and the base +for the resulting package name. + +Options are + + --embedded Pack the embedded server and give error if not built. + The default is to pack it if it is built. + + --no-embedded Don't pack the embedded server even if built + + --debug Pack the debug binaries and give error if not built. + + --no-debug Don't pack the debug binaries even if built + + --only-debug The target for this build was "Debug", and we just + want to replace the normal binaries with debug + versions, i.e. no separate "debug" directories. + + --exe-suffix=SUF Add a suffix to the "mysqld" binary. + +As you might want to include files of directories from other builds +(like a "mysqld-max.exe" server), you can instruct this script do copy +them in for you. This is the "copy-def" arguments, and they are of the +form + + relative-dest-name=source-name ..... + +i.e. can be something like + + bin/mysqld-max.exe=../my-max-build/sql/release/mysqld.exe + +If you specify a directory the whole directory will be copied. + +EOF + exit 1 +} + +# ---------------------------------------------------------------------- +# We need to be at the top of a source tree, check that we are +# ---------------------------------------------------------------------- + +if [ ! -d "sql" ] ; then + echo "You need to run this script from inside the source tree" + usage +fi + +# ---------------------------------------------------------------------- +# Actual argument processing, first part +# ---------------------------------------------------------------------- + +NOINST_NAME="" +TARGET="release" +PACK_EMBEDDED="" # Could be "no", "yes" or empty +PACK_DEBUG="" # Could be "no", "yes" or empty +EXE_SUFFIX="" + +for arg do + shift + case "$arg" in + --embedded) PACK_EMBEDDED="yes" ;; + --no-embedded) PACK_EMBEDDED="no" ;; + --debug) PACK_DEBUG="yes" ;; + --no-debug) PACK_DEBUG="no" ;; + --only-debug) TARGET="debug" ; PACK_DEBUG="no" ;; + --exe-suffix=*) EXE_SUFFIX=`echo "$arg" | sed -e "s,--exe-suffix=,,"` ;; + -*) + echo "Unknown argument '$arg'" + usage + ;; + *) + NOINST_NAME="$arg" + break + esac +done + +if [ x"$NOINST_NAME" = x"" ] ; then + echo "No base package name given" + usage +fi +DESTDIR=`echo $NOINST_NAME | sed 's/-noinstall-/-/'` + +if [ -e $DESTDIR ] ; then + echo "Please remove the old $DESTDIR before running this script" + usage +fi + +# ---------------------------------------------------------------------- +# Copy executables, and client DLL (FIXME why?) +# ---------------------------------------------------------------------- + +trap 'echo "Clearning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR + +mkdir $DESTDIR +mkdir $DESTDIR/bin +cp client/$TARGET/*.exe $DESTDIR/bin/ +cp extra/$TARGET/*.exe $DESTDIR/bin/ +cp myisam/$TARGET/*.exe $DESTDIR/bin/ +cp server-tools/instance-manager/$TARGET/*.exe $DESTDIR/bin/ +cp tests/$TARGET/*.exe $DESTDIR/bin/ +cp libmysql/$TARGET/*.exe $DESTDIR/bin/ +cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ + +# FIXME really needed?! +mv $DESTDIR/bin/comp_err.exe $DESTDIR/bin/comp-err.exe + +cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe + +if [ x"$PACK_DEBUG" = "" -a -f "sql/debug/mysqld.exe" -o \ + x"$PACK_DEBUG" = "yes" ] ; then + cp sql/debug/mysqld.exe $DESTDIR/bin/mysqld-debug.exe + cp sql/debug/mysqld.pdb $DESTDIR/bin/mysqld-debug.pdb + cp sql/debug/mysqld.map $DESTDIR/bin/mysqld-debug.map +fi + +# ---------------------------------------------------------------------- +# Copy data directory, readme files etc +# ---------------------------------------------------------------------- + +cp COPYING EXCEPTIONS-CLIENT $DESTDIR/ + +# FIXME is there ever a data directory to copy? +if [ -d win/data ] ; then + cp -pR win/data $DESTDIR/data +fi + +# FIXME maybe a flag to define "release build", or do the +# check from the calling script that all these are there, +# and with the correct content. + +mkdir $DESTDIR/Docs +cp Docs/INSTALL-BINARY $DESTDIR/Docs/ +cp Docs/manual.chm $DESTDIR/Docs/ || /bin/true +cp ChangeLog $DESTDIR/Docs/ || /bin/true +cp COPYING $DESTDIR/Docs/ +cp support-files/my-*.ini $DESTDIR/ + +# ---------------------------------------------------------------------- +# These will be filled in when we enable embedded. Note that if no +# argument is given, it is copied if exists, else a check is done. +# ---------------------------------------------------------------------- + +copy_embedded() +{ + mkdir -p $DESTDIR/Embedded/DLL/release \ + $DESTDIR/Embedded/static/release + cp libmysqld/libmysqld.def $DESTDIR/include/ + cp libmysqld/$TARGET/mysqlserver.lib $DESTDIR/Embedded/static/release/ + cp libmysqld/$TARGET/libmysqld.dll $DESTDIR/Embedded/DLL/release/ + cp libmysqld/$TARGET/libmysqld.exp $DESTDIR/Embedded/DLL/release/ + cp libmysqld/$TARGET/libmysqld.lib $DESTDIR/Embedded/DLL/release/ + + if [ x"$PACK_DEBUG" = "" -a -f "libmysqld/debug/libmysqld.lib" -o \ + x"$PACK_DEBUG" = "yes" ] ; then + mkdir -p $DESTDIR/Embedded/DLL/debug + cp libmysqld/debug/libmysqld.dll $DESTDIR/Embedded/DLL/debug/ + cp libmysqld/debug/libmysqld.exp $DESTDIR/Embedded/DLL/debug/ + cp libmysqld/debug/libmysqld.lib $DESTDIR/Embedded/DLL/debug/ + fi +} + +if [ x"$PACK_EMBEDDED" = "" -a \ + -f "libmysqld/$TARGET/mysqlserver.lib" -a \ + -f "libmysqld/$TARGET/libmysqld.lib" -o \ + x"$PACK_EMBEDDED" = "yes" ] ; then + copy_embedded +fi + +# ---------------------------------------------------------------------- +# FIXME test stuff that is useless garbage? +# ---------------------------------------------------------------------- + +mkdir -p $DESTDIR/examples/libmysqltest/release +cp libmysql/mytest.c libmysql/myTest.vcproj libmysql/$TARGET/myTest.exe \ + $DESTDIR/examples/libmysqltest/ +cp libmysql/$TARGET/myTest.exe $DESTDIR/examples/libmysqltest/release/ + +if [ x"$PACK_DEBUG" = "" -a -f "libmysql/debug/myTest.exe" -o \ + x"$PACK_DEBUG" = "yes" ] ; then + mkdir -p $DESTDIR/examples/libmysqltest/debug + cp libmysql/debug/myTest.exe $DESTDIR/examples/libmysqltest/debug/ +fi + +mkdir -p $DESTDIR/examples/tests +cp tests/*.res tests/*.tst tests/*.pl tests/*.c $DESTDIR/examples/tests/ + +# ---------------------------------------------------------------------- +# FIXME why not copy it all in "include"?! +# ---------------------------------------------------------------------- + +mkdir -p $DESTDIR/include +cp include/conf*.h \ + include/mysql*.h \ + include/errmsg.h \ + include/my_alloc.h \ + include/my_getopt.h \ + include/my_sys.h \ + include/my_list.h \ + include/my_pthread.h \ + include/my_dbug.h \ + include/m_string.h \ + include/m_ctype.h \ + include/my_global.h \ + include/typelib.h $DESTDIR/include/ +cp libmysql/libmysql.def $DESTDIR/include/ + +# ---------------------------------------------------------------------- +# Client libraries, and other libraries +# FIXME why "libmysql.dll" installed both in "bin" and "lib/opt"? +# ---------------------------------------------------------------------- + +mkdir -p $DESTDIR/lib/opt +cp libmysql/$TARGET/libmysql.dll \ + libmysql/$TARGET/libmysql.lib \ + client/$TARGET/mysqlclient.lib \ + regex/$TARGET/regex.lib \ + strings/$TARGET/strings.lib \ + zlib/$TARGET/zlib.lib $DESTDIR/lib/opt/ + +if [ x"$PACK_DEBUG" = "" -a -f "libmysql/debug/libmysql.lib" -o \ + x"$PACK_DEBUG" = "yes" ] ; then + mkdir -p $DESTDIR/lib/debug + cp libmysql/debug/libmysql.dll \ + libmysql/debug/libmysql.lib \ + client/debug/mysqlclient.lib \ + mysys/debug/mysys.lib \ + regex/debug/regex.lib \ + strings/debug/strings.lib \ + zlib/debug/zlib.lib $DESTDIR/lib/debug/ +fi + +# FIXME sort this out... +cp mysys/$TARGET/mysys.lib $DESTDIR/lib/opt/mysys_tls.lib + +# ---------------------------------------------------------------------- +# Copy the test directory +# ---------------------------------------------------------------------- + +mkdir -p $DESTDIR/mysql-test/include $DESTDIR/mysql-test/lib \ + $DESTDIR/mysql-test/r $DESTDIR/mysql-test/std_data \ + $DESTDIR/mysql-test/t +cp mysql-test/mysql-test-run.pl $DESTDIR/mysql-test/ +cp mysql-test/README $DESTDIR/mysql-test/ +cp mysql-test/install_test_db.sh $DESTDIR/mysql-test/install_test_db +cp mysql-test/include/*.inc $DESTDIR/mysql-test/include/ +cp mysql-test/lib/*.pl $DESTDIR/mysql-test/lib/ +cp mysql-test/lib/*.sql $DESTDIR/mysql-test/lib/ +cp mysql-test/r/*.require $DESTDIR/mysql-test/r/ +# Need this trick, or we get "argument list too long". +ABS_DST=`pwd`/$DESTDIR +(cd mysql-test/r/ && cp *.result $ABS_DST/mysql-test/r/) +cp mysql-test/std_data/* $DESTDIR/mysql-test/std_data/ +cp mysql-test/t/*.opt $DESTDIR/mysql-test/t/ +cp mysql-test/t/*.sh $DESTDIR/mysql-test/t/ +cp mysql-test/t/*.slave-mi $DESTDIR/mysql-test/t/ +cp mysql-test/t/*.sql $DESTDIR/mysql-test/t/ +cp mysql-test/t/*.def $DESTDIR/mysql-test/t/ +(cd mysql-test/t/ && cp *.test $ABS_DST/mysql-test/t/) + +# Note that this will not copy "extra" if a soft link +if [ -d mysql-test/extra ] ; then + mkdir -p $DESTDIR/mysql-test/extra + cp -pR mysql-test/extra/* $DESTDIR/mysql-test/extra/ +fi + +# ---------------------------------------------------------------------- +# Copy what could be usable in the "scripts" directory. Currently +# only SQL files, others are bourne shell scripts or Perl scripts +# not really usable on Windows. +# +# But to be nice to the few Cygwin users we might have in 5.0 we +# continue to copy the stuff, but don't include it include it in +# the WiX install. +# ---------------------------------------------------------------------- + +mkdir -p $DESTDIR/scripts + +# Uncomment and remove the for loop in 5.1 +#cp scripts/*.sql $DESTDIR/scripts/ + +for i in `cd scripts && ls`; do \ + if echo $i | grep -q '\.sh'; then \ + cp scripts/$i $DESTDIR/scripts/`echo $i | sed -e 's/\.sh$//'`; \ + elif [ $i = Makefile.am -o $i = Makefile.in -o -e scripts/$i.sh ] ; then \ + : ; \ + else \ + cp scripts/$i $DESTDIR/scripts/$i; \ + fi; \ +done + +cp -pR sql/share $DESTDIR/ +cp -pR sql-bench $DESTDIR/ +rm -f $DESTDIR/sql-bench/*.sh $DESTDIR/sql-bench/Makefile* + +# ---------------------------------------------------------------------- +# Copy other files specified on command line DEST=SOURCE +# ---------------------------------------------------------------------- + +for arg do + dst=`echo $arg | sed 's/=.*$//'` + src=`echo $arg | sed 's/^.*=//'` + + if [ x"$dst" = x"" -o x"$src" = x"" ] ; then + echo "Invalid specification of what to copy" + usage + fi + + mkdir -p `dirname $DESTDIR/$dst` + cp -pR "$src" $DESTDIR/$dst +done + +# ---------------------------------------------------------------------- +# Finally creat the ZIP archive +# ---------------------------------------------------------------------- + +rm -f $NOINST_NAME.zip +zip -r $NOINST_NAME.zip $DESTDIR +rm -Rf $DESTDIR diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc index 0fb0bc9f791..bb94a99e700 100644 --- a/sql/ha_archive.cc +++ b/sql/ha_archive.cc @@ -614,7 +614,7 @@ int ha_archive::create(const char *name, TABLE *table_arg, error= my_errno; goto error; } - if ((archive= gzdopen(create_file, "wb")) == NULL) + if ((archive= gzdopen(dup(create_file), "wb")) == NULL) { error= errno; goto error2; |