Commit 16e60ff5 authored by Joerg Bruehe's avatar Joerg Bruehe

Upmerge changes done to the generic spec file in 5.0 to 5.1,

this includes a major whitespace (formatting) alignment
and sequence changes to better agree with other spec files.

Further changes:
- All features are controlled by "%define" set from call
  options or builtin.
- "bundled zlib" is on by default.
- "with libgcc" is controlled by runtime detection of gcc.
- Handling of "CFLAGS" and "CXXFLAGS" is more concentrated.
- Several missing man pages were added.
parents b9d94d2a c41646d2
...@@ -14,55 +14,44 @@ ...@@ -14,55 +14,44 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA. # MA 02110-1301 USA.
%define mysql_version @VERSION@ ##############################################################################
# Some common macro definitions
##############################################################################
# NOTE: "vendor" is used in upgrade/downgrade check, so you can't # NOTE: "vendor" is used in upgrade/downgrade check, so you can't
# change these, has to be exactly as is. # change these, has to be exactly as is.
%define mysql_old_vendor MySQL AB %define mysql_old_vendor MySQL AB
%define mysql_vendor Sun Microsystems, Inc. %define mysql_vendor Sun Microsystems, Inc.
# use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) %define mysql_version @VERSION@
# 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 --without innodb_plugin" or "rpm --define '_without_innodb_plugin 1'"
# (for RPM 3.x) to not build the innodb plugin (on by default with innodb builds)
# ----------------------------------------------------------------------
%{?_without_innodb_plugin:%define WITHOUT_INNODB_PLUGIN 1}
%{!?_without_innodb_plugin:%define WITHOUT_INNODB_PLUGIN 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}
%if %{STATIC_BUILD}
%define release 1
%else
%define release 1.glibc23
%endif
%define mysql_license GPL
%define mysqld_user mysql %define mysqld_user mysql
%define mysqld_group mysql %define mysqld_group mysql
%define server_suffix -standard
%define mysqldatadir /var/lib/mysql %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 - # We don't package all files installed into the build root by intention -
# See BUG#998 for details. # See BUG#998 for details.
# ------------------------------------------------------------------------------
%define _unpackaged_files_terminate_build 0 %define _unpackaged_files_terminate_build 0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
...@@ -78,34 +67,73 @@ ...@@ -78,34 +67,73 @@
%undefine __perl_provides %undefine __perl_provides
%undefine __perl_requires %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 # use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
# disable the strip of binaries by redefining the RPM macro # to build with yaSSL support (off by default)
# "__os_install_post" leaving out the script calls that normally does # ----------------------------------------------------------------------
# this. We do this in all cases, as on platforms where "debuginfo" is %{?_with_yassl:%define YASSL_BUILD 1}
# created, a script "find-debuginfo.sh" will be called that will do %{!?_with_yassl:%define YASSL_BUILD 0}
# 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 # ----------------------------------------------------------------------
# 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}
# ----------------------------------------------------------------------
# use "rpmbuild --without innodb_plugin" or "rpm --define '_without_innodb_plugin 1'"
# (for RPM 3.x) to not build the innodb plugin (on by default with innodb builds)
# ----------------------------------------------------------------------
%{!?_with_innodb_plugin: %{!?_without_innodb_plugin: %define WITH_INNODB_PLUGIN 1}}
%{?_with_innodb_plugin:%define WITH_INNODB_PLUGIN 1}
%{?_without_innodb_plugin:%define WITH_INNODB_PLUGIN 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 Name: MySQL
Summary: MySQL: a very fast and reliable SQL database server Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases Group: Applications/Databases
Version: @MYSQL_U_SCORE_VERSION@ Version: @MYSQL_U_SCORE_VERSION@
Release: %{release} 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. 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@/mysql-%{mysql_version}.tar.gz Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
URL: http://www.mysql.com/ 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} Vendor: %{mysql_vendor}
Provides: msqlormysql MySQL-server mysql Provides: msqlormysql MySQL-server mysql
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
...@@ -121,9 +149,9 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, ...@@ -121,9 +149,9 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of 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. Use is subject to license terms.
This software comes with ABSOLUTELY NO WARRANTY. This is free software, This software comes with ABSOLUTELY NO WARRANTY. This is free software,
...@@ -133,6 +161,10 @@ The MySQL web site (http://www.mysql.com/) provides the latest ...@@ -133,6 +161,10 @@ The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the news and information about the MySQL software. Also please see the
documentation and the manual for more information. documentation and the manual for more information.
##############################################################################
# Sub package definition
##############################################################################
%package server %package server
Summary: MySQL: a very fast and reliable SQL database server Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases Group: Applications/Databases
...@@ -145,9 +177,9 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, ...@@ -145,9 +177,9 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of 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. Use is subject to license terms.
This software comes with ABSOLUTELY NO WARRANTY. This is free software, This software comes with ABSOLUTELY NO WARRANTY. This is free software,
...@@ -157,12 +189,17 @@ The MySQL web site (http://www.mysql.com/) provides the latest ...@@ -157,12 +189,17 @@ The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the news and information about the MySQL software. Also please see the
documentation and the manual for more information. documentation and the manual for more information.
This package includes the MySQL server binary (incl. InnoDB) as well This package includes the MySQL server binary
as related utilities to run and administrate a MySQL server. %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 If you want to access and work with the database, you have to install
package "MySQL-client" as well! package "MySQL-client" as well!
# ------------------------------------------------------------------------------
%package client %package client
Summary: MySQL - Client Summary: MySQL - Client
Group: Applications/Databases Group: Applications/Databases
...@@ -174,6 +211,8 @@ This package contains the standard MySQL clients and administration tools. ...@@ -174,6 +211,8 @@ This package contains the standard MySQL clients and administration tools.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%if %{CLUSTER_BUILD} %if %{CLUSTER_BUILD}
%package ndb-storage %package ndb-storage
Summary: MySQL - ndbcluster storage engine Summary: MySQL - ndbcluster storage engine
...@@ -186,6 +225,8 @@ computers that should store ndbcluster table data. ...@@ -186,6 +225,8 @@ computers that should store ndbcluster table data.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-management %package ndb-management
Summary: MySQL - ndbcluster storage engine management Summary: MySQL - ndbcluster storage engine management
Group: Applications/Databases Group: Applications/Databases
...@@ -197,6 +238,8 @@ one computer in the cluster. ...@@ -197,6 +238,8 @@ one computer in the cluster.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-tools %package ndb-tools
Summary: MySQL - ndbcluster storage engine basic tools Summary: MySQL - ndbcluster storage engine basic tools
Group: Applications/Databases Group: Applications/Databases
...@@ -206,6 +249,8 @@ This package contains ndbcluster storage engine basic tools. ...@@ -206,6 +249,8 @@ This package contains ndbcluster storage engine basic tools.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-extra %package ndb-extra
Summary: MySQL - ndbcluster storage engine extra tools Summary: MySQL - ndbcluster storage engine extra tools
Group: Applications/Databases Group: Applications/Databases
...@@ -217,6 +262,8 @@ They should be used with caution. ...@@ -217,6 +262,8 @@ They should be used with caution.
%{see_base} %{see_base}
%endif %endif
# ------------------------------------------------------------------------------
%package test %package test
Requires: %{name}-client perl Requires: %{name}-client perl
Summary: MySQL - Test suite Summary: MySQL - Test suite
...@@ -230,6 +277,8 @@ This package contains the MySQL regression test suite. ...@@ -230,6 +277,8 @@ This package contains the MySQL regression test suite.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package devel %package devel
Summary: MySQL - Development header files and libraries Summary: MySQL - Development header files and libraries
Group: Applications/Databases Group: Applications/Databases
...@@ -242,6 +291,8 @@ necessary to develop MySQL client applications. ...@@ -242,6 +291,8 @@ necessary to develop MySQL client applications.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package shared %package shared
Summary: MySQL - Shared libraries Summary: MySQL - Shared libraries
Group: Applications/Databases Group: Applications/Databases
...@@ -250,6 +301,10 @@ Group: Applications/Databases ...@@ -250,6 +301,10 @@ Group: Applications/Databases
This package contains the shared libraries (*.so*) which certain This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL. languages and applications need to dynamically load and use MySQL.
# ------------------------------------------------------------------------------
%if %{EMBEDDED_BUILD}
%package embedded %package embedded
Requires: %{name}-devel Requires: %{name}-devel
Summary: MySQL - embedded library Summary: MySQL - embedded library
...@@ -269,6 +324,12 @@ client/server version. ...@@ -269,6 +324,12 @@ client/server version.
%{see_base} %{see_base}
%endif
##############################################################################
#
##############################################################################
%prep %prep
# We unpack the source two times, for 'debug' and 'release' build. # We unpack the source two times, for 'debug' and 'release' build.
%setup -T -a 0 -c -n mysql-%{mysql_version} %setup -T -a 0 -c -n mysql-%{mysql_version}
...@@ -276,22 +337,46 @@ mv mysql-%{mysql_version} mysql-debug-%{mysql_version} ...@@ -276,22 +337,46 @@ mv mysql-%{mysql_version} mysql-debug-%{mysql_version}
%setup -D -T -a 0 -n mysql-%{mysql_version} %setup -D -T -a 0 -n mysql-%{mysql_version}
mv mysql-%{mysql_version} mysql-release-%{mysql_version} mv mysql-%{mysql_version} mysql-release-%{mysql_version}
##############################################################################
# The actual build
##############################################################################
%build %build
BuildMySQL() { 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 # The --enable-assembler simply does nothing on systems that does not
# support assembler speedups. # support assembler speedups.
sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
CC=\"${CC:-$MYSQL_BUILD_CC}\" \ CC=\"${MYSQL_BUILD_CC:-$CC}\" \
CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \ CXX=\"${MYSQL_BUILD_CXX:-$CXX}\" \
CFLAGS=\"$CFLAGS\" \ CFLAGS=\"$CFLAGS\" \
CXXFLAGS=\"$CXXFLAGS\" \ CXXFLAGS=\"$CXXFLAGS\" \
LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \ LDFLAGS=\"$LDFLAGS\" \
./configure \ ./configure \
$* \ $* \
--with-mysqld-ldflags='-static' \ --with-mysqld-ldflags='-static' \
--with-client-ldflags='-static' \ --with-client-ldflags='-static' \
--with-zlib-dir=bundled \
--enable-assembler \ --enable-assembler \
--enable-local-infile \ --enable-local-infile \
--with-fast-mutexes \ --with-fast-mutexes \
...@@ -306,6 +391,8 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ ...@@ -306,6 +391,8 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
%endif %endif
%if %{YASSL_BUILD} %if %{YASSL_BUILD}
--with-ssl \ --with-ssl \
%else
--without-ssl \
%endif %endif
--exec-prefix=%{_exec_prefix} \ --exec-prefix=%{_exec_prefix} \
--libexecdir=%{_sbindir} \ --libexecdir=%{_sbindir} \
...@@ -317,31 +404,49 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ ...@@ -317,31 +404,49 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
--includedir=%{_includedir} \ --includedir=%{_includedir} \
--mandir=%{_mandir} \ --mandir=%{_mandir} \
--enable-thread-safe-client \ --enable-thread-safe-client \
$OPT_COMMENT \
$OPT_DEBUG \
--with-readline \ --with-readline \
--with-innodb \ %if %{WITH_BUNDLED_ZLIB}
%if %{WITHOUT_INNODB_PLUGIN} --with-zlib-dir=bundled \
--without-plugin-innodb_plugin \
%endif %endif
%if %{CLUSTER_BUILD} %if %{CLUSTER_BUILD}
--with-ndbcluster \ --with-plugin-ndbcluster \
%else
--without-plugin-ndbcluster \
%endif
%if %{INNODB_BUILD}
--with-plugin-innobase \
%if %{WITH_INNODB_PLUGIN}
%else
--without-plugin-innodb_plugin \
%endif
%else
--without-plugin-innobase \
--without-plugin-innodb_plugin \
%endif
%if %{PARTITION_BUILD}
--with-plugin-partition \
%else %else
--without-ndbcluster \ --without-plugin-partition \
%endif %endif
--with-archive-storage-engine \ --with-plugin-csv \
--with-csv-storage-engine \ --with-plugin-archive \
--with-blackhole-storage-engine \ --with-plugin-blackhole \
--with-federated-storage-engine \ --with-plugin-federated \
--without-plugin-daemon_example \ --without-plugin-daemon_example \
--without-plugin-ftexample \ --without-plugin-ftexample \
--with-partition \ %if %{EMBEDDED_BUILD}
--with-big-tables \ --with-embedded-server \
%if %{WITH_BUNDLED_ZLIB} %else
--with-zlib-dir=bundled \ --without-embedded-server \
%endif %endif
--with-big-tables \
--enable-shared \ --enable-shared \
" "
make make
} }
# end of function definition "BuildMySQL"
# Use our own copy of glibc # Use our own copy of glibc
...@@ -370,15 +475,10 @@ export PATH ...@@ -370,15 +475,10 @@ export PATH
# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and # Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
# including exceptions into the code # including exceptions into the code
if [ -z "$CXX" -a -z "$CC" ] if [ -z "$CXX" -a -z "$CC" ] ; then
then export CC="gcc" CXX="gcc"
export CC="gcc"
export CXX="gcc"
fi fi
# Prepare compiler flags
CFLAGS=${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}
CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
############################################################################## ##############################################################################
# #
...@@ -388,20 +488,14 @@ CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-except ...@@ -388,20 +488,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. # 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. # Add -g and --with-debug.
DEBUG=1
cd mysql-debug-%{mysql_version} && cd mysql-debug-%{mysql_version} &&
CFLAGS="$CFLAGS" \ CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \ CXXFLAGS="$CXXFLAGS" \
BuildMySQL "\ BuildMySQL
--with-debug \ )
--with-comment=\"MySQL Community Server - Debug (%{mysql_license})\"")
# We might want to save the config log file # We might want to save the config log file
if test -n "$MYSQL_DEBUGCONFLOG_DEST" if test -n "$MYSQL_DEBUGCONFLOG_DEST"
...@@ -417,12 +511,12 @@ fi ...@@ -417,12 +511,12 @@ fi
# #
############################################################################## ##############################################################################
DEBUG=0
(cd mysql-release-%{mysql_version} && (cd mysql-release-%{mysql_version} &&
CFLAGS="$CFLAGS" \ CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \ CXXFLAGS="$CXXFLAGS" \
BuildMySQL "\ BuildMySQL
--with-embedded-server \ )
--with-comment=\"MySQL Community Server (%{mysql_license})\"")
# We might want to save the config log file # We might want to save the config log file
if test -n "$MYSQL_CONFLOG_DEST" if test -n "$MYSQL_CONFLOG_DEST"
then then
...@@ -433,15 +527,24 @@ fi ...@@ -433,15 +527,24 @@ fi
############################################################################## ##############################################################################
# Include libgcc.a in the devel subpackage (BUG 4921) # For gcc builds, include libgcc.a in the devel subpackage (BUG 4921)
if expr "$CC" : ".*gcc.*" > /dev/null ; # 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 then
libgcc=`$CC $CFLAGS --print-libgcc-file` libgcc=`$CC $CFLAGS --print-libgcc-file`
if [ -f $libgcc ] if [ -f $libgcc ]
then then
%define have_libgcc 1 %define WITH_LIBGCC 1
install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a
else
%define WITH_LIBGCC 0
fi fi
else
%define WITH_LIBGCC 0
fi fi
############################################################################## ##############################################################################
...@@ -478,15 +581,17 @@ install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror ...@@ -478,15 +581,17 @@ 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 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 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 embedded server library in the build root
install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/ install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/
%endif
# in RPMs, it is unlikely that anybody should use "sql-bench" # in RPMs, it is unlikely that anybody should use "sql-bench"
rm -fr $RBR%{_datadir}/sql-bench rm -fr $RBR%{_datadir}/sql-bench
# Create a symlink "rcmysql", pointing to the init.script. SuSE users # Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this. # 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 and mysqlmanager.passwd # Touch the place where the my.cnf config file and mysqlmanager.passwd
# (MySQL Instance Manager password file) might be located # (MySQL Instance Manager password file) might be located
...@@ -494,6 +599,10 @@ ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql ...@@ -494,6 +599,10 @@ ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql
touch $RBR%{_sysconfdir}/my.cnf touch $RBR%{_sysconfdir}/my.cnf
touch $RBR%{_sysconfdir}/mysqlmanager.passwd touch $RBR%{_sysconfdir}/mysqlmanager.passwd
##############################################################################
# Post processing actions, i.e. when installed
##############################################################################
%pre server %pre server
# Check if we can safely upgrade. An upgrade is only safe if it's from one # Check if we can safely upgrade. An upgrade is only safe if it's from one
# of our RPMs in the same version family. # of our RPMs in the same version family.
...@@ -563,58 +672,66 @@ HERE ...@@ -563,58 +672,66 @@ HERE
fi fi
# Shut down a previously installed server first # Shut down a previously installed server first
if test -x %{_sysconfdir}/init.d/mysql if [ -x %{_sysconfdir}/init.d/mysql ] ; then
then
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1 %{_sysconfdir}/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
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"
sleep 5 sleep 5
fi fi
%post server %post server
mysql_datadir=%{mysqldatadir} mysql_datadir=%{mysqldatadir}
# ----------------------------------------------------------------------
# Create data directory if needed # 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 [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; 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. # Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
# use insserv for older SuSE Linux versions # use insserv for older SuSE Linux versions
if test -x /sbin/insserv if [ -x /sbin/insserv ] ; then
then
/sbin/insserv %{_sysconfdir}/init.d/mysql /sbin/insserv %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases # use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig elif [ -x /sbin/chkconfig ] ; then
then
/sbin/chkconfig --add mysql /sbin/chkconfig --add mysql
fi fi
# ----------------------------------------------------------------------
# Create a MySQL user and group. Do not report any problems if it already # Create a MySQL user and group. Do not report any problems if it already
# exists. # exists.
# ----------------------------------------------------------------------
groupadd -r %{mysqld_group} 2> /dev/null || true 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 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) # 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 usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# ----------------------------------------------------------------------
# Change permissions so that the user that will run the MySQL daemon # Change permissions so that the user that will run the MySQL daemon
# owns all database files. # owns all database files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Initiate databases if needed # Initiate databases if needed
# ----------------------------------------------------------------------
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
# ----------------------------------------------------------------------
# Upgrade databases if needed would go here - but it cannot be automated yet # Upgrade databases if needed would go here - but it cannot be automated yet
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Change permissions again to fix any new files. # Change permissions again to fix any new files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Fix permissions for the permission database so that only the user # Fix permissions for the permission database so that only the user
# can read them. # can read them.
# ----------------------------------------------------------------------
chmod -R og-rw $mysql_datadir/mysql chmod -R og-rw $mysql_datadir/mysql
# Restart in the same way that mysqld will be started normally. # Restart in the same way that mysqld will be started normally.
...@@ -638,21 +755,16 @@ if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi ...@@ -638,21 +755,16 @@ if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi
%endif %endif
%preun server %preun server
if test $1 = 0 if [ $1 = 0 ] ; then
then
# Stop MySQL before uninstalling it # Stop MySQL before uninstalling it
if test -x %{_sysconfdir}/init.d/mysql if [ -x %{_sysconfdir}/init.d/mysql ] ; then
then
%{_sysconfdir}/init.d/mysql stop > /dev/null %{_sysconfdir}/init.d/mysql stop > /dev/null
# Remove autostart of MySQL
# Remove autostart of mysql # For older SuSE Linux versions
# for older SuSE Linux versions if [ -x /sbin/insserv ] ; then
if test -x /sbin/insserv
then
/sbin/insserv -r %{_sysconfdir}/init.d/mysql /sbin/insserv -r %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases # use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig elif [ -x /sbin/chkconfig ] ; then
then
/sbin/chkconfig --del mysql /sbin/chkconfig --del mysql
fi fi
fi fi
...@@ -661,10 +773,16 @@ fi ...@@ -661,10 +773,16 @@ fi
# We do not remove the mysql user since it may still own a lot of # We do not remove the mysql user since it may still own a lot of
# database files. # database files.
# Clean up the BuildRoot # ----------------------------------------------------------------------
# Clean up the BuildRoot after build is done
# ----------------------------------------------------------------------
%clean %clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT; [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
##############################################################################
# Files section
##############################################################################
%files server %files server
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
...@@ -676,17 +794,24 @@ fi ...@@ -676,17 +794,24 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info* %doc %attr(644, root, root) %{_infodir}/mysql.info*
%if %{INNODB_BUILD}
%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1* %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/my_print_defaults.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.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/myisamchk.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.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/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}/man8/mysqld.8*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* %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/mysqld_safe.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqldumpslow.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.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/mysql_upgrade.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1*
...@@ -698,11 +823,15 @@ fi ...@@ -698,11 +823,15 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1* %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/perror.1*
%doc %attr(644, root, man) %{_mandir}/man1/replace.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 %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
%ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd %ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd
%if %{INNODB_BUILD}
%attr(755, root, root) %{_bindir}/innochecksum %attr(755, root, root) %{_bindir}/innochecksum
%endif
%attr(755, root, root) %{_bindir}/my_print_defaults %attr(755, root, root) %{_bindir}/my_print_defaults
%attr(755, root, root) %{_bindir}/myisam_ftdump %attr(755, root, root) %{_bindir}/myisam_ftdump
%attr(755, root, root) %{_bindir}/myisamchk %attr(755, root, root) %{_bindir}/myisamchk
...@@ -728,16 +857,16 @@ fi ...@@ -728,16 +857,16 @@ fi
%attr(755, root, root) %{_bindir}/resolve_stack_dump %attr(755, root, root) %{_bindir}/resolve_stack_dump
%attr(755, root, root) %{_bindir}/resolveip %attr(755, root, root) %{_bindir}/resolveip
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_example.so*
%if %{WITHOUT_INNODB_PLUGIN}
%else
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_innodb_plugin.so*
%endif
%attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_sbindir}/mysqld-debug %attr(755, root, root) %{_sbindir}/mysqld-debug
%attr(755, root, root) %{_sbindir}/mysqlmanager %attr(755, root, root) %{_sbindir}/mysqlmanager
%attr(755, root, root) %{_sbindir}/rcmysql %attr(755, root, root) %{_sbindir}/rcmysql
%if %{INNODB_BUILD}
%if %{WITH_INNODB_PLUGIN}
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_innodb_plugin.so*
%endif
%endif
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_example.so*
%attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql %attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql
%attr(755, root, root) %{_sysconfdir}/init.d/mysql %attr(755, root, root) %{_sysconfdir}/init.d/mysql
...@@ -841,7 +970,7 @@ fi ...@@ -841,7 +970,7 @@ fi
%{_datadir}/aclocal/mysql.m4 %{_datadir}/aclocal/mysql.m4
%{_libdir}/mysql/libdbug.a %{_libdir}/mysql/libdbug.a
%{_libdir}/mysql/libheap.a %{_libdir}/mysql/libheap.a
%if %{have_libgcc} %if %{WITH_LIBGCC}
%{_libdir}/mysql/libmygcc.a %{_libdir}/mysql/libmygcc.a
%endif %endif
%{_libdir}/mysql/libmyisam.a %{_libdir}/mysql/libmyisam.a
...@@ -861,11 +990,12 @@ fi ...@@ -861,11 +990,12 @@ fi
%{_libdir}/mysql/libz.la %{_libdir}/mysql/libz.la
%{_libdir}/mysql/plugin/ha_example.a %{_libdir}/mysql/plugin/ha_example.a
%{_libdir}/mysql/plugin/ha_example.la %{_libdir}/mysql/plugin/ha_example.la
%if %{WITHOUT_INNODB_PLUGIN} %if %{INNODB_BUILD}
%else %if %{WITH_INNODB_PLUGIN}
%{_libdir}/mysql/plugin/ha_innodb_plugin.a %{_libdir}/mysql/plugin/ha_innodb_plugin.a
%{_libdir}/mysql/plugin/ha_innodb_plugin.la %{_libdir}/mysql/plugin/ha_innodb_plugin.la
%endif %endif
%endif
%files shared %files shared
%defattr(-, root, root, 0755) %defattr(-, root, root, 0755)
...@@ -879,22 +1009,50 @@ fi ...@@ -879,22 +1009,50 @@ fi
%defattr(-, root, root, 0755) %defattr(-, root, root, 0755)
%attr(-, root, root) %{_datadir}/mysql-test %attr(-, root, root) %{_datadir}/mysql-test
%attr(755, root, root) %{_bindir}/mysql_client_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.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-stress-test.pl.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.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* %doc %attr(644, root, man) %{_mandir}/man1/mysqltest_embedded.1*
%endif
%if %{EMBEDDED_BUILD}
%files embedded %files embedded
%defattr(-, root, root, 0755) %defattr(-, root, root, 0755)
%attr(644, root, root) %{_libdir}/mysql/libmysqld.a %attr(644, root, root) %{_libdir}/mysql/libmysqld.a
%endif
##############################################################################
# The spec file changelog only includes changes made to the spec file # The spec file changelog only includes changes made to the spec file
# itself - note that they must be ordered by date (important when # itself - note that they must be ordered by date (important when
# merging BK trees) # merging BK trees)
##############################################################################
%changelog %changelog
* Fri Feb 05 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.
- Handle the InnoDB plugin using a positive logic: "WITH_INNODB_PLUGIN",
the old negative logic ("WITHOUT_INNODB_PLUGIN") was obfuscating.
- 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> * Mon Jan 11 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Change RPM file naming: - 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