SHA256
1
0
forked from pool/mariadb
mariadb/mariadb.spec

546 lines
19 KiB
RPMSpec
Raw Normal View History

#
# spec file for package mariadb
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define pretty_name MariaDB
%define libname mysqlclient
%define soname 18
%define preferred 01
%define builtin_plugins partition,csv,heap,aria,pbxt,myisam,myisammrg,xtradb
%define extra_provides mariadb_100
%define srv_vers 5.6.24
# Remove when 13.1 is out of support scope
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
%if 0 > 0
%define with_jemalloc 1
%define with_oqgraph 1
%define with_cassandra 1
%else
%define with_jemalloc 0
%define with_oqgraph 0
%define with_cassandra 0
%endif
Name: mariadb
Version: 10.0.19
Release: 0
Summary: Server part of %{pretty_name}
License: SUSE-GPL-2.0-with-FLOSS-exception
Group: Productivity/Databases/Servers
Url: https://www.mariadb.org
Source: https://downloads.mariadb.org/f/mariadb-%{version}/source/mariadb-%{version}.tar.gz
Source2: baselibs.conf
Source3: README.debug
Source4: suse-test-run
Source5: mysql.SuSEfirewall2
Source7: README.install
Source8: README.SUSE
Source9: mysql-patches.tar.bz2
Source11: install.inc
Source12: series
Source13: configuration-tweaks.tar.bz2
Source14: my.ini
Source15: rc.mysql.sysvinit
Source16: rc.mysql.systemd
Source17: mysql.service
BuildRequires: bison
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libaio-devel
BuildRequires: libbz2-devel
BuildRequires: libedit-devel
BuildRequires: libevent-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: lzo-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pcre-devel
BuildRequires: procps
BuildRequires: pwdutils
BuildRequires: readline-devel
BuildRequires: sqlite
BuildRequires: tcpd-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(systemd)
# required by rcmysql
Requires: %{name}-client
Requires: %{name}-errormessages = %{version}
Requires: perl-base
Requires(pre): pwdutils
Recommends: logrotate
Conflicts: otherproviders(mariadb-server)
Conflicts: otherproviders(mysql)
Conflicts: otherproviders(mysql-debug)
Conflicts: otherproviders(mysql-server)
Provides: mysql-Max = %{srv_vers}
# Compatibility with Fedora/CentOS
Provides: mysql-server = %{srv_vers}
Provides: mariadb-server = %{srv_vers}
# Compatibility with old version
Provides: %{name}-debug-version = %{srv_vers}
Obsoletes: %{name}-debug-version < %{srv_vers}
Provides: %{name}-debug = %{srv_vers}
Obsoletes: %{name}-debug < %{srv_vers}
Provides: mysql = %{srv_vers}
Provides: mysql-debug = %{srv_vers}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%if 0%{with_oqgraph} > 0 || 0%{with_cassandra} > 0
BuildRequires: boost-devel
%endif
%if 0%{with_jemalloc} > 0
BuildRequires: jemalloc-devel
%endif
%if 0%{with_oqgraph} > 0
BuildRequires: judy-devel
%endif
%if 0%{with_cassandra} > 0
BuildRequires: libthrift-devel
%endif
Provides: %{extra_provides} = %{version}
Obsoletes: %{extra_provides} < %{version}
Provides: %{extra_provides}-debug-version = %{version}
Obsoletes: %{extra_provides}-debug-version < %{version}
%if 0%{?preferred} > 0
Obsoletes: mysql-Max < %{srv_vers}
Obsoletes: mysql < %{srv_vers}
Obsoletes: mysql-debug < %{srv_vers}
%endif
%description
MariaDB is a backward compatible, drop-in replacement branch of the MySQL
Database Server. It includes all major open source storage engines, including
the Maria storage engine.
This package only contains the server-side programs.
%if 0%{?preferred} > 0
%package -n libmysqlclient-devel
Summary: %{pretty_name} development header files and libraries
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libmysqlclient_r%{soname} = %{version}
Requires: libmysqlclient%{soname} = %{version}
Requires: openssl-devel
Requires: zlib-devel
%description -n libmysqlclient-devel
This package contains the development header files and libraries
necessary to develop client applications for %{pretty_name}.
%package -n libmysqld%{soname}
Summary: %{pretty_name} embedded server development files
Group: Development/Libraries/C and C++
Requires: %{name}-errormessages = %{version}
%description -n libmysqld%{soname}
This package contains the development header files and libraries
for developing applications that embed the %{pretty_name}.
%package -n libmysqld-devel
Summary: %{pretty_name} embedded server development files
Group: Development/Libraries/C and C++
# the headers files are the shared
Requires: libmysqlclient-devel = %{version}
Requires: libmysqld%{soname} = %{version}
Requires: tcpd-devel
%description -n libmysqld-devel
This package contains the development header files and libraries
for developing applications that embed the %{pretty_name}.
%endif
%package -n lib%{libname}%{soname}
Summary: Shared Libraries for %{pretty_name}
Group: Development/Libraries/Other
%description -n lib%{libname}%{soname}
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use %{pretty_name}.
%package -n lib%{libname}_r%{soname}
Summary: Shared Libraries for %{pretty_name}
Group: Development/Libraries/Other
Requires: lib%{libname}%{soname}
%description -n lib%{libname}_r%{soname}
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use %{pretty_name}.
%package client
Summary: Client for %{pretty_name}
Group: Productivity/Databases/Clients
Requires: %{name}-errormessages = %{version}
# Explicit requires to pull in charsets for errormessages
Requires: lib%{libname}%{soname}
Requires(pre): pwdutils
Conflicts: otherproviders(mysql-client)
Provides: mysql-client = %{srv_vers}
Provides: %{extra_provides}-client = %{version}
Obsoletes: %{extra_provides}-client < %{version}
%if 0%{?preferred} > 0
Obsoletes: mysql-client < %{srv_vers}
%endif
%description client
This package contains the standard clients for %{pretty_name}.
%package errormessages
Summary: MySQL Community Server development header files and libraries
Group: Development/Libraries/C and C++
%description errormessages
This package provides the translated error messages for the standalone
server daemon as well as the embedded server
%package bench
Summary: Benchmarks for %{pretty_name}
Group: Productivity/Databases/Tools
Requires: %{name}-client
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-bench)
Provides: mysql-bench = %{srv_vers}
Provides: %{extra_provides}-bench = %{version}
Obsoletes: %{extra_provides}-bench < %{version}
%if 0%{?preferred} > 0
Obsoletes: mysql-bench < %{srv_vers}
%endif
%description bench
This package contains benchmark scripts and data for %{pretty_name}.
To run these database benchmarks, start the script "run-all-tests" in
the directory %{_datadir}/sql-bench after starting %{pretty_name}.
%package test
Summary: Testsuite for %{pretty_name}
Group: Productivity/Databases/Servers
Requires: %{name} = %{version}
Requires: %{name}-bench = %{version}
Requires: %{name}-client = %{version}
Requires: %{name}-tools = %{version}
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-test)
Provides: mysql-test = %{srv_vers}
Provides: %{extra_provides}-test = %{version}
Obsoletes: %{extra_provides}-test < %{version}
%if 0%{?preferred} > 0
Obsoletes: mysql-test < %{srv_vers}
%endif
%description test
This package contains the test scripts and data for %{pretty_name}.
To run the testsuite, run %{_datadir}/mysql-test/suse-test-run.
%package tools
Summary: %{pretty_name} tools
Group: Productivity/Databases/Servers
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-tools)
# make sure this package is installed when updating from 10.2 and older
Provides: mysql-client:%{_bindir}/perror
Provides: mysql:%{_bindir}/mysqlhotcopy
Provides: mysql-tools = %{srv_vers}
Provides: %{extra_provides}-tools = %{version}
Obsoletes: %{extra_provides}-tools < %{version}
%if 0%{?preferred} > 0
Obsoletes: mysql-tools < %{srv_vers}
%endif
%description tools
A set of scripts for administering a %{pretty_name} or developing
applications with %{pretty_name}.
%prep
%setup -q -n mariadb-%{version} -D -a 9
cp %{_sourcedir}/README.SUSE .
cp %{_sourcedir}/suse-test-run .
# apply patches from series
mysql-patches/tools/quilt-setup.sh "%{SOURCE12}"
mysql-patches/tools/apply-series.sh "%{SOURCE12}"
# remove unneeded manpages ('make install' basically installs everything under
# man/*)
rm -f man/mysqlman.1 # dummy fallback manpage
[ \! -f man/CMakeLists.txt ] || sed -i 's|mysqlman.1||' man/CMakeLists.txt
rm -f man/mysql.server.1 # init script, not installed in our rpm
[ \! -f man/CMakeLists.txt ] || sed -i 's|mysql.server.1||' man/CMakeLists.txt
rm -f man/make_win_*.1 # windows build scripts
rm -f man/comp_err.1 # built-time utility
# 5.1 Carrier Grade Edition only / still under development as of 5.1.22
rm -f man/ndbd_redo_log_reader.1
# breaks VPATH builds when in sourcedir, is generated in the builddirs
rm -f sql/sql_builtin.cc
sed -i 's|@localstatedir@|%{_localstatedir}/log|' support-files/mysql-log-rotate.sh
%if 0%{preferred} < 1
for i in `grep -Rl mysqlclient .`; do
sed -i 's|mysqlclient|%{libname}|g' $i
sed -i 's|-lib%{libname}-symbols.patch|-libmysqlclient-symbols.patch|g' $i
done
%endif
# Broken test that needs sources
rm -f mysql-test/t/file_contents.test mysql-test/r/file_contents.result
# Specify perl path on shebangs
for i in `grep -Rl '^#!@PERL@$' .`; do
sed -i 's|@PERL@|%{_bindir}/perl|' $i
done
%build
EXTRA_FLAGS="-Wno-unused-but-set-variable -fno-strict-aliasing -Wno-unused-parameter"
# Mariadb devs seems to fall in love with -Werror option
EXTRA_FLAGS="${EXTRA_FLAGS} -Wno-error"
export CFLAGS="%{optflags} -DOPENSSL_LOAD_CONF -DPIC -fPIC -DFORCE_INIT_OF_VARS $EXTRA_FLAGS"
export CXXFLAGS="$CFLAGS -felide-constructors"
%cmake -DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBEVENT=system \
-DWITH_JEMALLOC=auto \
-DWITH_READLINE=0 \
-DWITH_LIBEDIT=0 \
-DINSTALL_LAYOUT=RPM \
-DMYSQL_UNIX_ADDR="%{_localstatedir}/run/mysql/mysql.sock" \
-DINSTALL_UNIX_ADDRDIR="%{_localstatedir}/run/mysql/mysql.sock" \
-DINSTALL_MYSQLSHAREDIR=share/%{name} \
-DWITH_COMMENT="openSUSE MySQL rpm" \
-DWITH_EXTRA_CHARSET=all \
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
%if 0%{with_oqgraph} > 0
-DWITH_OQGRAPH_STORAGE_ENGINE=1 \
%endif
%if 0%{with_cassandra} > 0
-DWITH_CASSANDRA_STORAGE_ENGINE=1 \
%endif
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_CSV_STORAGE_ENGINE=1 \
-DWITH_HANDLERSOCKET_STORAGE_ENGINE=1 \
-DWITH_EMBEDDED_SERVER=true \
-DCOMPILATION_COMMENT="openSUSE package" \
-DDENABLE_DOWNLOADS=false \
-DINSTALL_PLUGINDIR_RPM="%{_lib}/mysql/plugin" \
-DINSTALL_LIBDIR_RPM="%{_lib}" \
-DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$CFLAGS" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_SQLBENCHDIR=share \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-Wno-dev "$@" ..
make %{?_smp_mflags}
nm --numeric-sort sql/mysqld > sql/mysqld.sym
%install
%{expand:%(cat %{_sourcedir}/install.inc)}
%pre
%{_sbindir}/groupadd -r mysql >/dev/null 2>/dev/null || :
%{_sbindir}/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql 2> /dev/null || :
%{_sbindir}/usermod -g mysql -s /bin/false mysql 2> /dev/null || :
%service_add_pre mysql.service
%pre client
%{_sbindir}/groupadd -r mysql >/dev/null 2>/dev/null || :
%{_sbindir}/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql 2> /dev/null || :
%{_sbindir}/usermod -g mysql -s /bin/false mysql 2> /dev/null || :
%post
%service_add_post mysql.service
#######################################################################
# preun and posttran takes care of restart #
#######################################################################
%preun
[ $1 = 1 ] || %{_sbindir}/rcmysql stop || true
%posttrans
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}
for in in protected tmp; do
rmdir %{_localstatedir}/lib/mysql/.$i 2>/dev/null || :
done
# During package rename, there might be config file move
if [ -f %{_sysconfdir}/my.cnf.rpmsave ]; then
mv %{_sysconfdir}/my.cnf{,.rpmnew}
mv %{_sysconfdir}/my.cnf{.rpmsave,}
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
WARNING: %{_sysconfdir}/my.cnf.rpmsave file detected!
This probably means that you are upgrading from different variant of MySQL.
Your original configuration file was restored. If it is not a case, you can
find your original %{_sysconfdir}/my.cnf as %{_sysconfdir}/my.cnf.rpmnew
EOF
fi
# warn on first run
if [ -x %{_bindir}/my_print_defaults ]; then
datadir="`%{_bindir}/my_print_defaults mysqld mysql_server | sed -n 's|--datadir=||p'`"
fi
[ -n "$datadir" ] || datadir="%{_localstatedir}/lib/mysql"
if [ -d "$datadir/mysql" ]; then
touch "$datadir/.run-mysql_upgrade"
fi
for in in protected tmp; do
rmdir "$datadir"/.$i 2>/dev/null || :
done
if [ \! -f "$datadir/mysql_upgrade_info" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
%(cat %{_sourcedir}/README.install)
EOF
else
MYSQLVER="`echo %{version} | sed 's|\.[0-9]\+$||'`"
if [ -f "$datadir/mysql_upgrade_info" ] && \
[ -z "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
WARNING: You are upgrading from different stable version of MySQL!
Your database will be migrated automatically during next restart of MySQL.
Before you do that make sure you have up to date backup of your data. It
should be mainly in $datadir directory.
EOF
fi
fi
# start mysql again if it should run - migration from old setup
if [ -d %{_rundir}/mysql/restart ]; then
[ -x %{_sbindir}/rcmysql ] && %{_sbindir}/rcmysql start
# Might not be there, so ignoring errors
rmdir %{_rundir}/mysql/restart 2> /dev/null
fi
#######################################################################
# Various ldconfig post scripts #
#######################################################################
%post -n lib%{libname}%{soname} -p /sbin/ldconfig
%postun -n lib%{libname}%{soname} -p /sbin/ldconfig
%post -n lib%{libname}_r%{soname} -p /sbin/ldconfig
%postun -n lib%{libname}_r%{soname} -p /sbin/ldconfig
%if 0%{preferred} > 0
%post -n libmysqld18 -p /sbin/ldconfig
%postun -n libmysqld18 -p /sbin/ldconfig
%endif
%postun
if [ $1 = 0 ]; then
%insserv_cleanup
rm -f "%{_localstatedir}/lib/systemd/migrated/mysql.service"
if [ -x %{_bindir}/systemctl ]; then
%{_bindir}/systemctl daemon-reload >/dev/null 2>&1 || :
fi
fi
#######################################################################
# Files section #
#######################################################################
%files -f mysql.files
%defattr(-, root, root)
%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/my.cnf
%dir %attr(0750, root, mysql) %{_sysconfdir}/my.cnf.d
%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/my.cnf.d/*
%config %{_sysconfdir}/logrotate.d/mysql
%doc %{_defaultdocdir}/%{name}
%dir %{_libexecdir}/mysql
%{_libexecdir}/mysql/rcmysql
%{_libexecdir}/systemd/system/mysql.service
%{_sbindir}/rcmysql
%dir %{_datadir}/%{name}
%dir %{_datadir}/mysql
%{_datadir}/%{name}/charsets/
%{_datadir}/%{name}/*.sql
%dir %{_libdir}/mysql
%{_libdir}/mysql/mysqld.sym
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/mysql
%dir %{_libdir}/mysql/plugin
%{_libdir}/mysql/plugin/[!d]*.so
%files errormessages -f errormessages.files
%defattr(-, root, root)
%{_datadir}/%{name}/*/errmsg.sys
%files client -f mysql-client.files
%defattr(-, root, root)
%if 0%{preferred} > 0
%files -n libmysqlclient-devel -f libmysqlclient-devel.files
%defattr(-, root, root)
%{_includedir}/mysql
%{_libdir}/libmysqlclient.so
%{_libdir}/libmysqlclient_r.so
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/mysql.m4
%files -n libmysqld-devel
%defattr(-,root,root)
%{_libdir}/libmysqld.a
%{_libdir}/libmysqld.so
%files -n libmysqld18
%defattr(-,root,root)
%{_libdir}/libmysqld.so.*
%endif
%files -n lib%{libname}%{soname}
%defattr(-, root, root)
%{_libdir}/lib%{libname}.so.*
%files -n lib%{libname}_r%{soname}
%defattr(-, root, root)
%{_libdir}/lib%{libname}_r.so.*
%files bench -f mysql-bench.files
%defattr(-, root, root)
%{_datadir}/sql-bench
%files test -f mysql-test.files
%defattr(-, root, root)
%{_bindir}/my_safe_process
%{_mandir}/man1/mysql-test-run.pl.1*
%{_mandir}/man1/mysql-stress-test.pl.1*
%{_datadir}/mysql-test/valgrind.supp
%dir %attr(755, root, root)%{_datadir}/mysql-test
%{_datadir}/mysql-test/[^v]*
%dir %attr(755, mysql, mysql) %{_datadir}/mysql-test/var
%files tools -f mysql-tools.files
%defattr(-, root, root)
%{_bindir}/mysqlrepair
%{_bindir}/mysqlanalyze
%{_bindir}/mysqloptimize
%changelog