Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 8a04142a85890993c70e73a5f91ee67b > files > 1

MySQL-4.1.11-1.6.102mdk.src.rpm

#(ie. use with rpm --rebuild):
#
#	--with debug	Compile with debugging code
# 
#  enable build with debugging code: will _not_ strip away any debugging code,
#  will _add_ -g3 to CFLAGS, will _add_ --enable-maintainer-mode to 
#  configure.

%define build_debug 0
%define build_test 1
%define build_alltests 0

# commandline overrides:
# rpm -ba|--rebuild --with 'xxx'
%{?_with_debug: %{expand: %%define build_debug 1}}
%{?_with_test: %{expand: %%define build_test 1}}
%{?_without_test: %global build_test 0}
%{?_with_alltests: %{expand: %%define build_alltests 1}}
%{?_without_alltests: %global build_alltests 0}

%if %{build_debug}
# disable build root strip policy
%define __spec_install_post %{_libdir}/rpm/brp-compress || :

# This gives extra debuggin and huge binaries
%{expand:%%define optflags %{optflags} %([ ! $DEBUG ] && echo '-g3')}
%endif

%if %{build_debug}
%define build_debug 1
%endif

%if %{build_test}
%define build_test 1
%endif

%if %{build_alltests}
%define build_debug 1
%define build_test 1
%define build_alltests 1
%endif

%define _requires_exceptions perl(this)

%define name	MySQL
%define version 4.1.11

%define major 14
%define libname %mklibname mysql %{major}
%define old_libname %mklibname mysql 12

%define muser	mysql

Summary:	MySQL: a very fast and reliable SQL database engine
Name: 		%{name}
Version:	%{version}
Release:	1.6.102mdk
Group:		Databases
License:	GPL
URL:		http://www.mysql.com
Source0:	ftp://ftp.sunet.se/pub/databases/relational/mysql/Downloads/MySQL-4.1/mysql-%{version}.tar.gz
Source1:	ftp://ftp.sunet.se/pub/databases/relational/mysql/Downloads/MySQL-4.1/mysql-%{version}.tar.gz.asc
Source2:	mysqld.init.bz2
Source3:	mysqld.sysconfig.bz2
Source4:	mysqld.logrotate.bz2
Source5:	my.cnf.bz2
Patch0:		mysql-4.1.10-install_script_mysqld_safe.diff.bz2
Patch1:		mysql-4.1.3-lib64.diff.bz2
Patch2:		mysql-4.1.7-manual_split.diff.bz2
Patch3:		mysql-errno.patch.bz2
Patch4:		mysql-libdir.patch.bz2
Patch5:		mysql-4.1.10-libtool.diff.bz2
Patch6:		mysql-4.1.11-testing.diff.bz2
# Add fast AMD64 mutexes
Patch7:		db-4.1.24-amd64-mutexes.diff.bz2
# NPTL pthreads mutex are evil
Patch8:		db-4.1.24-disable-pthreadsmutexes.diff.bz2
Patch9:		mysql-4.1.9-disable-pthreadsmutexes.diff.bz2
# Security fixes
Patch10:	mysql-4.1.11-CAN-2005-2558.patch
Patch11:	mysql-4.1.11-CVE-2005-1636.patch
Patch12:	mysql-4.1.12-CVE-2006-0903.patch.bz2
Patch13:	mysql-4.1.19-sec.patch
Patch14:	mysql-4.1.11-CVE-2006-2753.patch.bz2
Patch15:	mysql-4.1.12-CVE-2006-3081.patch

PreReq:		rpm-helper
PreReq:		MySQL-common = %{version}-%{release}
BuildRequires:	autoconf2.5
BuildRequires:	automake1.7
BuildRequires:	bison
BuildRequires:	glibc-static-devel
BuildRequires:	libstdc++-static-devel
BuildRequires:	ncurses-devel
BuildRequires:	openssl-static-devel
BuildRequires:	python
BuildRequires:	tetex
BuildRequires:	texinfo
BuildRequires:	zlib-devel
BuildRequires:	readline-devel
%if %mdkversion >= 1020
BuildRequires:	multiarch-utils >= 1.0.3
%endif
BuildRequires:	libtermcap-devel
BuildConflicts: edit-devel
Provides:       msqlormysql MySQL-server mysqlserver mysql
Obsoletes:      mysql MySQL-devel <= 3.23.39
Conflicts:      MySQL-Max > 4.0.11
BuildRoot:	%{_tmppath}/%{name}-%{version}-buildroot

%description
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.

The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.

The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.

You can build MySQL with some conditional build swithes;

(ie. use with rpm --rebuild):
    --with debug	Compile with debugging code (disabled), forces
			--with alltests
    --with test		Initiate tests (enabled)
    --without test	Disable test
    --with alltests	Initiate tests for all built servers (disabled)
			Warning! This could take several hours...
    --without alltests	Disable all tests

%package	Max
Summary:	MySQL - server with Berkeley DB and Innodb support
Group:		Databases
PreReq:		rpm-helper
Provides:	mysql-Max = %{version}-%{release}
Provides:	msqlormysql MySQL-server mysqlserver mysql
Obsoletes:	mysql-Max
PreReq:		MySQL-common = %{version}-%{release} rpm-helper
Conflicts:	MySQL > 4.0.11

%description	Max 
Optional MySQL server binary that supports features
like transactional tables. You can use it as an alternate
to MySQL basic server.

%package	NDB
Summary:	MySQL - server with Berkeley DB, Innodb and NDB Cluster support
Group:		Databases
PreReq:		rpm-helper
Provides:	msqlormysql MySQL-server mysqlserver mysql
PreReq:		MySQL-common = %{version}-%{release}
Provides:	MySQL-server
Conflicts:	MySQL > 4.0.11

%description	NDB 
Optional MySQL server binary that supports features
like transactional tables. You can use it as an alternate
to MySQL basic server.

Additional features:

* Archive Storage Engine
* NDB Cluster table handler

%package	common
Summary:	MySQL: common files
Group:		Databases
Prereq:		rpm-helper
Requires:	MySQL-client
Requires:	perl-DBD-mysql

%description	common
Common files for the MySQL(TM) database server.

%package	client
Summary:	MySQL - Client
Group:		Databases
Obsoletes:      mysql-client
Provides:       mysql-client 
Requires:	%{libname} = %{version}-%{release}

%description	client
This package contains the standard MySQL clients.

%package	bench
Summary:	MySQL - Benchmarks and test system
Group:		Databases
Requires:	MySQL-client = %{version}-%{release}
Obsoletes:      mysql-bench
Provides:       mysql-bench

%description	bench
This package contains MySQL benchmark scripts and data.

%package -n	%{libname}
Summary:	MySQL - Shared libraries
Group:		System/Libraries
Obsoletes:	MySQL-shared-libs MySQL-shared
Provides:	MySQL-shared-libs = %{version}-%{release}
Provides:	MySQL-shared = %{version}-%{release}

%description -n	%{libname}
This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL.

%package -n	%{libname}-devel
Summary:	MySQL - Development header files and libraries
Group:		Development/Other
Obsoletes:	MySQL-devel mysql-devel
Provides:	MySQL-devel = %{version}-%{release}
Provides:       mysql-devel = %{version}-%{release}
Requires:	%{libname} = %{version}-%{release}
Requires:	MySQL-common = %{version}-%{release}
Requires:	MySQL-client = %{version}-%{release}
Provides:	libmysql-devel
Obsoletes:	%{old_libname}-devel

%description -n	%{libname}-devel
This package contains the development header files and libraries
necessary to develop MySQL client applications.

This package also contains the MySQL server as an embedded library.

The embedded MySQL server library makes it possible to run a
full-featured MySQL server inside the client application.
The main benefits are increased speed and more simple management
for embedded applications.

The API is identical for the embedded MySQL version and the
client/server version.

%prep

%setup -q -n mysql-%{version}
%patch0 -p1 -b .install_script_mysqld_safe
%patch1 -p1 -b .lib64
%patch2 -p0 -b .manual_split
%patch3 -p1 -b .errno_as_defines
%patch4 -p1 -b .libdir
%patch5 -p0 -b .libtool
%patch6 -p0 -b .testing
%patch7 -p1 -b .amd64-mutexes
%patch8 -p1 -b .pthreadsmutexes
%patch9 -p0 -b .disable-pthreadsmutexes
%patch10 -p1 -b .can-2005-2558
%patch11 -p1 -b .cve-2005-1636
%patch12 -p1 -b .cve-2006-0903
%patch13 -p1 -b .sec
%patch14 -p1 -b .cve-2006-2753
%patch15 -p1 -b .cve-2006-3081

# Security fixes

# fix a bug somewhere in the make docs logic. this is a rude hack, but it seems to
# make it able to build 4.1.7 on 10.0
mkdir -p Docs/Images Docs/manual-split

borked_files="myaccess-odbc.txt myaccess.txt myarchitecture.txt mydll-properties.txt mydsn-example.txt mydsn-icon.txt \
mydsn-options.txt mydsn-setup.txt mydsn-test-fail.txt mydsn-test-success.txt mydsn-trace.txt mydsn.txt \
myflowchart.txt errmsg-table.texi manual.texi cl-errmsg-table.texi cluster-components-1.txt multi-comp-1.txt"

for i in $borked_files; do
    touch Docs/Images/$i Docs/$i Docs/manual-split/$i
done

mkdir -p Mandrakelinux
bzcat %{SOURCE2} > Mandrakelinux/mysqld.init
bzcat %{SOURCE3} > Mandrakelinux/mysqld.sysconfig
bzcat %{SOURCE4} > Mandrakelinux/mysqld.logrotate
bzcat %{SOURCE5} > Mandrakelinux/my.cnf

# fix annoyances
perl -pi -e "s|AC_PROG_RANLIB|AC_PROG_LIBTOOL|g" configure*
perl -pi -e "s|^MAX_C_OPTIMIZE.*|MAX_C_OPTIMIZE=\"\"|g" configure*
perl -pi -e "s|^MAX_CXX_OPTIMIZE.*|MAX_CXX_OPTIMIZE=\"\"|g" configure*

%build
# Run aclocal in order to get an updated libtool.m4 in generated
# configure script for "new" architectures (aka. x86_64, mips)
export WANT_AUTOCONF_2_5=1
libtoolize --copy --force; aclocal-1.7; autoconf; automake-1.7

%if %{mdkversion} < 1010
%define __libtoolize /bin/true
%endif

pushd bdb/dist
    sh ./s_config
popd

pushd bdb/build_unix
    CONFIGURE_TOP="../dist" %configure2_5x --disable-pthreadsmutexes
    CONFIGURE_TOP="."
popd

%serverbuild

# (gb) We shall always have the fully versioned binary
# FIXME: Please, please, do tell why you need fully qualified version
GCC_VERSION=`gcc -dumpversion`
CFLAGS="$CFLAGS"
%ifarch alpha
CXXFLAGS="$CXXFLAGS -fPIC"
%else
CXXFLAGS="$CXXFLAGS"
%endif

%if %{build_debug}
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
%endif

export MYSQL_BUILD_CC="gcc-$GCC_VERSION"
export MYSQL_BUILD_CXX="g++-$GCC_VERSION"

export MYSQL_BUILD_CFLAGS="$CFLAGS"
export MYSQL_BUILD_CXXFLAGS="$CXXFLAGS"

#
# Use MYSQL_BUILD_PATH so that we can use a dedicated version of gcc
#
export PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin}

# The --enable-assembler simply does nothing on systems that does not
# support assembler speedups.
MYSQL_COMMON_CONFIGURE_LINE="--prefix=/ \
    --exec-prefix=%{_prefix} \
    --libexecdir=%{_sbindir} \
    --libdir=%{_libdir} \
    --sysconfdir=%{_sysconfdir} \
    --datadir=%{_datadir} \
    --localstatedir=%{_localstatedir}/mysql \
    --infodir=%{_infodir} \
    --includedir=%{_includedir} \
    --mandir=%{_mandir} \
    --enable-shared \
    --with-extra-charsets=complex \
    --enable-assembler \
    --enable-local-infile \
    --enable-large-files=yes \
    --enable-largefile=yes \
    --without-readline \
    --without-libwrap \
    --without-mysqlfs \
    --with-openssl \
    --with-berkeley-db \
    --with-innodb \
    --with-big-tables \
%if %{build_debug}
    --enable-debug \
%else
    --without-debug \
%endif
    --with-mysqld-user=%{muser} \
    --with-unix-socket-path=%{_localstatedir}/mysql/mysql.sock"

################################################################################
# make the mysqld-max server
%configure2_5x $MYSQL_COMMON_CONFIGURE_LINE \
    --without-extra-tools \
    --without-docs \
    --without-man \
    --without-bench \
    --with-embedded-server \
    --with-server-suffix="-Max"

%make

################################################################################
# run the tests
%if %{build_alltests}
make check
%ifnarch s390x
make test
%endif
%endif

# tuck away various built files
make DESTDIR=`pwd`/MAX benchdir_root=%{_datadir} testdir=%{_datadir}/mysql-test install
nm --numeric-sort MAX/usr/sbin/mysqld > mysqld-max.sym

################################################################################
# cleanup
make clean

################################################################################
# make the mysqld-ndb server
%configure2_5x $MYSQL_COMMON_CONFIGURE_LINE \
    --without-extra-tools \
    --without-docs \
    --without-man \
    --without-bench \
    --without-embedded-server \
    --with-example-storage-engine \
    --with-archive-storage-engine \
    --with-ndbcluster \
    --with-ndb-shm \
    --without-ndb-docs \
    --with-server-suffix="-NDB"
# --with-raid won't compile
# --with-ndb-sci requires stuff from http://www.dolphinics.no/
# --with-ndb-test won't compile

%make

################################################################################
# run the tests
%if %{build_alltests}
make check
%ifnarch s390x
make test
%endif
%endif

# tuck away various built files
make DESTDIR=`pwd`/NDB benchdir_root=%{_datadir} install
nm --numeric-sort NDB/usr/sbin/mysqld > mysqld-ndb.sym

################################################################################
# cleanup
make clean

