%define Werror_cflags %nil %define _disable_ld_no_undefined 1 %define _with_systemd 0 #(ie. use with rpm --rebuild): # # --with debug Compile with debugging code # # enable build with debugging code: will _not_ strip away any debugging code, # will _add_ -g3 to CFLAGS, will _add_ --enable-maintainer-mode to # configure. %define build_debug 0 %define build_test 0 # commandline overrides: # rpm -ba|--rebuild --with 'xxx' %{?_with_debug: %{expand: %%define build_debug 1}} %{?_with_test: %{expand: %%define build_test 1}} %{?_without_test: %global build_test 0} %if %{build_debug} # disable build root strip policy %define __spec_install_post %{_libdir}/rpm/brp-compress || : # This gives extra debuggin and huge binaries %{expand:%%define optflags %{optflags} %([ ! $DEBUG ] && echo '-g3')} %endif %if %{build_debug} %define build_debug 1 %endif %if %{build_test} %define build_test 1 %endif %define _requires_exceptions perl(this) %define major 18 %define libmysqlembedded_major 0 %define libmysqlembedded_minor 0.1 %define libname %mklibname mysql %{major} %define libmysqlservices %mklibname mysqlservices %define libmysqlembedded %mklibname mysqld %{libmysqlembedded_major} %define develname %mklibname -d mysql %define old_staticdevelname %mklibname -d -s mysql %define libmysqlembedded_devel %mklibname -d mysqld %define muser mysql Summary: A very fast and reliable SQL database engine Name: mysql Version: 5.5.23 # (tmb) using subrels to make sure we stay under mga2 mariadb release version %define subrel 2 Release: %mkrel 1 Group: Databases License: GPL URL: http://www.mysql.com/ # The upstream tarball includes non-free documentation that we cannot ship. # To remove the non-free documentation, run this script after downloading # the tarball into the current directory: # ./generate-tarball.sh $VERSION Source0: mysql-%{version}-nodocs.tar.xz Source1: generate-tarball.sh Source2: mysqld.sysconfig Source3: my.cnf Source4: libmysql.version Source10: mysql.tmpfiles.d # fedora patches Patch0: mysql-errno.patch Patch1: mysql-strmov.patch Patch2: mysql-install-test.patch Patch3: mysql-expired-certs.patch Patch4: mysql-stack-guard.patch Patch5: mysql-chain-certs.patch Patch6: mysql-versioning.patch Patch7: mysql-dubious-exports.patch Patch8: mysql-disable-test.patch Patch9: mysql-home.patch # mandriva patches Patch100: mysql-mysqldumpslow_no_basedir.diff Patch101: mysql-logrotate.diff Patch102: mysql-initscript.diff Patch103: mysql_upgrade-exit-status.patch Patch104: mysql-5.1.31-shebang.patch Patch105: mysql-5.5.23-test-variables-big.patch Patch106: mysql-5.1.36-hotcopy.patch Patch107: mysql-install_db-quiet.patch Patch109: mysql_valist_fix.patch # mageia patches # (ahmad) add patch to fix some header files location (hint from Mandriva) Patch110: mysql-5.5.9-fix-headers-location.patch # security fixes Patch120: mysql-5.5.23-CVE-2012-2122.patch Patch121: mariadb-5.5-exact-protocol-checks.patch Requires(post): rpm-helper Requires(preun): rpm-helper Requires(pre): rpm-helper Requires(postun): rpm-helper Requires(post): mysql-common = %{version}-%{release} Requires(preun): mysql-common = %{version}-%{release} Requires(post): mysql-client = %{version}-%{release} Requires(preun): mysql-client = %{version}-%{release} Requires(postun): mysql-common = %{version}-%{release} Requires(postun): mysql-client = %{version}-%{release} Requires: mysql-common = %{version}-%{release} Requires: mysql-core = %{version}-%{release} Requires: mysql-client = %{version}-%{release} %if %_with_systemd # This is for /etc/tmpfiles.d Requires: systemd-units %endif BuildRequires: bison BuildRequires: cmake BuildRequires: dos2unix BuildRequires: doxygen BuildRequires: glibc-devel BuildRequires: libaio-devel BuildRequires: libstdc++-devel BuildRequires: libtermcap-devel BuildRequires: multiarch-utils >= 1.0.3 BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: python BuildRequires: readline-devel BuildRequires: systemtap BuildRequires: tetex BuildRequires: texinfo BuildRequires: xfs-devel BuildRequires: zlib-devel BuildConflicts: edit-devel Provides: msqlormysql mysqlserver Provides: mysql-max = %{version}-%{release} Obsoletes: mysql-max < 5.1.43 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot %description The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of MySQL AB. The mysql server is compiled with the following storage engines: - InnoDB Storage Engine - Archive Storage Engine - CSV Storage Engine - Federated Storage Engine - User Defined Functions (UDFs). - Blackhole Storage Engine - Partition Storage Engine - Perfschema Storage Engine %package core Summary: Server core binary Group: System/Servers Conflicts: mysql < 5.1.39-3 Conflicts: mysql-max < 5.1.43 Requires: mysql-common-core >= %{version}-%{release} %description core Core mysqld server binary. For a full MySQL database server, install package 'mysql'. %package common-core Summary: Common files required by core binary Group: System/Servers Conflicts: mysql-common < 5.1.43-1 %description common-core Common files minimally required by mysqld server binary. %package common Summary: Common files Group: System/Servers Requires(post): rpm-helper Requires(preun): rpm-helper Requires(pre): rpm-helper Requires(postun): rpm-helper Requires(post): mysql-client >= %{version}-%{release} Requires(preun): mysql-client >= %{version}-%{release} Requires: mysql-client >= %{version}-%{release} Requires: mysql-common-core >= %{version}-%{release} %description common Common files for the MySQL(TM) database server. %package client Summary: Client Group: Databases Requires(post): %{libname} >= %{version}-%{release} Requires(preun): %{libname} >= %{version}-%{release} Requires: %{libname} >= %{version}-%{release} %description client This package contains the standard MySQL clients. %package bench Summary: Benchmarks and test system Group: System/Servers Requires(post): mysql-client >= %{version}-%{release} Requires(preun): mysql-client >= %{version}-%{release} Requires: mysql-client >= %{version}-%{release} Requires: perl %description bench This package contains MySQL benchmark scripts and data. %package -n %{libname} Summary: Shared libraries Group: System/Libraries Provides: mysql-shared-libs = %{version}-%{release} Provides: mysql-shared = %{version}-%{release} %description -n %{libname} This package contains the shared libraries (*.so*) which certain languages and applications need to dynamically load and use MySQL. %package -n %{libmysqlservices} Summary: Shared libraries Group: System/Libraries Conflicts: %{mklibname %name 16} < 5.5.10 %description -n %{libmysqlservices} The libmysqlservices library provides access to the available services and dynamic plugins now must be linked against this library (use the -lmysqlservices flag). %package -n %{develname} Summary: Development header files and libraries Group: Development/Other Requires(post): %{libname} >= %{version}-%{release} Requires(preun): %{libname} >= %{version}-%{release} Requires(post): mysql-common >= %{version}-%{release} Requires(preun): mysql-common >= %{version}-%{release} Requires(post): mysql-client >= %{version}-%{release} Requires(preun): mysql-client >= %{version}-%{release} Requires: %{libname} = %{version}-%{release} Requires: %{libmysqlservices} = %{version}-%{release} Requires: mysql-common >= %{version}-%{release} Requires: mysql-client >= %{version}-%{release} Provides: mysql-devel = %{version}-%{release} Provides: %{libname}-devel = %{version}-%{release} Obsoletes: %{libname}-devel Obsoletes: %{old_staticdevelname} < 5.5.10 # Todo: 21/03/2011 (Balcaen John) # We should drop thoses conflict & versionnate libmysqlservices.so & put it # in his own subpackage. Conflicts: %{mklibname mysql 12 -d} Conflicts: %{mklibname mysql 14 -d} Conflicts: %{mklibname mysql 15 -d} Conflicts: %{mklibname mysql 16 -d} %description -n %{develname} This package contains the development header files and libraries necessary to develop MySQL client applications. %package -n %{libmysqlembedded} Summary: MySQL as an embeddable library Group: System/Libraries Provides: %{name}-embedded = %{version}-%{release} Obsoletes: %{name}-embedded < 5.5.10-6 %description -n %{libmysqlembedded} MySQL is a multi-user, multi-threaded SQL database server. This package contains a version of the MySQL server that can be embedded into a client application instead of running as a separate process. The API is identical for the embedded MySQL version and the client/server version. %package -n %{libmysqlembedded_devel} Summary: Development files for MySQL as an embeddable library Group: Development/Other Provides: %{name}-embedded-devel = %{version}-%{release} Obsoletes: %{name}-embedded-devel < 5.5.10-6 Requires: %{libmysqlembedded} = %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} %description -n %{libmysqlembedded_devel} MySQL is a multi-user, multi-threaded SQL database server. This package contains files needed for developing and testing with the embedded version of the MySQL server. The API is identical for the embedded MySQL version and the client/server version. %prep %setup -q -n mysql-%{version} # fedora patches %patch0 -p1 -b .errno %patch1 -p1 -b .strmov %patch2 -p1 -b .install-test %patch3 -p1 -b .expired-certs %patch4 -p1 -b .stack-guard %patch5 -p1 -b .chain-certs %patch6 -p1 -b .versioning %patch7 -p1 -b .dubious-exports %patch8 -p1 -b .disable-test %patch9 -p1 -b .mysql-home # mandriva patches %patch100 -p0 -b .mysqldumpslow_no_basedir %patch101 -p0 -b .logrotate %patch102 -p0 -b .initscript %patch103 -p1 -b .mysql_upgrade-exit-status %patch104 -p1 -b .shebang %patch105 -p1 -b .test-variables-big %patch106 -p0 -b .hotcopy %patch107 -p0 -b .install_db-quiet %patch109 -p1 -b .va_list_arm %patch110 -p1 -b .headers-location # security fixes %patch120 -p1 -b .CVE-2012-2122 %patch121 -p1 -b .CVE-2012-3147-CVE-2012-3158 mkdir -p Mageia cp %{SOURCE2} Mageia/mysqld.sysconfig cp %{SOURCE3} Mageia/my.cnf # lib64 fix perl -pi -e "s|/usr/lib/|%{_libdir}/|g" Mageia/my.cnf # antiborker perl -pi -e "s|\@bindir\@|%{_bindir}|g" support-files/* scripts/* perl -pi -e "s|\@sbindir\@|%{_sbindir}|g" support-files/* scripts/* perl -pi -e "s|\@libexecdir\@|%{_sbindir}|g" support-files/* scripts/* perl -pi -e "s|\@localstatedir\@|/var/lib/mysql|g" support-files/* scripts/* perl -pi -e "s|^basedir=.*|basedir=%{_prefix}|g" support-files/* scripts/mysql_install_db* # this may be part of the problems with mysql-test # http://bugs.mysql.com/bug.php?id=52223 #perl -pi -e "s|basedir/lib\b|basedir/%{_lib}\b|g" mysql-test/mysql-test-run.pl #perl -pi -e "s|basedir/lib/|basedir/%{_lib}/|g" mysql-test/mysql-test-run.pl # workaround for upstream bug #56342 rm -f mysql-test/t/ssl_8k_key-master.opt # upstream has fallen down badly on symbol versioning, do it ourselves cp %{SOURCE4} libmysql/libmysql.version %build %serverbuild export CFLAGS="${CFLAGS:-%{optflags}}" export CXXFLAGS="${CXXFLAGS:-%{optflags}}" export FFLAGS="${FFLAGS:-%{optflags}}" %cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DINSTALL_SBINDIR=sbin \ -DMYSQL_DATADIR=/var/lib/mysql \ -DSYSCONFDIR=%{_sysconfdir} \ -DINSTALL_PLUGINDIR=%{_lib}/mysql/plugin \ -DINSTALL_MANDIR=share/man \ -DINSTALL_SHAREDIR=share/mysql \ -DINSTALL_LIBDIR=%{_lib} \ -DINSTALL_INCLUDEDIR=include/mysql \ -DINSTALL_INFODIR=share/info \ -DINSTALL_MYSQLDATADIR=/var/lib/mysql \ -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \ -DINSTALL_SQLBENCHDIR=share/mysql \ -DINSTALL_SUPPORTFILESDIR=share/mysql \ -DINSTALL_MYSQLSHAREDIR=share/mysql \ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \ -DWITH_READLINE=0 \ -DWITH_LIBEDIT=0 \ -DWITH_LIBWRAP=1 \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ -DWITH_PIC=1 \ -DMYSQL_TCP_PORT=3306 \ -DEXTRA_CHARSETS=all \ -DENABLED_LOCAL_INFILE=1 \ -DENABLE_DTRACE=1 \ -DWITH_EMBEDDED_SERVER=1 \ -DMYSQL_USER=%{muser} \ %if %{build_debug} -DWITH_DEBUG=1 \ %else -DWITH_DEBUG=0 \ %endif -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ -DWITHOUT_NDBCLUSTER_STORAGE_ENGINE=1 \ -DWITHOUT_DAEMON_EXAMPLE=1 \ -DFEATURE_SET="community" \ -DCOMPILATION_COMMENT="Mageia - MySQL Community Edition (GPL)" cp ../libmysql/libmysql.version libmysql/libmysql.version %make # regular build will make libmysqld.a but not libmysqld.so :-( mkdir libmysqld/work cd libmysqld/work ar -x ../libmysqld.a # these result in missing dependencies: (filed upstream as bug 59104) rm -f sql_binlog.cc.o rpl_utility.cc.o gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.%{libmysqlembedded_major} -o libmysqld.so.%{libmysqlembedded_major}.%{libmysqlembedded_minor} \ *.o ../../probes_mysql.o \ -lpthread -laio -lcrypt -lssl -lcrypto -lz -lrt -lstdc++ -ldl -lm -lc %install rm -rf %{buildroot} # don't fiddle with the initscript! export DONT_GPRINTIFY=1 %if %{build_debug} export DONT_STRIP=1 %endif install -d %{buildroot}%{_sysconfdir}/sysconfig install -d %{buildroot}%{_initrddir} install -d %{buildroot}%{_var}/run/mysqld install -d %{buildroot}%{_var}/log/mysqld install -d %{buildroot}/var/lib/mysql/{mysql,test} %makeinstall_std -C build # install init scripts install -m0755 build/support-files/mysql.server %{buildroot}%{_initrddir}/mysqld # install configuration files install -m0644 Mageia/mysqld.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/mysqld install -m0644 Mageia/my.cnf %{buildroot}%{_sysconfdir}/my.cnf %if %_with_systemd mkdir -p $RPM_BUILD_ROOT/etc/tmpfiles.d install -m 0644 %{SOURCE10} $RPM_BUILD_ROOT/etc/tmpfiles.d/mysql.conf %endif # bork mv %{buildroot}%{_bindir}/mysqlaccess.conf %{buildroot}%{_sysconfdir}/ chmod 644 %{buildroot}%{_sysconfdir}/mysqlaccess.conf mv %{buildroot}%{_prefix}/scripts/mysql_install_db %{buildroot}%{_bindir}/ mv %{buildroot}%{_datadir}/mysql/aclocal %{buildroot}%{_datadir}/aclocal pushd %{buildroot}%{_bindir} ln -sf mysqlcheck mysqlrepair ln -sf mysqlcheck mysqlanalyze ln -sf mysqlcheck mysqloptimize popd # nuke -Wl,--as-needed from the mysql_config file perl -pi -e "s|^ldflags=.*|ldflags=\'-rdynamic\'|g" %{buildroot}%{_bindir}/mysql_config # cmake generates some completely wacko references to -lprobes_mysql when # building with dtrace support. Haven't found where to shut that off, # so resort to this blunt instrument. While at it, let's not reference # libmysqlclient_r anymore either. sed -e 's/-lprobes_mysql//' -e 's/-lmysqlclient_r/-lmysqlclient/' \ %{buildroot}%{_bindir}/mysql_config >mysql_config.tmp cp -f mysql_config.tmp %{buildroot}%{_bindir}/mysql_config chmod 755 %{buildroot}%{_bindir}/mysql_config install -m 0755 -d $RPM_BUILD_ROOT/var/lib/mysql # Remove libmysqld.a, install libmysqld.so rm -f ${RPM_BUILD_ROOT}%{_libdir}/libmysqld.a install -m 0755 build/libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/libmysqld.so.0.0.1 ln -s libmysqld.so.%{libmysqlembedded_major}.%{libmysqlembedded_minor} ${RPM_BUILD_ROOT}%{_libdir}/libmysqld.so.%{libmysqlembedded_major} ln -s libmysqld.so.%{libmysqlembedded_major} ${RPM_BUILD_ROOT}%{_libdir}/libmysqld.so # libmysqlclient_r is no more. Upstream tries to replace it with symlinks # but that really doesn't work (wrong soname in particular). We'll keep # just the devel libmysqlclient_r.so link, so that rebuilding without any # source change is enough to get rid of dependency on libmysqlclient_r. rm -f %{buildroot}%{_libdir}/libmysqlclient_r.so* ln -s libmysqlclient.so %{buildroot}%{_libdir}/libmysqlclient_r.so # mysql-test includes one executable that doesn't belong under /usr/share, # so move it and provide a symlink mv %{buildroot}%{_datadir}/mysql/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir} ln -s %{_bindir}/my_safe_process %{buildroot}%{_datadir}/mysql/mysql-test/lib/My/SafeProcess/my_safe_process # house cleaning rm -rf %{buildroot}%{_datadir}/info rm -f %{buildroot}%{_bindir}/client_test rm -f %{buildroot}%{_bindir}/make_win_binary_distribution rm -f %{buildroot}%{_bindir}/make_win_src_distribution rm -f %{buildroot}%{_datadir}/mysql/binary-configure rm -f %{buildroot}%{_datadir}/mysql/config.huge.ini rm -f %{buildroot}%{_datadir}/mysql/config.medium.ini rm -f %{buildroot}%{_datadir}/mysql/config.small.ini rm -f %{buildroot}%{_datadir}/mysql/mysqld_multi.server rm -f %{buildroot}%{_datadir}/mysql/mysql-log-rotate rm -f %{buildroot}%{_datadir}/mysql/mysql.server rm -f %{buildroot}%{_datadir}/mysql/ndb-config-2-node.ini rm -f %{buildroot}%{_datadir}/mysql/binary-configure rm -f %{buildroot}%{_libdir}/mysql/plugin/daemon_example.ini rm -f %{buildroot}%{_mandir}/man1/make_win_bin_dist.1* rm -f %{buildroot}%{_mandir}/man1/make_win_src_distribution.1* rm -f %{buildroot}%{_datadir}/mysql/magic # no idea how to fix this rm -rf %{buildroot}%{_prefix}/data rm -rf %{buildroot}%{_prefix}/docs rm -rf %{buildroot}%{_prefix}/scripts rm -f %{buildroot}%{_prefix}/COPYING rm -f %{buildroot}%{_prefix}/INSTALL-BINARY rm -f %{buildroot}%{_prefix}/README %multiarch_binaries %{buildroot}%{_bindir}/mysql_config %multiarch_includes %{buildroot}%{_includedir}/mysql/my_config.h cat > README.urpmi <