Commit 61ae95ed authored by Joerg Bruehe's avatar Joerg Bruehe

Upmerge the spec file alignment from 5.1 to 5.5,

no other functional changes.
parents 0d9f6bcc 16e60ff5
......@@ -14,54 +14,44 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA.
%define mysql_version @VERSION@
##############################################################################
# Some common macro definitions
##############################################################################
# NOTE: "vendor" is used in upgrade/downgrade check, so you can't
# change these, has to be exactly as is.
%define mysql_old_vendor MySQL AB
%define mysql_vendor Sun Microsystems, Inc.
# use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x)
# to enable static linking (off by default)
%{?_with_static:%define STATIC_BUILD 1}
%{!?_with_static:%define STATIC_BUILD 0}
# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
# to build with yaSSL support (off by default)
%{?_with_yassl:%define YASSL_BUILD 1}
%{!?_with_yassl:%define YASSL_BUILD 0}
# ----------------------------------------------------------------------
# use "rpmbuild --with bundled_zlib" or "rpm --define '_with_bundled_zlib 1'"
# (for RPM 3.x) to build using the bundled zlib (off by default)
# ----------------------------------------------------------------------
%{?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 1}
%{!?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 0}
# use "rpmbuild --with cluster" or "rpm --define '_with_cluster 1'" (for RPM 3.x)
# to build with cluster support (off by default)
%{?_with_cluster:%define CLUSTER_BUILD 1}
%{!?_with_cluster:%define CLUSTER_BUILD 0}
# ----------------------------------------------------------------------
# support optional "tcmalloc" stuff (experimental)
# ----------------------------------------------------------------------
%{?malloc_lib_target:%define WITH_TCMALLOC 1}
%{!?malloc_lib_target:%define WITH_TCMALLOC 0}
%define mysql_version @VERSION@
%if %{STATIC_BUILD}
%define release 1
%else
%define release 1.glibc23
%endif
%define mysql_license GPL
%define mysqld_user mysql
%define mysqld_group mysql
%define server_suffix -standard
%define mysqldatadir /var/lib/mysql
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
# ------------------------------------------------------------------------------
# On SuSE 9 no separate "debuginfo" package is built. To enable basic
# debugging on that platform, we don't strip binaries on SuSE 9. We
# disable the strip of binaries by redefining the RPM macro
# "__os_install_post" leaving out the script calls that normally does
# this. We do this in all cases, as on platforms where "debuginfo" is
# created, a script "find-debuginfo.sh" will be called that will do
# the strip anyway, part of separating the executable and debug
# information into separate files put into separate packages.
#
# Some references (shows more advanced conditional usage):
# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html
# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
# ------------------------------------------------------------------------------
%define __os_install_post /usr/lib/rpm/brp-compress
# ------------------------------------------------------------------------------
# We don't package all files installed into the build root by intention -
# See BUG#998 for details.
# ------------------------------------------------------------------------------
%define _unpackaged_files_terminate_build 0
# ------------------------------------------------------------------------------
......@@ -77,34 +67,71 @@
%undefine __perl_provides
%undefine __perl_requires
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
##############################################################################
# Command line handling
##############################################################################
# On SuSE 9 no separate "debuginfo" package is built. To enable basic
# debugging on that platform, we don't strip binaries on SuSE 9. We
# disable the strip of binaries by redefining the RPM macro
# "__os_install_post" leaving out the script calls that normally does
# this. We do this in all cases, as on platforms where "debuginfo" is
# created, a script "find-debuginfo.sh" will be called that will do
# the strip anyway, part of separating the executable and debug
# information into separate files put into separate packages.
#
# Some references (shows more advanced conditional usage):
# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html
# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
# ----------------------------------------------------------------------
# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
# to build with yaSSL support (off by default)
# ----------------------------------------------------------------------
%{?_with_yassl:%define YASSL_BUILD 1}
%{!?_with_yassl:%define YASSL_BUILD 0}
%define __os_install_post /usr/lib/rpm/brp-compress
# ----------------------------------------------------------------------
# use "rpmbuild --without bundled_zlib" or "rpm --define '_without_bundled_zlib 1'"
# (for RPM 3.x) to not build using the bundled zlib (on by default)
# ----------------------------------------------------------------------
%{!?_with_bundled_zlib: %{!?_without_bundled_zlib: %define WITH_BUNDLED_ZLIB 1}}
%{?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 1}
%{?_without_bundled_zlib:%define WITH_BUNDLED_ZLIB 0}
# ----------------------------------------------------------------------
# support optional "tcmalloc" stuff (experimental)
# ----------------------------------------------------------------------
%{?malloc_lib_target:%define WITH_TCMALLOC 1}
%{!?malloc_lib_target:%define WITH_TCMALLOC 0}
# ----------------------------------------------------------------------
# use "rpmbuild --with cluster" or "rpm --define '_with_cluster 1'" (for RPM 3.x)
# to build with cluster support (off by default)
# ----------------------------------------------------------------------
%{?_with_cluster:%define CLUSTER_BUILD 1}
%{!?_with_cluster:%define CLUSTER_BUILD 0}
##############################################################################
# Product definitions - set for a "community" package
##############################################################################
%define server_suffix -community
%define package_suffix -community
%define ndbug_comment MySQL Community Server (GPL)
%define debug_comment MySQL Community Server - Debug (GPL)
%define commercial 0
%define EMBEDDED_BUILD 1
%define PARTITION_BUILD 1
# Default for CLUSTER_BUILD is "0", but command line option may override it
%define COMMUNITY_BUILD 1
%define INNODB_BUILD 1
%define NORMAL_TEST_MODE test-bt
%define DEBUG_TEST_MODE test-bt-debug
%define mysql_license GPL
%define src_dir mysql-%{mysql_version}
##############################################################################
# Main spec file section
##############################################################################
Name: MySQL
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
Version: @MYSQL_U_SCORE_VERSION@
Release: %{release}
License: Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Under %{mysql_license} license as shown in the Description field.
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz
License: Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor} All rights reserved. Use is subject to license terms. Under %{mysql_license} license as shown in the Description field.
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
URL: http://www.mysql.com/
Packager: Sun Microsystems, Inc. Product Engineering Team <build@mysql.com>
Packager: %{mysql_vendor} Product Engineering Team <build@mysql.com>
Vendor: %{mysql_vendor}
Provides: msqlormysql MySQL-server mysql
BuildRequires: ncurses-devel
......@@ -120,9 +147,9 @@ 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
Sun Microsystems, Inc.
%{mysql_vendor}
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc. All rights reserved.
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor} All rights reserved.
Use is subject to license terms.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
......@@ -132,6 +159,10 @@ 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.
##############################################################################
# Sub package definition
##############################################################################
%package server
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
......@@ -144,9 +175,9 @@ 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
Sun Microsystems, Inc.
%{mysql_vendor}
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc. All rights reserved.
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor} All rights reserved.
Use is subject to license terms.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
......@@ -156,12 +187,17 @@ 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.
This package includes the MySQL server binary (incl. InnoDB) as well
as related utilities to run and administrate a MySQL server.
This package includes the MySQL server binary
%if %{INNODB_BUILD}
(configured including InnoDB)
%endif
as well as related utilities to run and administer a MySQL server.
If you want to access and work with the database, you have to install
package "MySQL-client" as well!
# ------------------------------------------------------------------------------
%package client
Summary: MySQL - Client
Group: Applications/Databases
......@@ -173,6 +209,8 @@ This package contains the standard MySQL clients and administration tools.
%{see_base}
# ------------------------------------------------------------------------------
%if %{CLUSTER_BUILD}
%package ndb-storage
Summary: MySQL - ndbcluster storage engine
......@@ -185,6 +223,8 @@ computers that should store ndbcluster table data.
%{see_base}
# ------------------------------------------------------------------------------
%package ndb-management
Summary: MySQL - ndbcluster storage engine management
Group: Applications/Databases
......@@ -196,6 +236,8 @@ one computer in the cluster.
%{see_base}
# ------------------------------------------------------------------------------
%package ndb-tools
Summary: MySQL - ndbcluster storage engine basic tools
Group: Applications/Databases
......@@ -205,6 +247,8 @@ This package contains ndbcluster storage engine basic tools.
%{see_base}
# ------------------------------------------------------------------------------
%package ndb-extra
Summary: MySQL - ndbcluster storage engine extra tools
Group: Applications/Databases
......@@ -216,6 +260,8 @@ They should be used with caution.
%{see_base}
%endif
# ------------------------------------------------------------------------------
%package test
Requires: %{name}-client perl
Summary: MySQL - Test suite
......@@ -229,6 +275,8 @@ This package contains the MySQL regression test suite.
%{see_base}
# ------------------------------------------------------------------------------
%package devel
Summary: MySQL - Development header files and libraries
Group: Applications/Databases
......@@ -241,6 +289,8 @@ necessary to develop MySQL client applications.
%{see_base}
# ------------------------------------------------------------------------------
%package shared
Summary: MySQL - Shared libraries
Group: Applications/Databases
......@@ -249,6 +299,10 @@ Group: Applications/Databases
This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL.
# ------------------------------------------------------------------------------
%if %{EMBEDDED_BUILD}
%package embedded
Requires: %{name}-devel
Summary: MySQL - embedded library
......@@ -268,6 +322,12 @@ client/server version.
%{see_base}
%endif
##############################################################################
#
##############################################################################
%prep
# We unpack the source two times, for 'debug' and 'release' build.
%setup -T -a 0 -c -n mysql-%{mysql_version}
......@@ -275,22 +335,46 @@ mv mysql-%{mysql_version} mysql-debug-%{mysql_version}
%setup -D -T -a 0 -n mysql-%{mysql_version}
mv mysql-%{mysql_version} mysql-release-%{mysql_version}
##############################################################################
# The actual build
##############################################################################
%build
BuildMySQL() {
# Let "MYSQL_BUILD_*FLAGS" take precedence.
CFLAGS=${MYSQL_BUILD_CFLAGS:-$CFLAGS}
CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$CXXFLAGS}
LDFLAGS=${MYSQL_BUILD_LDFLAGS:-$LDFLAGS}
# Fall back on RPM_OPT_FLAGS (part of RPM environment) if no flags are given.
CFLAGS=${CFLAGS:-$RPM_OPT_FLAGS}
CXXFLAGS=${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
# Evaluate current setting of $DEBUG
if [ $DEBUG -gt 0 ] ; then
OPT_COMMENT='--with-comment="%{debug_comment}"'
OPT_DEBUG='--with-debug'
CFLAGS=`echo " $CFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
CXXFLAGS=`echo " $CXXFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
else
OPT_COMMENT='--with-comment="%{ndbug_comment}"'
OPT_DEBUG=''
fi
# The --enable-assembler simply does nothing on systems that does not
# support assembler speedups.
sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
CC=\"${CC:-$MYSQL_BUILD_CC}\" \
CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \
CC=\"${MYSQL_BUILD_CC:-$CC}\" \
CXX=\"${MYSQL_BUILD_CXX:-$CXX}\" \
CFLAGS=\"$CFLAGS\" \
CXXFLAGS=\"$CXXFLAGS\" \
LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \
LDFLAGS=\"$LDFLAGS\" \
./configure \
$* \
--with-mysqld-ldflags='-static' \
--with-client-ldflags='-static' \
--with-zlib-dir=bundled \
--enable-assembler \
--enable-local-infile \
--with-fast-mutexes \
......@@ -305,6 +389,8 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
%endif
%if %{YASSL_BUILD}
--with-ssl \
%else
--without-ssl \
%endif
--exec-prefix=%{_exec_prefix} \
--libexecdir=%{_sbindir} \
......@@ -316,28 +402,44 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
--includedir=%{_includedir} \
--mandir=%{_mandir} \
--enable-thread-safe-client \
$OPT_COMMENT \
$OPT_DEBUG \
--with-readline \
--with-innodb \
%if %{WITH_BUNDLED_ZLIB}
--with-zlib-dir=bundled \
%endif
%if %{CLUSTER_BUILD}
--with-ndbcluster \
--with-plugin-ndbcluster \
%else
--without-plugin-ndbcluster \
%endif
%if %{INNODB_BUILD}
--with-plugin-innobase \
%else
--without-ndbcluster \
--without-plugin-innobase \
%endif
--with-archive-storage-engine \
--with-csv-storage-engine \
--with-blackhole-storage-engine \
--with-federated-storage-engine \
%if %{PARTITION_BUILD}
--with-plugin-partition \
%else
--without-plugin-partition \
%endif
--with-plugin-csv \
--with-plugin-archive \
--with-plugin-blackhole \
--with-plugin-federated \
--without-plugin-daemon_example \
--without-plugin-ftexample \
--with-partition \
--with-big-tables \
%if %{WITH_BUNDLED_ZLIB}
--with-zlib-dir=bundled \
%if %{EMBEDDED_BUILD}
--with-embedded-server \
%else
--without-embedded-server \
%endif
--with-big-tables \
--enable-shared \
"
make
}
# end of function definition "BuildMySQL"
# Use our own copy of glibc
......@@ -366,15 +468,10 @@ export PATH
# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
# including exceptions into the code
if [ -z "$CXX" -a -z "$CC" ]
then
export CC="gcc"
export CXX="gcc"
if [ -z "$CXX" -a -z "$CC" ] ; then
export CC="gcc" CXX="gcc"
fi
# Prepare compiler flags
CFLAGS=${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}
CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
##############################################################################
#
......@@ -384,20 +481,14 @@ CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-except
(
# We are in a subshell, so we can modify variables just for one run.
CFLAGS=`echo " $CFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
CXXFLAGS=`echo " $CXXFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
# Add -g and --with-debug.
DEBUG=1
cd mysql-debug-%{mysql_version} &&
CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \
BuildMySQL "\
--with-debug \
--with-comment=\"MySQL Community Server - Debug (%{mysql_license})\"")
BuildMySQL
)
# We might want to save the config log file
if test -n "$MYSQL_DEBUGCONFLOG_DEST"
......@@ -413,12 +504,12 @@ fi
#
##############################################################################
DEBUG=0
(cd mysql-release-%{mysql_version} &&
CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \
BuildMySQL "\
--with-embedded-server \
--with-comment=\"MySQL Community Server (%{mysql_license})\"")
BuildMySQL
)
# We might want to save the config log file
if test -n "$MYSQL_CONFLOG_DEST"
then
......@@ -429,15 +520,24 @@ fi
##############################################################################
# Include libgcc.a in the devel subpackage (BUG 4921)
if expr "$CC" : ".*gcc.*" > /dev/null ;
# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921)
# Some "icc" calls may have "gcc" in the argument string, so we should first
# check for "icc". (If we don't check, the "--print-libgcc-file" call will fail.)
if expr "$CC" : ".*icc.*" > /dev/null ;
then
%define WITH_LIBGCC 0
elif expr "$CC" : ".*gcc.*" > /dev/null ;
then
libgcc=`$CC $CFLAGS --print-libgcc-file`
if [ -f $libgcc ]
then
%define have_libgcc 1
%define WITH_LIBGCC 1
install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a
else
%define WITH_LIBGCC 0
fi
else
%define WITH_LIBGCC 0
fi
##############################################################################
......@@ -467,13 +567,6 @@ $MBD/libtool --mode=execute install -m 755 \
$RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/mysqld \
$RBR%{_sbindir}/mysqld-debug
%if %{WITH_TCMALLOC}
# Even though this is a shared library, put it under /usr/lib/mysql, so it
# doesn't conflict with possible shared lib by the same name in /usr/lib. See
# `mysql_config --variable=pkglibdir` and mysqld_safe for how this is used.
install -m 644 "%{malloc_lib_source}" "$RBR%{_libdir}/mysql/%{malloc_lib_target}"
%endif
# install saved perror binary with NDB support (BUG#13740)
install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror
......@@ -481,20 +574,33 @@ install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror
install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql
install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
%if %{EMBEDDED_BUILD}
# Install embedded server library in the build root
install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/
%endif
# in RPMs, it is unlikely that anybody should use "sql-bench"
rm -fr $RBR%{_datadir}/sql-bench
# Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this.
ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql
ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql
# Touch the place where the my.cnf config file might be located.
# Just to make sure it's in the file list and marked as a config file.
# Touch the place where the my.cnf config file might be located
# Just to make sure it's in the file list and marked as a config file
touch $RBR%{_sysconfdir}/my.cnf
%if %{WITH_TCMALLOC}
# Even though this is a shared library, put it under /usr/lib/mysql, so it
# doesn't conflict with possible shared lib by the same name in /usr/lib. See
# `mysql_config --variable=pkglibdir` and mysqld_safe for how this is used.
install -m 644 "%{malloc_lib_source}" "$RBR%{_libdir}/mysql/%{malloc_lib_target}"
%endif
##############################################################################
# Post processing actions, i.e. when installed
##############################################################################
%pre server
# Check if we can safely upgrade. An upgrade is only safe if it's from one
# of our RPMs in the same version family.
......@@ -564,58 +670,66 @@ HERE
fi
# Shut down a previously installed server first
if test -x %{_sysconfdir}/init.d/mysql
then
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld a couple of seconds to exit nicely"
sleep 5
elif test -x %{_sysconfdir}/rc.d/init.d/mysql
then
%{_sysconfdir}/rc.d/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld a couple of seconds to exit nicely"
echo "Giving mysqld 5 seconds to exit nicely"
sleep 5
fi
%post server
mysql_datadir=%{mysqldatadir}
# ----------------------------------------------------------------------
# Create data directory if needed
if test ! -d $mysql_datadir; then mkdir -m 755 $mysql_datadir; fi
if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi
if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if [ ! -d $mysql_datadir/mysql ] ; then mkdir $mysql_datadir/mysql; fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
# use insserv for older SuSE Linux versions
if test -x /sbin/insserv
then
if [ -x /sbin/insserv ] ; then
/sbin/insserv %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig
then
elif [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --add mysql
fi
# ----------------------------------------------------------------------
# Create a MySQL user and group. Do not report any problems if it already
# exists.
# ----------------------------------------------------------------------
groupadd -r %{mysqld_group} 2> /dev/null || true
useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# ----------------------------------------------------------------------
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Initiate databases if needed
# ----------------------------------------------------------------------
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
# ----------------------------------------------------------------------
# Upgrade databases if needed would go here - but it cannot be automated yet
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Change permissions again to fix any new files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Fix permissions for the permission database so that only the user
# can read them.
# ----------------------------------------------------------------------
chmod -R og-rw $mysql_datadir/mysql
# Restart in the same way that mysqld will be started normally.
......@@ -639,21 +753,16 @@ if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi
%endif
%preun server
if test $1 = 0
then
if [ $1 = 0 ] ; then
# Stop MySQL before uninstalling it
if test -x %{_sysconfdir}/init.d/mysql
then
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null
# Remove autostart of mysql
# for older SuSE Linux versions
if test -x /sbin/insserv
then
# Remove autostart of MySQL
# For older SuSE Linux versions
if [ -x /sbin/insserv ] ; then
/sbin/insserv -r %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig
then
elif [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --del mysql
fi
fi
......@@ -662,10 +771,16 @@ fi
# We do not remove the mysql user since it may still own a lot of
# database files.
# Clean up the BuildRoot
# ----------------------------------------------------------------------
# Clean up the BuildRoot after build is done
# ----------------------------------------------------------------------
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
##############################################################################
# Files section
##############################################################################
%files server
%defattr(-,root,root,0755)
......@@ -677,17 +792,23 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info*
%if %{INNODB_BUILD}
%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1*
%endif
%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_convert_table_format.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_extensions.1*
%doc %attr(644, root, man) %{_mandir}/man8/mysqld.8*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
#%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqldumpslow.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_secure_installation.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_setpermission.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1*
......@@ -698,10 +819,14 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1*
%doc %attr(644, root, man) %{_mandir}/man1/perror.1*
%doc %attr(644, root, man) %{_mandir}/man1/replace.1*
%doc %attr(644, root, man) %{_mandir}/man1/resolve_stack_dump.1*
%doc %attr(644, root, man) %{_mandir}/man1/resolveip.1*
%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
%if %{INNODB_BUILD}
%attr(755, root, root) %{_bindir}/innochecksum
%endif
%attr(755, root, root) %{_bindir}/my_print_defaults
%attr(755, root, root) %{_bindir}/myisam_ftdump
%attr(755, root, root) %{_bindir}/myisamchk
......@@ -727,6 +852,9 @@ fi
%attr(755, root, root) %{_bindir}/resolve_stack_dump
%attr(755, root, root) %{_bindir}/resolveip
%attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_sbindir}/mysqld-debug
%attr(755, root, root) %{_sbindir}/rcmysql
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_example.so*
%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so*
%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so*
......@@ -735,10 +863,6 @@ fi
%attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target}
%endif
%attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_sbindir}/mysqld-debug
%attr(755, root, root) %{_sbindir}/rcmysql
%attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql
%attr(755, root, root) %{_sysconfdir}/init.d/mysql
......@@ -762,6 +886,7 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/msql2mysql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_find_rows.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_waitpid.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlaccess.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqladmin.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbinlog.1*
......@@ -833,6 +958,7 @@ fi
%files devel
%defattr(-, root, root, 0755)
%doc mysql-release-%{mysql_version}/EXCEPTIONS-CLIENT
%doc %attr(644, root, man) %{_mandir}/man1/comp_err.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1*
%attr(755, root, root) %{_bindir}/mysql_config
%dir %attr(755, root, root) %{_includedir}/mysql
......@@ -841,7 +967,7 @@ fi
%{_datadir}/aclocal/mysql.m4
%{_libdir}/mysql/libdbug.a
%{_libdir}/mysql/libheap.a
%if %{have_libgcc}
%if %{WITH_LIBGCC}
%{_libdir}/mysql/libmygcc.a
%endif
%{_libdir}/mysql/libmyisam.a
......@@ -879,22 +1005,48 @@ fi
%defattr(-, root, root, 0755)
%attr(-, root, root) %{_datadir}/mysql-test
%attr(755, root, root) %{_bindir}/mysql_client_test
%attr(755, root, root) %{_bindir}/mysql_client_test_embedded
%attr(755, root, root) %{_bindir}/mysqltest_embedded
%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test_embedded.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1*
%if %{EMBEDDED_BUILD}
%attr(755, root, root) %{_bindir}/mysql_client_test_embedded
%attr(755, root, root) %{_bindir}/mysqltest_embedded
%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test_embedded.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqltest_embedded.1*
%endif
%if %{EMBEDDED_BUILD}
%files embedded
%defattr(-, root, root, 0755)
%attr(644, root, root) %{_libdir}/mysql/libmysqld.a
%endif
##############################################################################
# The spec file changelog only includes changes made to the spec file
# itself - note that they must be ordered by date (important when
# merging BK trees)
##############################################################################
%changelog
* Fri Feb 12 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Formatting changes:
Have a consistent structure of separator lines and of indentation
(8 leading blanks => tab).
- Introduce the variable "src_dir".
- Give the environment variables "MYSQL_BUILD_CC(CXX)" precedence
over "CC" ("CXX").
- Drop the old "with_static" argument analysis, this is not supported
in 5.1 since ages.
- Introduce variables to control the handlers individually, as well
as other options.
- Use the new "--with-plugin" notation for the table handlers.
- Drop handling "/etc/rc.d/init.d/mysql", the switch to "/etc/init.d/mysql"
was done back in 2002 already.
- Make "--with-zlib-dir=bundled" the default, add an option to disable it.
- Add missing manual pages to the file list.
- Improve the runtime check for "libgcc.a", protect it against being tried
with the Intel compiler "icc".
* Mon Jan 11 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Change RPM file naming:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment