From ccb0cfc6e9c7ee189f3a2eee5830880a93a81186 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 28 Dec 2010 11:50:59 +0100 Subject: sync mysql 5.5.8 with rawhide --- README.mysql-license | 6 + filter-requires-mysql.sh | 4 +- libmysql.version | 131 ++++++++++++++++++++ mysql-5.5-disable-test.patch | 27 ++++ mysql-5.5-errno.patch | 11 +- mysql-5.5-install-test.patch | 15 +-- mysql-5.5-stack-guard.patch | 139 +++++++++++++++++++++ mysql-5.5-strmov.patch | 10 +- mysql-dev.spec | 285 ++++++++++++++++++++++++------------------- mysql-dubious-exports.patch | 60 +++++++++ mysql-versioning.patch | 18 +++ 11 files changed, 558 insertions(+), 148 deletions(-) create mode 100644 README.mysql-license create mode 100644 libmysql.version create mode 100644 mysql-5.5-disable-test.patch create mode 100644 mysql-5.5-stack-guard.patch create mode 100644 mysql-dubious-exports.patch create mode 100644 mysql-versioning.patch diff --git a/README.mysql-license b/README.mysql-license new file mode 100644 index 0000000..1282653 --- /dev/null +++ b/README.mysql-license @@ -0,0 +1,6 @@ +MySQL is distributed under GPL v2, but there are some licensing exceptions +that allow the client libraries to be linked with a non-GPL application, +so long as the application is under a license approved by Oracle. +For details see + +http://www.mysql.com/about/legal/licensing/foss-exception/ diff --git a/filter-requires-mysql.sh b/filter-requires-mysql.sh index 1148fa6..bce04c6 100755 --- a/filter-requires-mysql.sh +++ b/filter-requires-mysql.sh @@ -1,3 +1,5 @@ #!/bin/sh -/usr/lib/rpm/perl.req $* | grep -v -e "perl(th" -e "perl(lib::mtr" -e "perl(mtr" -e "perl(lib::v1/mtr" +/usr/lib/rpm/perl.req $* | \ + grep -v -e "perl(th" \ + -e "perl(lib::mtr" -e "perl(lib::v1/mtr" -e "perl(mtr" diff --git a/libmysql.version b/libmysql.version new file mode 100644 index 0000000..dcae997 --- /dev/null +++ b/libmysql.version @@ -0,0 +1,131 @@ +# symbols exported from mysql 5.1 +libmysqlclient_16 { + global: + _fini; + _init; + my_init; + myodbc_remove_escape; + mysql_affected_rows; + mysql_autocommit; + mysql_change_user; + mysql_character_set_name; + mysql_close; + mysql_commit; + mysql_data_seek; + mysql_debug; + mysql_dump_debug_info; + mysql_embedded; + mysql_eof; + mysql_errno; + mysql_error; + mysql_escape_string; + mysql_fetch_field; + mysql_fetch_field_direct; + mysql_fetch_fields; + mysql_fetch_lengths; + mysql_fetch_row; + mysql_field_count; + mysql_field_seek; + mysql_field_tell; + mysql_free_result; + mysql_get_character_set_info; + mysql_get_client_info; + mysql_get_client_version; + mysql_get_host_info; + mysql_get_parameters; + mysql_get_proto_info; + mysql_get_server_info; + mysql_get_server_version; + mysql_get_ssl_cipher; + mysql_hex_string; + mysql_info; + mysql_init; + mysql_insert_id; + mysql_kill; + mysql_list_dbs; + mysql_list_fields; + mysql_list_processes; + mysql_list_tables; + mysql_more_results; + mysql_next_result; + mysql_num_fields; + mysql_num_rows; + mysql_options; + mysql_ping; + mysql_query; + mysql_read_query_result; + mysql_real_connect; + mysql_real_escape_string; + mysql_real_query; + mysql_refresh; + mysql_rollback; + mysql_row_seek; + mysql_row_tell; + mysql_select_db; + mysql_send_query; + mysql_server_end; + mysql_server_init; + mysql_set_character_set; + mysql_set_local_infile_default; + mysql_set_local_infile_handler; + mysql_set_server_option; + mysql_shutdown; + mysql_sqlstate; + mysql_ssl_set; + mysql_stat; + mysql_stmt_affected_rows; + mysql_stmt_attr_get; + mysql_stmt_attr_set; + mysql_stmt_bind_param; + mysql_stmt_bind_result; + mysql_stmt_close; + mysql_stmt_data_seek; + mysql_stmt_errno; + mysql_stmt_error; + mysql_stmt_execute; + mysql_stmt_fetch; + mysql_stmt_fetch_column; + mysql_stmt_field_count; + mysql_stmt_free_result; + mysql_stmt_init; + mysql_stmt_insert_id; + mysql_stmt_num_rows; + mysql_stmt_param_count; + mysql_stmt_param_metadata; + mysql_stmt_prepare; + mysql_stmt_reset; + mysql_stmt_result_metadata; + mysql_stmt_row_seek; + mysql_stmt_row_tell; + mysql_stmt_send_long_data; + mysql_stmt_sqlstate; + mysql_stmt_store_result; + mysql_store_result; + mysql_thread_end; + mysql_thread_id; + mysql_thread_init; + mysql_thread_safe; + mysql_use_result; + mysql_warning_count; + local: + *; +}; +# symbols added in mysql 5.5 +libmysqlclient_16.1 { + global: + mysql_client_find_plugin; + mysql_client_register_plugin; + mysql_load_plugin; + mysql_load_plugin_v; + mysql_plugin_options; + mysql_stmt_next_result; +# Ideally these wouldn't be exported, but mysql-connector-odbc requires them. +# We limit the damage by prefixing mysql_ (see mysql-dubious-exports.patch), +# which means the symbols are not present in libmysqlclient_16. + mysql_default_charset_info; + mysql_get_charset; + mysql_get_charset_by_csname; + mysql_net_realloc; +# PHP's mysqli.so requires this (via the ER() macro). + mysql_client_errors; +}; diff --git a/mysql-5.5-disable-test.patch b/mysql-5.5-disable-test.patch new file mode 100644 index 0000000..03ee4f0 --- /dev/null +++ b/mysql-5.5-disable-test.patch @@ -0,0 +1,27 @@ +Disable the outfile_loaddata test, which as of 5.1.38 is giving +platform-dependent results, with the "expected" results being arguably the +wrong ones. This is upstream at http://bugs.mysql.com/bug.php?id=46895 +(note that upstream has also disabled it, but only for Solaris, so we still +need this patch). + +Also disable sys_vars.plugin_dir_basic, which is broken because +mysql-test-run doesn't set the right value of MYSQL_LIBDIR. Upstream at +http://bugs.mysql.com/bug.php?id=52223 + +Also disable perfschema.binlog_mix and perfschema.binlog_row, which have +expected output that doesn't match when openssl is in use. Upstream at +http://bugs.mysql.com/bug.php?id=59091 + + +diff -Naur mysql-5.5.8.orig/mysql-test/t/disabled.def mysql-5.5.8/mysql-test/t/disabled.def +--- mysql-5.5.8.orig/mysql-test/t/disabled.def 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/mysql-test/t/disabled.def 2010-12-21 11:03:07.288224692 -0500 +@@ -19,3 +19,8 @@ + sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested + alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested + create-big : Bug#37248 2010-11-15 mattiasj was not tested ++# ++outfile_loaddata : bug#46895 code wrong, expected results wrong too ++sys_vars.plugin_dir_basic : bug#52223 fails for lib64 library directory ++perfschema.binlog_mix : bug#59091 fails with openssl ++perfschema.binlog_row : bug#59091 fails with openssl diff --git a/mysql-5.5-errno.patch b/mysql-5.5-errno.patch index d27f425..93e61de 100644 --- a/mysql-5.5-errno.patch +++ b/mysql-5.5-errno.patch @@ -1,7 +1,10 @@ -diff -up mysql-5.5.6-rc/include/my_sys.h.orig mysql-5.5.6-rc/include/my_sys.h ---- mysql-5.5.6-rc/include/my_sys.h.orig 2010-09-17 22:48:10.000000000 +0200 -+++ mysql-5.5.6-rc/include/my_sys.h 2010-09-24 19:01:43.250648886 +0200 -@@ -201,13 +201,8 @@ extern void my_large_free(uchar *ptr); +"extern int errno" is just a really bad idea. + + +diff -Naur mysql-5.5.8.orig/include/my_sys.h mysql-5.5.8/include/my_sys.h +--- mysql-5.5.8.orig/include/my_sys.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/my_sys.h 2010-12-20 21:20:12.622190325 -0500 +@@ -201,13 +201,8 @@ #define my_afree(PTR) my_free(PTR) #endif /* HAVE_ALLOCA */ diff --git a/mysql-5.5-install-test.patch b/mysql-5.5-install-test.patch index a788863..5980aea 100644 --- a/mysql-5.5-install-test.patch +++ b/mysql-5.5-install-test.patch @@ -1,7 +1,4 @@ -mysql's idea of a suitable place to install the regression tests is -/usr/mysql-test. To relocate this to a reasonably FHS-compliant place -like /usr/share/mysql-test, we have to hack up the paths in mtr_cases.pm. -This patch also improves the documentation a tad. +Improve the documentation that will be installed in the mysql-test RPM. diff -Naur mysql-5.1.43.orig/mysql-test/README mysql-5.1.43/mysql-test/README @@ -34,13 +31,3 @@ diff -Naur mysql-5.1.43.orig/mysql-test/README mysql-5.1.43/mysql-test/README You can create your own test cases. To create a test case, create a new ---- mysql-5.5.6-rc/mysql-test/lib/mtr_cases.pm.orig 2010-09-24 19:11:14.978713231 +0200 -+++ mysql-5.5.6-rc/mysql-test/lib/mtr_cases.pm 2010-09-24 19:11:25.748104951 +0200 -@@ -276,6 +276,7 @@ - { - $suitedir= my_find_dir($::basedir, - ["share/mysql-test/suite", -+ "share/mysql-test", - "mysql-test/suite", - "mysql-test", - # Look in storage engine specific suite dirs diff --git a/mysql-5.5-stack-guard.patch b/mysql-5.5-stack-guard.patch new file mode 100644 index 0000000..0634560 --- /dev/null +++ b/mysql-5.5-stack-guard.patch @@ -0,0 +1,139 @@ +mysql is not accounting for the "guard page" when setting thread stack size +requests. This is fatal on PPC systems, which may use guard pages as large +as 64K. This patch also documents the IA64 situation a bit better. + +Note: there are quite a few other setstacksize calls besides the two in +mysqld.cc; is it important to fix any of the others? + +Filed upstream at http://bugs.mysql.com/bug.php?id=35019 + + +diff -Naur mysql-5.5.8.orig/sql/mysqld.cc mysql-5.5.8/sql/mysqld.cc +--- mysql-5.5.8.orig/sql/mysqld.cc 2010-12-03 12:58:26.000000000 -0500 ++++ mysql-5.5.8/sql/mysqld.cc 2010-12-20 22:01:08.939186906 -0500 +@@ -2602,6 +2602,70 @@ + } + + ++/* pthread_attr_setstacksize without so much platform-dependency */ ++/* returns the actual stack size if possible */ ++static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize) ++{ ++ size_t guard_size = 0; ++ ++#if defined(__ia64__) || defined(__ia64) ++ /* ++ On IA64, half of the requested stack size is used for "normal stack" ++ and half for "register stack". The space measured by check_stack_overrun ++ is the "normal stack", so double the request to make sure we have the ++ caller-expected amount of normal stack. ++ ++ NOTE: there is no guarantee that the register stack can't grow faster ++ than normal stack, so it's very unclear that we won't dump core due to ++ stack overrun despite check_stack_overrun's efforts. Experimentation ++ shows that in the execution_constants test, the register stack grows ++ less than half as fast as normal stack, but perhaps other scenarios are ++ less forgiving. If it turns out that more space is needed for the ++ register stack, that could be forced (rather inefficiently) by using a ++ multiplier higher than 2 here. ++ */ ++ stacksize *= 2; ++#endif ++ ++ /* ++ On many machines, the "guard space" is subtracted from the requested ++ stack size, and that space is quite large on some platforms. So add ++ it to our request, if we can find out what it is. ++ ++ FIXME: autoconfiscate use of pthread_attr_getguardsize ++ */ ++ if (pthread_attr_getguardsize(attr, &guard_size)) ++ guard_size = 0; /* if can't find it out, treat as 0 */ ++ ++ pthread_attr_setstacksize(attr, stacksize + guard_size); ++ ++ /* Retrieve actual stack size if possible */ ++#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE ++ { ++ size_t real_stack_size= 0; ++ /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */ ++ if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 && ++ real_stack_size > guard_size) ++ { ++ real_stack_size -= guard_size; ++ if (real_stack_size < stacksize) ++ { ++ if (global_system_variables.log_warnings) ++ sql_print_warning("Asked for %ld thread stack, but got %ld", ++ (long) stacksize, (long) real_stack_size); ++ stacksize= real_stack_size; ++ } ++ } ++ } ++#endif ++ ++#if defined(__ia64__) || defined(__ia64) ++ stacksize /= 2; ++#endif ++ return stacksize; ++} ++ ++ + static void start_signal_handler(void) + { + int error; +@@ -2612,15 +2676,7 @@ + #if !defined(HAVE_DEC_3_2_THREADS) + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); + (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); +-#if defined(__ia64__) || defined(__ia64) +- /* +- Peculiar things with ia64 platforms - it seems we only have half the +- stack size in reality, so we have to double it here +- */ +- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2); +-#else +- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size); +-#endif ++ (void) my_setstacksize(&thr_attr,my_thread_stack_size); + #endif + + mysql_mutex_lock(&LOCK_thread_count); +@@ -4361,36 +4417,8 @@ + unireg_abort(1); // Will do exit + + init_signals(); +-#if defined(__ia64__) || defined(__ia64) +- /* +- Peculiar things with ia64 platforms - it seems we only have half the +- stack size in reality, so we have to double it here +- */ +- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size*2); +-#else +- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size); +-#endif + #ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE +- { +- /* Retrieve used stack size; Needed for checking stack overflows */ +- size_t stack_size= 0; +- pthread_attr_getstacksize(&connection_attrib, &stack_size); +-#if defined(__ia64__) || defined(__ia64) +- stack_size/= 2; +-#endif +- /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ +- if (stack_size && stack_size < my_thread_stack_size) +- { +- if (global_system_variables.log_warnings) +- sql_print_warning("Asked for %lu thread stack, but got %ld", +- my_thread_stack_size, (long) stack_size); +-#if defined(__ia64__) || defined(__ia64) +- my_thread_stack_size= stack_size*2; +-#else +- my_thread_stack_size= stack_size; +-#endif +- } +- } ++ my_thread_stack_size = my_setstacksize(&connection_attrib,my_thread_stack_size); + #endif + + (void) thr_setconcurrency(concurrency); // 10 by default diff --git a/mysql-5.5-strmov.patch b/mysql-5.5-strmov.patch index faed43e..3d8ccec 100644 --- a/mysql-5.5-strmov.patch +++ b/mysql-5.5-strmov.patch @@ -13,9 +13,10 @@ of any real performance gain from optimizing these calls. So I'm keeping this patch. ---- mysql-5.5.8/include/m_string.h.orig 2010-12-03 18:58:24.000000000 +0100 -+++ mysql-5.5.8/include/m_string.h 2010-12-17 20:30:31.649497572 +0100 -@@ -74,14 +74,6 @@ +diff -Naur mysql-5.5.8.orig/include/m_string.h mysql-5.5.8/include/m_string.h +--- mysql-5.5.8.orig/include/m_string.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/m_string.h 2010-12-20 21:39:13.905186372 -0500 +@@ -74,15 +74,6 @@ extern void *(*my_str_malloc)(size_t); extern void (*my_str_free)(void *); @@ -27,6 +28,7 @@ this patch. -extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ -#endif -#endif - +- /* Declared in int2str() */ extern char _dig_vec_upper[]; + extern char _dig_vec_lower[]; diff --git a/mysql-dev.spec b/mysql-dev.spec index e704196..9e0d5d4 100644 --- a/mysql-dev.spec +++ b/mysql-dev.spec @@ -1,12 +1,11 @@ -#global postver -rc Name: mysql Version: 5.5.8 -Release: 1%{?dist} +Release: 2%{?dist} Summary: MySQL client programs and shared libraries Group: Applications/Databases URL: http://www.mysql.com # exceptions allow client libraries to be linked with most open source SW, -# not only GPL code. +# not only GPL code. See README.mysql-license License: GPLv2 with exceptions # Regression tests take a long time, you can skip 'em with this @@ -15,7 +14,7 @@ License: GPLv2 with exceptions # Upstream has a mirror redirector for downloads, so the URL is hard to # represent statically. You can get the tarball by following a link from # http://dev.mysql.com/downloads/mysql/ -Source0: mysql-%{version}%{?postver}.tar.gz +Source0: mysql-%{version}.tar.gz # The upstream tarball includes non-free documentation that we cannot ship. # To remove the non-free documentation, run this script after downloading # the tarball into the current directory: @@ -26,45 +25,33 @@ Source3: my-5.5.cnf Source4: scriptstub.c Source5: my_config.h Source6: README.mysql-docs +Source7: README.mysql-license +Source8: libmysql.version Source9: mysql-embedded-check.c # Working around perl dependency checking bug in rpm FTTB. Remove later. Source999: filter-requires-mysql.sh -# Patch1: mysql-ssl-multilib.patch -Patch2: mysql-5.5-errno.patch -# Patch3: mysql-stack.patch -# only for SSL, Patch4: mysql-testing.patch -Patch5: mysql-5.5-install-test.patch -# mainly ppc, Patch6: mysql-stack-guard.patch -# test suite, Patch7: mysql-plugin-bug.patch -# selinux related, Patch8: mysql-setschedparam.patch -# Patch9: mysql-5.5-no-docs.patch -Patch10: mysql-5.5-strmov.patch -# Patch13: mysql-expired-certs.patch -# Patch14: mysql-missing-string-code.patch -# Patch15: mysql-lowercase-bug.patch -Patch16: mysql-chain-certs.patch -# mysql.sock path -#Patch17: mysql-5.5-tests.patch -# missing rpl_reporting in embedded lib -Patch18: mysql-5.5-report.patch -# ABI check fails on client_plugin.h (seems a preprocessor issue) -# Patch19: mysql-5.5-abi.patch -Patch20: mysql-5.5-layout.patch +Patch1: mysql-5.5-errno.patch +Patch2: mysql-5.5-strmov.patch +Patch3: mysql-5.5-install-test.patch +Patch4: mysql-expired-certs.patch +Patch5: mysql-5.5-stack-guard.patch +Patch6: mysql-chain-certs.patch +Patch7: mysql-versioning.patch +Patch8: mysql-dubious-exports.patch +Patch9: mysql-5.5-disable-test.patch + +# RC patch for backports Patch21: mysql-5.5-readline.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gperf, perl, readline-devel, openssl-devel -BuildRequires: gcc-c++, ncurses-devel, zlib-devel -BuildRequires: cmake gawk -BuildRequires: libaio-devel +BuildRequires: gcc-c++, cmake, ncurses-devel, zlib-devel, libaio-devel +BuildRequires: systemtap-sdt-devel # make test requires time and ps BuildRequires: time procps # Socket is needed to run regression tests BuildRequires: perl(Socket) -# DBI and DBD::mysql are needed to run regression tests -# This cause mysql BR mysql :( -BuildRequires: perl(DBD::mysql) # This is required old EL4 BuildRequires: perl(Time::HiRes) @@ -91,7 +78,6 @@ contains the standard MySQL client programs and generic MySQL files. Summary: The shared libraries required for MySQL clients Group: Applications/Databases Requires: /sbin/ldconfig -##Obsoletes: mysqlclient16 %description libs The mysql-libs package provides the essential shared libraries for any @@ -104,6 +90,7 @@ MySQL server. Summary: The MySQL server and related files Group: Applications/Databases Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} Requires: sh-utils Requires(pre): /usr/sbin/useradd Requires(post): chkconfig @@ -126,6 +113,7 @@ the MySQL server and some accompanying files and directories. Summary: Files for development of MySQL applications Group: Applications/Databases Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} Requires: openssl-devel Conflicts: MySQL-devel @@ -173,6 +161,7 @@ MySQL. Summary: The test suite distributed with MySQL Group: Applications/Databases Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-server = %{version}-%{release} Conflicts: MySQL-test @@ -182,7 +171,10 @@ package contains the regression test suite distributed with the MySQL sources. %prep -%setup -q -n mysql-%{version}%{?postver} +%setup -q -n mysql-%{version} + +# Can't provide this file (by licence) +rm -f Docs/mysql.info # change libmysqlclient.so soname to 161 # to allow install with libmysqlclient16 (from 5.1.x branch) @@ -190,33 +182,26 @@ the MySQL sources. sed -i -e '/SHARED_LIB_MAJOR_VERSION/s/16/161/' cmake/mysql_version.cmake -# %patch1 -p1 +%patch1 -p1 %patch2 -p1 -# %patch3 -p1 -# %patch4 -p1 +%patch3 -p1 +%patch4 -p1 %patch5 -p1 -# %patch6 -p1 -# %patch7 -p1 -# %patch8 -p1 -# %patch9 -p1 -%patch10 -p1 -# %patch13 -p1 -# %patch14 -p1 -# %patch15 -p1 -%patch16 -p1 -# %patch17 -p1 -%patch18 -p1 -b .missing -# %patch19 -p1 -%patch20 -p1 -b .layout +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +# Backports specific patches %patch21 -p1 -b .readline # workaround for upstream bug #56342 rm -f mysql-test/t/ssl_8k_key-master.opt -# Stupid test which rely on hostname to be "unknown" -rm -f mysql-test/t/plugin_auth.test +# upstream has fallen down badly on symbol versioning, do it ourselves +cp %{SOURCE8} libmysql/libmysql.version %build + # fail quickly and obviously if user tries to build as root %if %runselftest if [ x"`id -u`" = x0 ]; then @@ -242,44 +227,54 @@ CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" ` CXXFLAGS="$CFLAGS -felide-constructors -fno-rtti -fno-exceptions" export CFLAGS CXXFLAGS +# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX +# so we can't use %%{_datadir} and so forth here. + +cmake . -DBUILD_CONFIG=mysql_release \ + -DCOMPILATION_COMMENT="MySQL Community Server (GPL) by Remi" \ + -DFEATURE_SET="community" \ + -DINSTALL_LAYOUT=RPM \ + -DCMAKE_INSTALL_PREFIX="%{_prefix}" \ + -DINSTALL_INCLUDEDIR=include/mysql \ + -DINSTALL_INFODIR=share/info \ + -DINSTALL_LIBDIR="%{_lib}/mysql" \ + -DINSTALL_MANDIR=share/man \ + -DINSTALL_MYSQLSHAREDIR=share/mysql \ + -DINSTALL_MYSQLTESTDIR=share/mysql-test \ + -DINSTALL_PLUGINDIR="%{_lib}/mysql/plugin" \ + -DINSTALL_SBINDIR=libexec \ + -DINSTALL_SCRIPTDIR=bin \ + -DINSTALL_SQLBENCHDIR=share \ + -DINSTALL_SUPPORTFILESDIR=share/mysql \ + -DMYSQL_DATADIR="/var/lib/mysql" \ + -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \ + -DENABLED_LOCAL_INFILE=ON \ + -DENABLE_DTRACE=ON \ + -DWITH_EMBEDDED_SERVER=ON \ + -DWITH_READLINE=ON \ + -DWITH_SSL=system \ + -DWITH_ZLIB=system + gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4} -%cmake . -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DWITH_DEBUG:BOOL=OFF \ - -DMYSQL_DATADIR:PATH=/var/lib/mysql \ - -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \ - -DFEATURE_SET="community" \ - -DWITH_EMBEDDED_SERVER:BOOL=ON \ - -DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON \ - -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \ - -DWITH_READLINE:BOOL=OFF \ - -DWITH_LIBEDIT:BOOL=OFF \ - -DWITH_SSL:STRING=system \ - -DENABLED_LOCAL_INFILE:BOOL=ON \ - -DCOMPILATION_COMMENT="MySQL Community Server (GPL) by Remi" - -make %{?_smp_mflags} VERBOSE=1 +make %{?_smp_mflags} VERBOSE=1 # regular build will make libmysqld.a but not libmysqld.so :-( mkdir libmysqld/work cd libmysqld/work ar -x ../libmysqld.a -# define twice ?? -#rm ha_federated.o +# these result in missing dependencies: (filed upstream as bug 59104) +rm -f sql_binlog.cc.o rpl_utility.cc.o gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 \ - *.o \ - -lpthread -lcrypt -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc -####### Can't use it, for now + *.o ../../probes_mysql.o \ + -lpthread -laio -lcrypt -lssl -lcrypto -lz -lrt -lstdc++ -ldl -lm -lc # this is to check that we built a complete library -#cp %{SOURCE9} . +cp %{SOURCE9} . ln -s libmysqld.so.0.0.1 libmysqld.so.0 -#gcc -I../../include $CFLAGS -laio -lstdc++ mysql-embedded-check.c libmysqld.so.0 -#LD_LIBRARY_PATH=. ldd ./a.out +gcc -I../../include $CFLAGS mysql-embedded-check.c libmysqld.so.0 +LD_LIBRARY_PATH=. ldd ./a.out cd ../.. -make abi_check_all - %if %runselftest # hack to let 32- and 64-bit tests run concurrently on same build machine case `uname -m` in @@ -296,17 +291,24 @@ make abi_check_all LD_LIBRARY_PATH=$PWD/libservices export LD_LIBRARY_PATH - # note: "make test" invokes two largely-duplicate sets of tests, - # which makes the runtime really unacceptably long ... - # if you want to change this, look at mysql-testing.patch too. - #make test-ns - #make force=--force test-ns || : - #make force=--force test-pr || : - - # RC minimal test - cd mysql-test - %{__perl} ./mysql-test-run.pl \ - --ssl --mysqld=--binlog-format=mixed --suite=main +# make test + + # The cmake build scripts don't provide any simple way to control the + # options for mysql-test-run, so ignore the make target and just call it + # manually. Nonstandard options chosen are: + # --force to continue tests after a failure + # no retries please + # test SSL with --ssl + # avoid redundant test runs with --binlog-format=mixed + # increase timeouts to prevent unwanted failures during mass rebuilds + ( + cd mysql-test + # perl ./mysql-test-run.pl --force --retry=0 --ssl --mysqld=--binlog-format=mixed --suite-timeout=720 --testcase-timeout=30 + # Run less test to speed up build process + %{__perl} ./mysql-test-run.pl --ssl --mysqld=--binlog-format=mixed --suite=main + # cmake build scripts will install the var cruft if left alone :-( + rm -rf var + ) %endif %install @@ -314,6 +316,9 @@ rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install +# List the installed tree for RPM package maintenance purposes. +find $RPM_BUILD_ROOT -print | sed "s|^$RPM_BUILD_ROOT||" | sort > ROOTFILES + # multilib header hacks # we only apply this to known Red Hat multilib arches, per bug #181335 case `uname -i` in @@ -325,64 +330,79 @@ case `uname -i` in ;; esac +# cmake generates some completely wacko references to -lprobes_mysql when +# building with dtrace support. Haven't found where to shut that off, +# so resort to this blunt instrument. While at it, let's not reference +# libmysqlclient_r anymore either. +sed -e 's/-lprobes_mysql//' -e 's/-lmysqlclient_r/-lmysqlclient/' \ + ${RPM_BUILD_ROOT}%{_bindir}/mysql_config >mysql_config.tmp +cp -f mysql_config.tmp ${RPM_BUILD_ROOT}%{_bindir}/mysql_config +chmod 755 ${RPM_BUILD_ROOT}%{_bindir}/mysql_config + mkdir -p $RPM_BUILD_ROOT/var/log touch $RPM_BUILD_ROOT/var/log/mysqld.log -# List the installed tree for RPM package maintenance purposes. -find $RPM_BUILD_ROOT -print | sed "s|^$RPM_BUILD_ROOT||" | sort > ROOTFILES - mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d mkdir -p $RPM_BUILD_ROOT/var/run/mysqld install -m 0755 -d $RPM_BUILD_ROOT/var/lib/mysql install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysqld install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/my.cnf +# Fix funny permissions that cmake build scripts apply to config files +chmod 644 ${RPM_BUILD_ROOT}%{_datadir}/mysql/config.*.ini + +# Fix scripts for multilib safety mv ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysqlbug install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysql_config install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config +# Remove libmysqld.a, install libmysqld.so rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a install -m 0755 libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0.0.1 ln -s libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0 ln -s libmysqld.so.0 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so -rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err -rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1* -rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_binary_distribution -rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_src_distribution -rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/make_win_bin_dist.1* -rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/make_win_src_distribution.1* -rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient*.la +# libmysqlclient_r is no more. Upstream tries to replace it with symlinks +# but that really doesn't work (wrong soname in particular). We'll keep +# just the devel libmysqlclient_r.so link, so that rebuilding without any +# source change is enough to get rid of dependency on libmysqlclient_r. +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient_r.so* +ln -s libmysqlclient.so ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient_r.so + +# mysql-test includes one executable that doesn't belong under /usr/share, +# so move it and provide a symlink +mv ${RPM_BUILD_ROOT}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process ${RPM_BUILD_ROOT}%{_bindir} +ln -s ../../../../../bin/my_safe_process ${RPM_BUILD_ROOT}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process + +# Remove files that %%doc will install in preferred location +rm -f ${RPM_BUILD_ROOT}/usr/COPYING +rm -f ${RPM_BUILD_ROOT}/usr/README + +# Remove files we don't want installed at all +rm -f ${RPM_BUILD_ROOT}/usr/INSTALL-BINARY +rm -f ${RPM_BUILD_ROOT}/usr/docs/ChangeLog +rm -f ${RPM_BUILD_ROOT}/usr/data/mysql/.empty +rm -f ${RPM_BUILD_ROOT}/usr/data/test/.empty +# should move this to /etc/ ? +rm -f ${RPM_BUILD_ROOT}%{_bindir}/mysqlaccess.conf rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/*.a -rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/plugin/*.la -rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/plugin/*.a rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/binary-configure -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/make_binary_distribution -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/make_sharedlib_distribution -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mi_test_all* +rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/magic rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ndb-config-2-node.ini rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql.server rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysqld_multi.server -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/MySQL-shared-compat.spec -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/*.plist -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/preinstall -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/postinstall -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-*.spec rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ChangeLog +rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1* rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-stress-test.pl.1* rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1* -rm -f ${RPM_BUILD_ROOT}%{_bindir}/mysqlaccess.conf -rm -f ${RPM_BUILD_ROOT}%{_datadir}/info/mysql.info* -rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/magic - mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf # copy additional docs into build tree so %%doc will find them cp %{SOURCE6} README.mysql-docs +cp %{SOURCE7} README.mysql-license %clean rm -rf $RPM_BUILD_ROOT @@ -400,9 +420,14 @@ echo -e "You should consider upgrading to a supported release.\n" %pre server /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : +%if 0%{?fedora} > 9 || 0%{?rhel} > 6 +/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \ + -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : +%else # -N options used on Fedora not available on EL and fedora <= 8 and EL <= 5 /usr/sbin/useradd -M -g mysql -o -r -d /var/lib/mysql -s /bin/bash \ -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : +%endif %post libs /sbin/ldconfig @@ -433,7 +458,7 @@ fi %files %defattr(-,root,root) -%doc README COPYING +%doc README COPYING README.mysql-license %doc README.mysql-docs %{_bindir}/msql2mysql @@ -462,18 +487,16 @@ fi %{_mandir}/man1/mysqlslap.1* %{_mandir}/man1/my_print_defaults.1* -%{_libdir}/mysql/mysqlbug %{_libdir}/mysql/mysql_config %files libs %defattr(-,root,root) -%doc COPYING +%doc README COPYING README.mysql-license # although the default my.cnf contains only server settings, we put it in the # libs package because it can be used for client settings too. %config(noreplace) /etc/my.cnf %dir %{_libdir}/mysql -%{_libdir}/mysql/libmysqlclient*.so.* -%{_libdir}/mysql/libmysqlservices.* +%{_libdir}/mysql/libmysqlclient.so.* /etc/ld.so.conf.d/* %dir %{_datadir}/mysql @@ -512,7 +535,6 @@ fi %{_bindir}/myisampack %{_bindir}/mysql_convert_table_format %{_bindir}/mysql_fix_extensions -#%{_bindir}/mysql_fix_privilege_tables %{_bindir}/mysql_install_db %{_bindir}/mysql_secure_installation %{_bindir}/mysql_setpermission @@ -532,7 +554,8 @@ fi %{_bindir}/resolveip /usr/libexec/mysqld -#/usr/libexec/mysqlmanager + +%{_libdir}/mysql/mysqlbug %{_libdir}/mysql/plugin @@ -544,7 +567,6 @@ fi %{_mandir}/man1/myisam_ftdump.1* %{_mandir}/man1/mysql.server.1* %{_mandir}/man1/mysql_fix_extensions.1* -#%{_mandir}/man1/mysql_fix_privilege_tables.1* %{_mandir}/man1/mysql_install_db.1* %{_mandir}/man1/mysql_secure_installation.1* %{_mandir}/man1/mysql_upgrade.1* @@ -567,11 +589,9 @@ fi %{_mandir}/man1/resolveip.1* %{_mandir}/man1/mysql_tzinfo_to_sql.1* %{_mandir}/man8/mysqld.8* -#%{_mandir}/man8/mysqlmanager.8* %{_datadir}/mysql/errmsg-utf8.txt %{_datadir}/mysql/fill_help_tables.sql -#%{_datadir}/mysql/mysql_fix_privilege_tables.sql %{_datadir}/mysql/mysql_system_tables.sql %{_datadir}/mysql/mysql_system_tables_data.sql %{_datadir}/mysql/mysql_test_data_timezone.sql @@ -587,11 +607,12 @@ fi %defattr(-,root,root) /usr/include/mysql /usr/share/aclocal/mysql.m4 -%{_libdir}/mysql/libmysqlclient*.so +%{_libdir}/mysql/libmysqlclient.so +%{_libdir}/mysql/libmysqlclient_r.so %files embedded %defattr(-,root,root) -%doc COPYING +%doc README COPYING README.mysql-license %{_libdir}/mysql/libmysqld.so.* %files embedded-devel @@ -609,11 +630,25 @@ fi %files test %defattr(-,root,root) %{_bindir}/mysql_client_test +%{_bindir}/my_safe_process %attr(-,mysql,mysql) %{_datadir}/mysql-test %{_mandir}/man1/mysql_client_test.1* %changelog +* Tue Dec 28 2010 Remi Collet - 5.5.8-2 +- sync with rawhide + +* Mon Dec 27 2010 Tom Lane 5.5.8-2 +- Add mysql_client_errors[] to the set of exported libmysqlclient symbols; + needed by PHP. + +* Thu Dec 23 2010 Tom Lane 5.5.8-1 +- Update to MySQL 5.5.8 (major version bump). Note this includes removal + of libmysqlclient_r.so. +- Add a linker version script to hide libmysqlclient functions that aren't + part of the documented API. + * Fri Dec 17 2010 Remi Collet - 5.5.8-1 - Update to MySQL Community Server 5.5.8 GA - move from autotools to cmake diff --git a/mysql-dubious-exports.patch b/mysql-dubious-exports.patch new file mode 100644 index 0000000..3342bf8 --- /dev/null +++ b/mysql-dubious-exports.patch @@ -0,0 +1,60 @@ +Prefix mysql_ to the real names of several symbols that have to be exported +from libmysqlclient because mysql-connector-odbc and/or PHP depend on them. +This limits the intrusion on application namespace. + + +diff -Naur mysql-5.5.8.orig/include/errmsg.h mysql-5.5.8/include/errmsg.h +--- mysql-5.5.8.orig/include/errmsg.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/errmsg.h 2010-12-27 14:29:59.184552374 -0500 +@@ -24,6 +24,7 @@ + #endif + void init_client_errs(void); + void finish_client_errs(void); ++#define client_errors mysql_client_errors /* namespace sanity */ + extern const char *client_errors[]; /* Error messages */ + #ifdef __cplusplus + } +diff -Naur mysql-5.5.8.orig/include/my_sys.h mysql-5.5.8/include/my_sys.h +--- mysql-5.5.8.orig/include/my_sys.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/my_sys.h 2010-12-27 14:27:23.956926896 -0500 +@@ -227,6 +227,7 @@ + + /* charsets */ + #define MY_ALL_CHARSETS_SIZE 2048 ++#define default_charset_info mysql_default_charset_info /* namespace sanity */ + extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; + extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; + extern CHARSET_INFO compiled_charsets[]; +@@ -914,6 +915,9 @@ + extern uint get_collation_number(const char *name); + extern const char *get_charset_name(uint cs_number); + ++#define get_charset mysql_get_charset /* namespace sanity */ ++#define get_charset_by_csname mysql_get_charset_by_csname ++ + extern CHARSET_INFO *get_charset(uint cs_number, myf flags); + extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); + extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, +diff -Naur mysql-5.5.8.orig/include/mysql.h.pp mysql-5.5.8/include/mysql.h.pp +--- mysql-5.5.8.orig/include/mysql.h.pp 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/mysql.h.pp 2010-12-27 14:27:23.956926896 -0500 +@@ -86,7 +86,7 @@ + void my_net_local_init(NET *net); + void net_end(NET *net); + void net_clear(NET *net, my_bool clear_buffer); +-my_bool net_realloc(NET *net, size_t length); ++my_bool mysql_net_realloc(NET *net, size_t length); + my_bool net_flush(NET *net); + my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); + my_bool net_write_command(NET *net,unsigned char command, +diff -Naur mysql-5.5.8.orig/include/mysql_com.h mysql-5.5.8/include/mysql_com.h +--- mysql-5.5.8.orig/include/mysql_com.h 2010-12-03 12:58:24.000000000 -0500 ++++ mysql-5.5.8/include/mysql_com.h 2010-12-27 14:27:23.957927198 -0500 +@@ -448,6 +448,7 @@ + void my_net_local_init(NET *net); + void net_end(NET *net); + void net_clear(NET *net, my_bool clear_buffer); ++#define net_realloc mysql_net_realloc /* namespace sanity */ + my_bool net_realloc(NET *net, size_t length); + my_bool net_flush(NET *net); + my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); diff --git a/mysql-versioning.patch b/mysql-versioning.patch new file mode 100644 index 0000000..aaaa828 --- /dev/null +++ b/mysql-versioning.patch @@ -0,0 +1,18 @@ +The symbol versioning solution for libmysqlclient in mysql 5.1 was pretty +awful (export everything) and as of 5.5.8 the cmake build scripts have +forgotten the issue entirely. So we now maintain our own list of exported +symbols and jam it into the build with this hack. + + +diff -Naur mysql-5.5.8.orig/libmysql/CMakeLists.txt mysql-5.5.8/libmysql/CMakeLists.txt +--- mysql-5.5.8.orig/libmysql/CMakeLists.txt 2010-12-03 12:58:26.000000000 -0500 ++++ mysql-5.5.8/libmysql/CMakeLists.txt 2010-12-21 21:00:07.135311386 -0500 +@@ -197,7 +197,7 @@ + SET(libmysql_link_flags) + ENDIF() + SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS +- "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED}") ++ "${libmysql_link_flags} -Wl,--version-script=libmysql.version ${LINK_FLAG_NO_UNDEFINED}") + ENDIF() + # clean direct output needs to be set several targets have the same name + #(mysqlclient in this case) -- cgit