################################################################################
# make the plain mysqld server
%configure2_5x $MYSQL_COMMON_CONFIGURE_LINE \
    --enable-thread-safe-client \
    --without-embedded-server \
    --with-vio

# benchdir does not fit in above model. Maybe a separate bench distribution
%make benchdir_root=%{buildroot}%{_datadir}

################################################################################
# run the tests
%if %{build_test}
make check
%ifnarch s390x
make test
%endif
%endif

# tuck away various built files
nm --numeric-sort sql/mysqld > mysqld.sym

cat > README.MDK << EOF
MySQL server is present under 3 flavours, MySQL, MySQL-Max and MySQL-NDB.
They cannot be installed side by side.

MySQL rpm is compiled with the following option:
    --enable-shared
    --with-extra-charsets=complex
    --enable-assembler
    --enable-local-infile
    --enable-large-files=yes
    --enable-largefile=yes
    --without-readline
    --without-libwrap
    --without-mysqlfs
    --with-openssl
    --with-berkeley-db
    --with-innodb
    --with-big-tables
%if %{build_debug}
    --enable-debug
%else
    --without-debug
%endif
    --with-mysqld-user=%{muser}
    --with-unix-socket-path=%{_localstatedir}/mysql/mysql.sock
    --enable-thread-safe-client
    --without-embedded-server
    --with-vio

MySQL-Max rpm is compiled with:
    --enable-shared
    --with-extra-charsets=complex
    --enable-assembler
    --enable-local-infile
    --enable-large-files=yes
    --enable-largefile=yes
    --without-readline
    --without-libwrap
    --without-mysqlfs
    --with-openssl
    --with-berkeley-db
    --with-innodb
    --with-big-tables
%if %{build_debug}
    --enable-debug
%else
    --without-debug
%endif
    --with-mysqld-user=%{muser}
    --with-unix-socket-path=%{_localstatedir}/mysql/mysql.sock
    --with-embedded-server
    --with-server-suffix="-Max"

MySQL-NDB is compiled with:
    --enable-shared
    --with-extra-charsets=complex
    --enable-assembler
    --enable-local-infile
    --enable-large-files=yes
    --enable-largefile=yes
    --without-readline
    --without-libwrap
    --without-mysqlfs
    --with-openssl
    --with-berkeley-db
    --with-innodb
    --with-big-tables
%if %{build_debug}
    --enable-debug
%else
    --without-debug
%endif
    --with-mysqld-user=%{muser}
    --with-unix-socket-path=%{_localstatedir}/mysql/mysql.sock
    --without-embedded-server
    --with-example-storage-engine
    --with-archive-storage-engine
    --with-ndbcluster
    --with-ndb-shm
    --without-ndb-docs
    --with-server-suffix="-NDB"

NOTES:

--without-readline = Link against system readline libraries.
--with-berkeley-db = Link against private and bundled BerkleyBD
                     4.1.24. This is the only way currently.


See the spec files on http://cvs.mandrakesoft.com/SPECS/MySQL/ for 
more details.
EOF

%install 
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

# don't fiddle with the initscript!
export DONT_GPRINTIFY=1

%if %{build_debug}
export DONT_STRIP=1
%endif

install -d %{buildroot}%{_sysconfdir}/{logrotate.d,sysconfig}
install -d %{buildroot}%{_initrddir}
install -d %{buildroot}%{_docdir}/%{name}-%{version}/chapter
install -d %{buildroot}%{_var}/run/{mysqld,ndb_cpcd}
install -d %{buildroot}%{_var}/log/mysqld
install -d %{buildroot}%{_localstatedir}/mysql/{mysql,test,.tmp}

%makeinstall_std benchdir_root=%{_datadir} testdir=%{_datadir}/mysql-test 

# install installed various installed mysqld-max files
install -m0755 MAX/usr/sbin/mysqld %{buildroot}%{_sbindir}/mysqld-max
install -m0644 MAX/usr/%{_lib}/mysql/libmysqld.a %{buildroot}%{_libdir}/mysql/libmysqld.a

# install installed various installed mysqld-ndb files
install -d %{buildroot}%{_includedir}/mysql/ndb/{mgmapi,ndbapi}
install -m0644 NDB/usr/include/mysql/my_config.h %{buildroot}%{_includedir}/mysql/my_config-ndb.h
install -m0644 NDB/usr/include/mysql/ndb/*.h %{buildroot}%{_includedir}/mysql/ndb/
install -m0644 NDB/usr/include/mysql/ndb/mgmapi/*.h %{buildroot}%{_includedir}/mysql/ndb/mgmapi/
install -m0644 NDB/usr/include/mysql/ndb/ndbapi/*.h %{buildroot}%{_includedir}/mysql/ndb/ndbapi/
cp -dp NDB/usr/%{_lib}/mysql/libndbclient.* %{buildroot}%{_libdir}/
install -m0755 NDB/usr/bin/ndb_* %{buildroot}%{_bindir}/
install -m0755 NDB/usr/sbin/ndb* %{buildroot}%{_sbindir}/
install -m0755 NDB/usr/sbin/mysqld %{buildroot}%{_sbindir}/mysqld-ndb

# install symbol files ( for stack trace resolution)
install -m0644 mysqld-max.sym %{buildroot}%{_libdir}/mysql/mysqld-max.sym
install -m0644 mysqld-ndb.sym %{buildroot}%{_libdir}/mysql/mysqld-ndb.sym
install -m0644 mysqld.sym %{buildroot}%{_libdir}/mysql/mysqld.sym

# install init scripts
install -m0755 Mandrakelinux/mysqld.init %{buildroot}%{_initrddir}/mysqld
install -m0755 Mandrakelinux/mysqld.init %{buildroot}%{_initrddir}/mysqld-max
install -m0755 Mandrakelinux/mysqld.init %{buildroot}%{_initrddir}/mysqld-ndb
perl -pi -e 's/status mysqld/status mysqld-max/g;s,(/var/lock/subsys/mysqld),$1-max,' %{buildroot}%{_initrddir}/mysqld-max
perl -pi -e 's/status mysqld/status mysqld-ndb/g;s,(/var/lock/subsys/mysqld),$1-ndb,' %{buildroot}%{_initrddir}/mysqld-ndb

# install configuration files
install -m0644 Mandrakelinux/mysqld.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/mysqld
install -m0644 Mandrakelinux/mysqld.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/mysqld
install -m0644 Mandrakelinux/my.cnf %{buildroot}%{_sysconfdir}/my.cnf

# Install docs
install -m0644 Docs/mysql.info %{buildroot}%{_infodir}/mysql.info

# Fix libraries
mv %{buildroot}%{_libdir}/mysql/libmysqlclient.* %{buildroot}%{_libdir}/
mv %{buildroot}%{_libdir}/mysql/libmysqlclient_r.* %{buildroot}%{_libdir}/
perl -pi -e "s|%{_libdir}/mysql|%{_libdir}|" %{buildroot}%{_libdir}/*.la

pushd %{buildroot}%{_bindir}
    ln -sf mysqlcheck mysqlrepair
    ln -sf mysqlcheck mysqlanalyze
    ln -sf mysqlcheck mysqloptimize
popd

# house cleaning
rm -f %{buildroot}%{_datadir}/info/dir
rm -f %{buildroot}%{_bindir}/make_win_src_distribution
rm -f %{buildroot}%{_bindir}/make_win_binary_distribution
rm -f %{buildroot}%{_datadir}/mysql/*.spec
rm -f %{buildroot}%{_datadir}/mysql/postinstall
rm -f %{buildroot}%{_datadir}/mysql/preinstall
rm -f %{buildroot}%{_datadir}/mysql/mysql-log-rotate
rm -f %{buildroot}%{_datadir}/mysql/mysql.server
rm -f %{buildroot}%{_bindir}/client_test
rm -f %{buildroot}%{_bindir}/mysql_client_test

%find_lang mysql

cat >> mysql.lang << EOF 
%lang(cz) %{_datadir}/mysql/czech
%lang(da) %{_datadir}/mysql/danish
%lang(nl) %{_datadir}/mysql/dutch
%lang(et) %{_datadir}/mysql/estonian
%lang(fr) %{_datadir}/mysql/french
%lang(de) %{_datadir}/mysql/german
%lang(el) %{_datadir}/mysql/greek
%lang(hu) %{_datadir}/mysql/hungarian
%lang(it) %{_datadir}/mysql/italian
%lang(jp) %{_datadir}/mysql/japanese
%lang(ko) %{_datadir}/mysql/korean
%lang(no) %{_datadir}/mysql/norwegian
%lang(no_ny) %{_datadir}/mysql/norwegian-ny
%lang(pl) %{_datadir}/mysql/polish
%lang(pt) %{_datadir}/mysql/portuguese
%lang(ro) %{_datadir}/mysql/romanian
%lang(ru) %{_datadir}/mysql/russian
%lang(sl) %{_datadir}/mysql/slovak
%lang(es) %{_datadir}/mysql/spanish
%lang(sv) %{_datadir}/mysql/swedish
%lang(uk) %{_datadir}/mysql/ukrainian
%lang(sr) %{_datadir}/mysql/serbian
EOF

%if %mdkversion >= 1020
%multiarch_binaries %{buildroot}%{_bindir}/mysql_config
%multiarch_includes %{buildroot}%{_includedir}/mysql/my_config.h
%multiarch_includes %{buildroot}%{_includedir}/mysql/my_config-ndb.h
%endif

cat > README.urpmi <<EOF
As a security measure networking in the mysql server has been disabled per 
default, only localhost connections will work. This is because the mysql
root user has no password in a default install and that leaves the MySQL
server open for anyone to use.

To enable networking the user has to edit or delete the
%{_sysconfdir}/sysconfig/mysqld file.
EOF

%pre common
%_pre_useradd %{muser} %{_localstatedir}/mysql /bin/bash

%post common
%_install_info mysql.info

%post
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
chown -R %{muser}:%{muser} %{_localstatedir}/mysql

# make sure the %{_localstatedir}/mysql directory can be accessed
chmod 711 %{_localstatedir}/mysql

# Initiate databases
export TMPDIR="%{_localstatedir}/mysql/.tmp"
export TMP="${TMPDIR}"
su - %{muser} -c "mysql_install_db --rpm --user=%{muser}" > /dev/null

%_post_service mysqld

# Allow mysqld_safe to start mysqld and print a message before we exit
sleep 2

# try to fix privileges table, use a no password user table for that
fix_privileges() 
{
    datadir=`my_print_defaults mysqld | grep '^--datadir=' | cut -d= -f2`
    if [ -z $datadir ]; then
        datadir=%{_localstatedir}/mysql/
    fi
    cd $datadir/mysql
    pid_file=$datadir/mysqld-fix_privileges.pid
    if %{_bindir}/mysqld_safe --skip-grant-tables --skip-networking --pid-file=$pid_file &> /dev/null & then  
        pid=$!
        i=1
        while [ $i -lt 10 -a ! -f $pid_file ]; do 
            i=$(($i+1))
            sleep 1
        done
        if [ -f $datadir/mysqld-fix_privileges.pid ]; then
            %{_bindir}/mysql_fix_privilege_tables &> /dev/null 
            kill `cat $pid_file` &> /dev/null
            rm -f $pid_file
        else 
            # just in case
            kill $pid &> /dev/null
        fi
        sleep 2
    fi
}

if [ -f /var/lock/subsys/mysqld ]; then
    /sbin/service mysqld stop &> /dev/null
    fix_privileges
    /sbin/service mysqld start &> /dev/null 
else
    fix_privileges
fi

%post Max
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
chown -R %{muser}:%{muser} %{_localstatedir}/mysql

# make sure the %{_localstatedir}/mysql directory can be accessed
chmod 711 %{_localstatedir}/mysql

# Initiate databases
export TMPDIR="%{_localstatedir}/mysql/.tmp"
export TMP="${TMPDIR}"
su - %{muser} -c "mysql_install_db --rpm --user=%{muser}" > /dev/null

# Change permissions again to fix any new files.
chown -R %{muser}:%{muser} %{_localstatedir}/mysql

# Fix permissions for the permission database so that only the user
# can read them.
chmod -R og-rw %{_localstatedir}/mysql

%_post_service mysqld-max
# Allow mysqld_safe to start mysqld and print a message before we exit
sleep 2

# try to fix privileges table, use a no password user table for that
fix_privileges() 
{
    datadir=`my_print_defaults mysqld | grep '^--datadir=' | cut -d= -f2`
    if [ -z $datadir ]; then
        datadir=%{_localstatedir}/mysql/
    fi
    cd $datadir/mysql
    pid_file=$datadir/mysqld-fix_privileges.pid
    if %{_bindir}/mysqld_safe --skip-grant-tables --skip-networking --pid-file=$pid_file &> /dev/null & then  
        pid=$!
        i=1
        while [ $i -lt 10 -a ! -f $pid_file ]; do 
            i=$(($i+1))
            sleep 1
        done
        if [ -f $datadir/mysqld-fix_privileges.pid ]; then
            %{_bindir}/mysql_fix_privilege_tables &> /dev/null 
            kill `cat $pid_file` &> /dev/null
            rm -f $pid_file
        else 
            # just in case
            kill $pid &> /dev/null
        fi
        sleep 2
    fi
}

if [ -f /var/lock/subsys/mysqld-max ]; then
    /sbin/service mysqld-max stop &> /dev/null
    fix_privileges
    /sbin/service mysqld-max start &> /dev/null 
else
    fix_privileges
fi

%post NDB
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
chown -R %{muser}:%{muser} %{_localstatedir}/mysql

# make sure the %{_localstatedir}/mysql directory can be accessed
chmod 711 %{_localstatedir}/mysql

# Initiate databases
export TMPDIR="%{_localstatedir}/mysql/.tmp"
export TMP="${TMPDIR}"
su - %{muser} -c "mysql_install_db --rpm --user=%{muser}" > /dev/null

# Change permissions again to fix any new files.
chown -R %{muser}:%{muser} %{_localstatedir}/mysql

# Fix permissions for the permission database so that only the user
# can read them.
chmod -R og-rw %{_localstatedir}/mysql

%_post_service mysqld-ndb
# Allow mysqld_safe to start mysqld and print a message before we exit
sleep 2

# try to fix privileges table, use a no password user table for that
fix_privileges() 
{
    datadir=`my_print_defaults mysqld | grep '^--datadir=' | cut -d= -f2`
    if [ -z $datadir ]; then
        datadir=%{_localstatedir}/mysql/
    fi
    cd $datadir/mysql
    pid_file=$datadir/mysqld-fix_privileges.pid
    if %{_bindir}/mysqld_safe --skip-grant-tables --skip-networking --pid-file=$pid_file &> /dev/null & then  
        pid=$!
        i=1
        while [ $i -lt 10 -a ! -f $pid_file ]; do 
            i=$(($i+1))
            sleep 1
        done
        if [ -f $datadir/mysqld-fix_privileges.pid ]; then
            %{_bindir}/mysql_fix_privilege_tables &> /dev/null 
            kill `cat $pid_file` &> /dev/null
            rm -f $pid_file
        else 
            # just in case
            kill $pid &> /dev/null
        fi
        sleep 2
    fi
}

if [ -f /var/lock/subsys/mysqld-ndb ]; then
    /sbin/service mysqld-ndb stop &> /dev/null
    fix_privileges
    /sbin/service mysqld-ndb start &> /dev/null 
else
    fix_privileges
fi

%preun
%_preun_service mysqld
# We do not remove the mysql user since it may still own a lot of
# database files.

%preun common
%_remove_install_info mysql.info

%preun Max
%_preun_service mysqld-max

%preun NDB
%_preun_service mysqld-ndb

%triggerin -n %{name} -- %{name} < 4.1.10
if [ -f /var/lock/subsys/mysql ]; then
    pidname="/var/lib/mysql/`/bin/hostname`.pid"
    if [ -f ${pidname} ]; then
	kill `cat ${pidname}`
	%{_initrddir}/mysqld start
    fi
fi

%triggerin -n %{name}-Max -- %{name}-Max < 4.1.10
if [ -f /var/lock/subsys/mysql-max ]; then
    pidname="/var/lib/mysql/`/bin/hostname`.pid"
    if [ -f ${pidname} ]; then
	kill `cat ${pidname}`
	%{_initrddir}/mysqld-max start
    fi
fi

%triggerin -n %{name}-NDB -- %{name} < 4.1.10
if [ -f /var/lock/subsys/mysql ]; then
    pidname="/var/lib/mysql/`/bin/hostname`.pid"
    if [ -f ${pidname} ]; then
	kill `cat ${pidname}`
	%{_initrddir}/mysqld start
    fi
fi

%triggerin -n %{name}-NDB -- %{name}-Max < 4.1.10
if [ -f /var/lock/subsys/mysql-max ]; then
    pidname="/var/lib/mysql/`/bin/hostname`.pid"
    if [ -f ${pidname} ]; then
	kill `cat ${pidname}`
	%{_initrddir}/mysqld-max start
    fi
fi

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root) 
%doc README.MDK README.urpmi
%attr(0755,root,root) %config(noreplace) %{_initrddir}/mysqld
%attr(0755,root,root) %{_sbindir}/mysqld
%attr(0644,root,root) %{_libdir}/mysql/mysqld.sym

%files Max
%defattr(-,root,root)
%doc README.MDK README.urpmi
%attr(0755,root,root) %config(noreplace) %{_initrddir}/mysqld-max
%attr(0755,root,root) %{_sbindir}/mysqld-max
%attr(0644,root,root) %{_libdir}/mysql/mysqld-max.sym

%files NDB
%defattr(-,root,root)
%doc README.MDK README.urpmi
%attr(0755,root,root) %config(noreplace) %{_initrddir}/mysqld-ndb
%attr(0755,root,root) %{_sbindir}/mysqld-ndb
%attr(0755,root,root) %{_sbindir}/ndb*
%attr(0644,root,root) %{_libdir}/mysql/mysqld-ndb.sym

%files client
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/msql2mysql
%attr(0755,root,root) %{_bindir}/mysql
%attr(0755,root,root) %{_bindir}/mysqlaccess
%attr(0755,root,root) %{_bindir}/mysqladmin
%attr(0755,root,root) %{_bindir}/mysqlcheck
%attr(0755,root,root) %{_bindir}/mysqlrepair
%attr(0755,root,root) %{_bindir}/mysqlanalyze
%attr(0755,root,root) %{_bindir}/mysqloptimize
%attr(0755,root,root) %{_bindir}/mysql_find_rows
%attr(0755,root,root) %{_bindir}/mysqldump
%attr(0755,root,root) %{_bindir}/mysqldumpslow
%attr(0755,root,root) %{_bindir}/mysqlimport
%attr(0755,root,root) %{_bindir}/mysqlshow
%attr(0755,root,root) %{_bindir}/mysqlbinlog
%{_mandir}/man1/*.1*

%files bench
%defattr(-,root,root)
%doc sql-bench/README
%{_datadir}/sql-bench
%{_datadir}/mysql-test

%files common -f mysql.lang
%defattr(-,root,root) 
%doc README COPYING Docs/*.html Docs/*.txt Docs/*.texi Docs/*.ps support-files/*.cnf Docs/manual-split
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/mysqld
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/mysqld
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/my.cnf
%attr(0755,root,root) %{_bindir}/isamchk
%attr(0755,root,root) %{_bindir}/isamlog
%attr(0755,root,root) %{_bindir}/pack_isam
%attr(0755,root,root) %{_bindir}/myisamchk
%attr(0755,root,root) %{_bindir}/myisamlog
%attr(0755,root,root) %{_bindir}/myisampack
%attr(0755,root,root) %{_bindir}/mysql_fix_privilege_tables
%attr(0755,root,root) %{_bindir}/mysql_convert_table_format
%attr(0755,root,root) %{_bindir}/mysql_install_db
%attr(0755,root,root) %{_bindir}/mysql_setpermission
%attr(0755,root,root) %{_bindir}/mysql_explain_log 
%attr(0755,root,root) %{_bindir}/mysql_fix_extensions 
%attr(0755,root,root) %{_bindir}/mysql_secure_installation 
%attr(0755,root,root) %{_bindir}/mysql_tableinfo 
%attr(0755,root,root) %{_bindir}/mysql_waitpid 
%attr(0755,root,root) %{_bindir}/mysql_create_system_tables
%attr(0755,root,root) %{_bindir}/mysql_tzinfo_to_sql
%attr(0755,root,root) %{_bindir}/mysqlmanager-pwgen 
%attr(0755,root,root) %{_bindir}/mysqlmanager
%attr(0755,root,root) %{_bindir}/mysqlmanagerc 
%attr(0755,root,root) %{_bindir}/mysql_zap
%attr(0755,root,root) %{_bindir}/mysqlbug
%attr(0755,root,root) %{_bindir}/mysqltest
%attr(0755,root,root) %{_bindir}/mysqlhotcopy
%attr(0755,root,root) %{_bindir}/perror
%attr(0755,root,root) %{_bindir}/replace
%attr(0755,root,root) %{_bindir}/resolveip
%attr(0755,root,root) %{_bindir}/resolve_stack_dump
%attr(0755,root,root) %{_bindir}/mysqld_safe
%attr(0755,root,root) %{_bindir}/mysqld_multi
%attr(0755,root,root) %{_bindir}/my_print_defaults
%attr(0755,root,root) %{_bindir}/myisam_ftdump
%attr(0755,root,root) %{_bindir}/ndb_*
%{_infodir}/mysql.info*
%attr(0711,%{muser},%{muser}) %dir %{_localstatedir}/mysql
%attr(0711,%{muser},%{muser}) %dir %{_localstatedir}/mysql/mysql
%attr(0711,%{muser},%{muser}) %dir %{_localstatedir}/mysql/test
%attr(0711,%{muser},%{muser}) %dir %{_localstatedir}/mysql/.tmp
%attr(0755,%{muser},%{muser}) %dir %{_var}/run/mysqld
%attr(0755,%{muser},%{muser}) %dir %{_var}/run/ndb_cpcd
%attr(0755,%{muser},%{muser}) %dir %{_var}/log/mysqld
%dir %{_datadir}/mysql
%{_datadir}/mysql/mi_test_all
%{_datadir}/mysql/mi_test_all.res
%{_datadir}/mysql/*.cnf
%{_datadir}/mysql/charsets
%{_datadir}/mysql/english
%{_datadir}/mysql/Description.plist
%{_datadir}/mysql/Info.plist
%{_datadir}/mysql/StartupParameters.plist
%{_datadir}/mysql/fill_help_tables.sql
%{_datadir}/mysql/mysql_fix_privilege_tables.sql
%{_datadir}/mysql/japanese-sjis
%{_datadir}/mysql/*.ini

%files -n %{libname}
%defattr(-,root,root)
%doc ChangeLog
# Shared olibraries (omit for architectures that don't support them)
%attr(0755,root,root) %{_libdir}/*.so.*

%files -n %{libname}-devel
%defattr(-,root,root)
%doc INSTALL-SOURCE
%attr(0755,root,root) %{_bindir}/comp_err
%if %mdkversion >= 1020
%multiarch %{multiarch_bindir}/mysql_config
%endif
%attr(0755,root,root) %{_bindir}/mysql_config
%dir %{_libdir}/mysql
%attr(0644,root,root) %{_libdir}/mysql/libdbug.a
%attr(0644,root,root) %{_libdir}/mysql/libheap.a
%attr(0644,root,root) %{_libdir}/mysql/libmerge.a
%attr(0644,root,root) %{_libdir}/mysql/libmyisam.a
%attr(0644,root,root) %{_libdir}/mysql/libmyisammrg.a
%attr(0644,root,root) %{_libdir}/mysql/libmysqld.a
%attr(0644,root,root) %{_libdir}/mysql/libmystrings.a
%attr(0644,root,root) %{_libdir}/mysql/libmysys.a
%attr(0644,root,root) %{_libdir}/mysql/libnisam.a
%attr(0644,root,root) %{_libdir}/mysql/libvio.a
%attr(0644,root,root) %{_libdir}/*.la
%attr(0755,root,root) %{_libdir}/*.so
%attr(0644,root,root) %{_libdir}/*.a
%{_includedir}/mysql
%if %mdkversion >= 1020
%multiarch %{multiarch_includedir}/mysql/my_config.h
%multiarch %{multiarch_includedir}/mysql/my_config-ndb.h
%endif
    
%changelog
* Thu Jun 22 2006 Stew Benedict <sbenedict@mandriva.com> 4.1.11-1.6.102mdk
- P15: security fix for CVE-2006-3081

* Tue Jun 06 2006 Stew Benedict <sbenedict@mandriva.com> 4.1.11-1.5.102mdk
- P14: security fix for CVE-2006-2753

* Thu May 04 2006 Vincent Danen <vdanen@mandriva.com> 4.1.11-1.4.102mdk
- P13: patch for recent security fixes

* Fri Mar 31 2006 Stew Benedict <sbenedict@mandriva.com> 4.1.11-1.3.102mdk
- P12: security fix for CVE-2006-0903

* Tue Feb 21 2006 Vincent Danen <vdanen@mandriva.com> 4.1.11-1.2.102mdk
- P11: security update for CVE-2005-1636

* Mon Sep 12 2005 Vincent Danen <vdanen@mandriva.com> 4.1.11-1.1.102mdk
- P10: security update for CAN-2005-2558

* Wed Apr 06 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.11-1mdk
- 4.1.11 (adresses CAN-2004-0957 and contain bug fixes)
- rediff P6
- use --with-big-tables

* Mon Mar 14 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.10a-1mdk
- 4.1.10a addresses CAN-2005-0709, CAN-2005-0710 and CAN-2005-0711
- use the %%mkrel macro

* Wed Mar 09 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.10-2mdk
- use %%triggerin in case we update a running system

* Fri Feb 25 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.10-1mdk
- 4.1.10
- rediffed P0, P5
- drop P100 as the CAN-2005-0004 fix has been implemented upstream
- use a different pid name for the fix_privileges stuff in %%post

* Wed Feb 16 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-8mdk
- added P100 from PLD (CAN-2005-0004)

* Thu Feb 03 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-7mdk
- added rediffed P7 and P8 from the latest db-4.1.25 package, plus
  added P9 to use it in an attempt to address possible nptl issues.
- added README.urpmi after peeking at bash-completion

* Fri Jan 28 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-6mdk
- provide TMPDIR and TMP directory and environment (#13285)

* Wed Jan 26 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-5mdk
- really fix conditional deps and %%multiarch :)

* Tue Jan 25 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-4mdk
- fix conditional deps and %%multiarch

* Mon Jan 24 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-3mdk
- added missing pieces, with a twist
- added P4,P5,P6 from fedora
- run the test suite (man!, this takes time...)
- fixed a bug in the initscript spotted by Lionel VICTOR
- fixed a bug in the mysql_install_db.sh patch

* Sat Jan 22 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-2mdk
- fix deps
- cleanups

* Fri Jan 21 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-1mdk
- rename the package, drop the 41 in the name, adjust deps accordinly
- fixed the init script and default config
- drop redundant patches
- fix the mysql_install_db.sh and mysqld_safe.sh scripts
- misc spec file fixes

* Fri Jan 21 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-2mdk
- added some conflicts
- added P5 (fedora)
- added --enable-large-files=yes --enable-largefile=yes
- fixed an error in the init scripts
- link against system readline

* Fri Jan 14 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.9-1mdk
- 4.1.9

* Fri Dec 17 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.8-1mdk
- 4.1.8

* Tue Dec 14 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.7-4mdk
- added the ndb sub package
- fix deps

* Sat Oct 30 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.7-3mdk
- make it build on 10.0 too
- provide a by chapter split manual

* Thu Oct 28 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.7-2mdk
- fix P1

* Wed Oct 27 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.7-1mdk
- 4.1.7

* Sun Oct 17 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.6-0.1mdk
- 4.1.6-gamma
- misc spec file fixes

* Wed Sep 22 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.5-0.1mdk
- 4.1.5-gamma

* Tue Aug 31 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.4-0.1mdk
- 4.1.4-gamma

* Sat Jul 31 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.1.3-0.1mdk
- 4.1.3-beta
- rediffed some patches
- major spec file cleanups

* Thu Jun  3 2004 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 4.0.20-3mdk
- rebuilt against gcc3.4
- fix buildrequires: libstdc++-static-devel

* Sat May 29 2004 Michael Scherer <misc@mandrake.org> 4.0.20-2mdk 
- [DIRM]
- fix rebuild
- added README.MDK

* Tue May 18 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.0.20-1mdk
- oops! 4.0.19 was broken (but works for me), pointed out by 
  Benjamin Pflugmann, thanks man!

* Mon May 17 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.0.19-1mdk
- 4.0.19
- fix for CAN-2004-0381, CAN-2004-0388 is included

* Mon May 17 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 4.0.18-2mdk
- security fix for CAN-2004-0381, CAN-2004-0388 (vdanen)
- misc spec file fixes
- remove unused patches (P1, P2, P3, P4, P9, P10)

* Sun Feb 22 2004 Warly <warly@mandrakesoft.com> 4.0.18-1mdk
- new version (bugfixes)
- add innodb support in default MySQL
- do not call logger in initscripts any more to close all local IO references

* Tue Jan 20 2004 Frederic Lepied <flepied@mandrakesoft.com> 4.0.17-2mdk
- fixed strings in init scripts
- add require perl-Mysql in MySQL-common

* Sun Dec 21 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.0.17-1mdk
- 4.0.17
- rediffed P0 and P8
- drop unused P7

* Thu Oct 23 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.0.16-1mdk
- 4.0.16
- rediffed P0 and P5
- make it start after network and before any other requiring it (P0)

* Sun Sep 14 2003 Warly <warly@mandrakesoft.com> 4.0.15-1mdk
- Security update

* Fri Aug  8 2003 Warly <warly@mandrakesoft.com> 4.0.14-1mdk
- new version (main changes):
   * Enabled `INSERT' from `SELECT' when the table into which the records are inserted is also a table listed in the `SELECT'.
   * Added `--nice' option to `mysqld_safe' to allow setting the  niceness of the `mysqld' process.
   * `RESET SLAVE' now clears the `Last_errno' and `Last_error' fields in the output of `SHOW SLAVE STATUS'.
   * Added `max_relay_log_size' variable; the relay log will be rotated
     automatically when its size exceeds `max_relay_log_size'. But if
     `max_relay_log_size' is 0 (the default), `max_binlog_size' will be
     used (as in older versions). `max_binlog_size' still applies to
     binary logs in any case.

* Fri Aug  1 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 4.0.13-4mdk
- lib64 fixes, quotes test fixes
- BuildRequires: termcap-devel for MDK 9.2

* Thu Jul 10 2003 Laurent MONTEL <lmontel@mandrakesoft.com> 4.0.13-3mdk
- Rebuild

* Wed Jun 04 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.0.13-2mdk
- brute fix the offending "perl(the)" stuff, remove this when perl.req is fixed.
- fix "no-prereq-on rpm-helper" for MySQL-common
- fix "no-provides libmysql-devel" for libmysql12-devel
- activated %%clean

* Fri May 30 2003 Warly <warly@mandrakesoft.com> 4.0.13-1mdk
- new version (main changes):
Functionality added or changed:
 - `PRIMARY KEY' now implies `NOT NULL'.
 - `SHOW MASTER STATUS' and `SHOW SLAVE STATUS' required the `SUPER'  privilege; now they accept `REPLICATION CLIENT' as well.
 - MySQL now issues a warning when it opens a table that was created with MySQL 4.1.
 - Option `--new' now changes binary items (`0xFFDF') to be treated
   as binary strings instead of numbers by default. This fixes some
   problems with character sets where it's convenient to input the
   string as a binary item.  After this change you have to convert
   the binary string to `INTEGER' with a `CAST' if you want to
   compare two binary items with each other and know which one is
   bigger than the other.  `SELECT CAST(0xfeff AS UNSIGNED) <
   CAST(0xff AS UNSIGNED)'.  This will be the default behaviour in
   MySQL 4.1. (Bug #152)
 - Fixed bug with `NATURAL LEFT JOIN', `NATURAL RIGHT JOIN' and
   `RIGHT JOIN' when using many joined tables.  The problem was that
   the `JOIN' method was not always associated with the tables
   surrounding the `JOIN' method.  If you have a query that uses many
   `RIGHT JOIN' or `NATURAL ... JOINS' you should check that they
   work as you expected after upgrading MySQL to this version.
 - Tuned optimizer to favour clustered index over table scan.
 - `BIT_AND()' and `BIT_OR()' now return an unsigned 64 bit value.
Bugs fixed:
 - Fixed `Unknown error' when using `UPDATE ... LIMIT'.
 - Fixed problem with ansi mode and `GROUP BY' with constants.
 - Fixed bug if one used a multi-table `UPDATE' and the query required a temporary table bigger than `tmp_table_size'.
 - `LOAD DATA INFILE' will now read `000000' as a zero date instead as `"2000-00-00"'.
 - Fixed bug that caused `DELETE FROM table WHERE const_expression' always to delete the whole table.
 - Fixed core dump bug when using `FORMAT('nan',#)'.
 - Fixed wrong result from truncation operator (`*') in `MATCH ... AGAINST()' in some complex joins.
 - Fixed a crash in `REPAIR ... USE_FRM' command, when used on read-only, nonexisting table or a table with a crashed index file.
 - Fixed bug in `LEFT', `RIGHT' and `MID' when used with multi-byte character sets and some `GROUP BY' queries.
 - Fix problem with `ORDER BY' being discarded for some `DISTINCT' queries.
 - Fixed that `SET SQL_BIG_SELECTS=1' works as documented (New bug in 4.0)
 - Fixed some serious bugs in `UPDATE ... ORDER BY'.
 - Fixed that `SET SQL_BIG_SELECTS=1' works again.
 - `FULLTEXT' index stopped working after `ALTER TABLE' that converts `TEXT' field to `CHAR'. 
 - Fixed a security problem with `SELECT' and wildcarded select list, when user only had partial column `SELECT' privileges on the table.
 - Only ignore world-writeable `my.cnf' files that are regular files (and not e.g. named pipes or character devices).
 - `SUM()' didn't return `NULL' when there was no rows in result or  when all values was `NULL'.
 - On Unix symbolic links handling was not enabled by default and there was no way to turn this on.
 - Fixed a bug with `NAN' in `FORMAT(...)' function ...
 - Fixed a bug with improperly cached database privileges.
 - Fixed a bug in `ALTER TABLE ENABLE / DISABLE KEYS' which failed to force a refresh of table data in the cache.
 - Fixed bugs in replication of `LOAD DATA INFILE' for custom parameters (`ENCLOSED',  `TERMINATED' and so on) and temporary tables.
 - Fixed a replication bug when the master is 3.23 and the slave 4.0:  the slave lost the replicated temporary tables if `FLUSH LOGS' was issued on the master.

* Sun May 11 2003 Stefan van der Eijk <stefan@eijk.nu> 4.0.12-3mdk
- BuildRequires openssl-static-devel
- removed redeundant BuildRequires
- fix build on alpha: add -fPIC to CXXFLAGS (thanks glee)

* Fri May  2 2003 Warly <warly@mandrakesoft.com> 4.0.12-2mdk
- buildrequires openssl-devel
- add splitted manual in 'chapter' subdir in doc dir (Steve White)

* Wed Apr  9 2003 Warly <warly@mandrakesoft.com> 4.0.12-1mdk
- new version (main changes):
 * `mysqld' no longer reads options from world-writeable config files.
 * Fixed `mysqld' crash on extremely small values of `sort_buffer' variable.
 * Fixed checking of random part of `WHERE' clause.
 * Don't allow `BACKUP TABLE' to overwrite existing files.
 * Fixed a bug with multi-table `UPDATE's when user had all privileges
   on the database where tables are located and there were any
   entries in `tables_priv' table, i.e. `grant_option' was true.
 * Fixed a bug that allowed a user with table or column grants on
   some table, `TRUNCATE' any table in the same database.
 * Fixed deadlock when doing `LOCK TABLE' followed by `DROP TABLE' in
   the same thread.  In this case one could still kill the thread
   with `KILL'.
 * Fixed query cache invalidation on `LOAD DATA'.
 * Fixed memory leak on `ANALYZE' procedure with error.
 * Fixed a bug in handling `CHAR(0)' columns that could cause wrong results from the query.
 * Fixed a crash when no database was selected and `LOAD DATA' command
   was issued with full table name specified, including database
   prefix.
- add Zdenek Mazanec patch for charset conversion fix

* Wed Mar 12 2003 Warly <warly@mandrakesoft.com> 4.0.11a-5mdk
- Apply Benjamin Pflugmann patch to mysql_install_db

* Sun Mar  9 2003 Warly <warly@mandrakesoft.com> - 4.0.11a-4mdk
- Correct post install scripts and requires

* Thu Mar  6 2003 Warly <warly@mandrakesoft.com> 4.0.11a-3mdk
- MySQL and MySQL-Max conflicts between each others
- include a separate service for mysql and mysql-max in respective server to have clean uninstall
- fix requires in MySQL MySQL-common and MySQL-max
- Try to correct post install script to fix privileges.
- fix initscripts problem with chkconfig --add

* Mon Mar  3 2003 Warly <warly@mandrakesoft.com> 4.0.11a-2mdk
- use --skip-grant-tables --skip-networking for the update process (Benjamin Pflugmann)

* Sat Mar  1 2003  <warly@ke.mandrakesoft.com> 4.0.11a-1mdk
- new version
- new MySQL-common package
- call mysql_fix_privilege_tables in post (but this will fail if
root access need a password)
- add openssl support in MySQL-Max

* Fri Feb  7 2003 Warly <warly@mandrakesoft.com> 4.0.10-1mdk
- new version
- fix initscript

* Thu Feb  6 2003 Warly <warly@mandrakesoft.com> 4.0.9-1mdk
- new version
- do not compile in static anymore
- check mysqld-max on status

* Tue Jan 28 2003 Vincent Danen <vdanen@mandrakesoft.com> 3.23.55-1mdk
- 3.23.55; fixes a double free() in COM_CHANGE_USER
- comment out --with-comment for %%configure as it doesn't seem to like us
  anymore

* Tue Dec 24 2002 Warly <warly@mandrakesoft.com> 3.23.54a-1mdk
- new version

* Wed Nov 20 2002 Warly <warly@mandrakesoft.com> 3.23.53-5mdk
- fix /var/lib/lib/ home dir typo
- remove lang tag to english

* Tue Nov 19 2002 Warly <warly@mandrakesoft.com> 3.23.53-4mdk
- add glibc-static-devel buildrequires

* Tue Nov 19 2002 Warly <warly@mandrakesoft.com> 3.23.53-3mdk
- fix file ownership problems in /var/lib/mysql
- put lang files in %%lang

* Sat Nov  9 2002 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.23.53-2mdk
- Patch3: Fix build on x86-64

* Wed Oct 23 2002 Warly <warly@mandrakesoft.com> 3.23.53-1mdk
- new version
 
* Sun Aug 18 2002 Christian Belisle <cbelisle@mandrakesoft.com> 3.23.52-1mdk
- update from Oden Eriksson <oden.eriksson@kvikkjokk.net>:
	- new stable version

* Sat Aug 10 2002 Christian Belisle <cbelisle@mandrakesoft.com> 3.23.51-4mdk
- fix initscript.

* Wed Jul 17 2002 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.23.51-3mdk
- Patch2: Fix --with-other-libc support
- Take care of new CFLAGS from %%serverbuild
- rpmlint fixes: configure-without-libdir-spec, hardcoded-library-path
- Stop hardcoding compiler versions. Why so? and why parts of the
  %%changelog were nuked away??

* Sat Jul  6 2002 Stefan van der Eijk <stefan@eijk.nu> 3.23.51-2mdk
- BuildRequires

* Fri Jun 14 2002 Christian Belisle <cbelisle@mandrakesoft.com> 3.23.51-1mdk
- New version.

* Thu Apr 25 2002 Christian Belisle <cbelisle@mandrakesoft.com> 3.23.50-1mdk
- Synchronize with MySQL official SPEC
- Add InnoDB support
- Build against gcc 3.

* Fri Feb 15 2002 Sasha

- changed build to use --with-other-libc

* Fri Apr 13 2001 Monty

- Added mysqld-max to the distribution

* Tue Jan 2  2001  Monty

- Added mysql-test to the bench package

* Fri Aug 18 2000 Tim Smith <tim@mysql.com>

- Added separate libmysql_r directory; now both a threaded
  and non-threaded library is shipped.

* Wed Sep 28 1999 David Axmark <davida@mysql.com>

- Added the support-files/my-example.cnf to the docs directory.

- Removed devel dependency on base since it is about client
  development.

* Wed Sep 8 1999 David Axmark <davida@mysql.com>

- Cleaned up some for 3.23.

* Thu Jul 1 1999 David Axmark <davida@mysql.com>

- Added support for shared libraries in a separate sub
  package. Original fix by David Fox (dsfox@cogsci.ucsd.edu)

- The --enable-assembler switch is now automatically disables on
  platforms there assembler code is unavailable. This should allow
  building this RPM on non i386 systems.

* Mon Feb 22 1999 David Axmark <david@detron.se>

- Removed unportable cc switches from the spec file. The defaults can
  now be overridden with environment variables. This feature is used
  to compile the official RPM with optimal (but compiler version
  specific) switches.

- Removed the repetitive description parts for the sub rpms. Maybe add
  again if RPM gets a multiline macro capability.

- Added support for a pt_BR translation. Translation contributed by
  Jorge Godoy <jorge@bestway.com.br>.

* Wed Nov 4 1998 David Axmark <david@detron.se>

- A lot of changes in all the rpm and install scripts. This may even
  be a working RPM :-)

* Sun Aug 16 1998 David Axmark <david@detron.se>

- A developers changelog for MySQL is available in the source RPM. And
  there is a history of major user visible changed in the Reference
  Manual.  Only RPM specific changes will be documented here.