-# TODO
-# - system zlib (seems unmodified)
-# - BR deps (for libarchive, mysql builds)
+# NOTES
+# - build instructions: http://www.percona.com/doc/percona-xtrabackup/2.2/installation/compiling_xtrabackup.html
Summary: XtraBackup online backup for MySQL / InnoDB
Name: xtrabackup
-Version: 2.0.3
-Release: 0.1
+Version: 2.4.12
+Release: 1
License: GPL v2
Group: Applications/Databases
+Source0: https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-%{version}/source/tarball/percona-%{name}-%{version}.tar.gz
+# Source0-md5: c086206421a77f7c1ad28771a75cf396
+Source1: http://downloads.sourceforge.net/boost/boost_1_59_0.tar.bz2
+# Source1-md5: 6aa9a5c6a4ca1016edd0ed1178e3cb87
+Patch0: jsmn.patch
URL: http://www.percona.com/doc/percona-xtrabackup/
-Source0: http://www.percona.com/downloads/XtraBackup/XtraBackup-%{version}/source/percona-%{name}-%{version}.tar.gz
-# Source0-md5: f59e7d26b71bd105d11a8d9eb665faad
-Source1: http://s3.amazonaws.com/percona.com/downloads/community/mysql-5.5.17.tar.gz
-# Source1-md5: dcb6a06e68c5e8f30f57b15300730c9c
BuildRequires: bash
BuildRequires: cmake >= 2.6
+BuildRequires: acl-devel
+BuildRequires: curl-devel
+BuildRequires: expat-devel
+BuildRequires: jsmn-devel
+BuildRequires: gnupg
BuildRequires: libaio-devel
-#BuildRequires: libarchive-devel
+BuildRequires: libarchive-devel
+BuildRequires: bison
+BuildRequires: libev-devel
+BuildRequires: libgcrypt-devel
BuildRequires: libstdc++-devel
+BuildRequires: libxml2-devel
+BuildRequires: zlib-devel
BuildRequires: ncurses-devel >= 4.2
-#BuildRequires: zlib-devel
+BuildRequires: python-modules
+BuildRequires: readline-devel
+BuildRequires: xxd
+BuildRequires: sphinx-pdg
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-Percona XtraBackup is OpenSource online (non-blockable) backup
-solution for InnoDB and XtraDB engines.
+Percona XtraBackup is an open-source hot backup utility for
+MySQL-based servers that doesn't lock your database during the backup.
+
+It can back up data from InnoDB, XtraDB, and MyISAM tables on MySQL
+5.1, 5.5 and 5.6 servers, as well as Percona Server with XtraDB.
+
+Percona XtraBackup is a combination of the xtrabackup C program, and
+the innobackupex Perl script. The xtrabackup program copies and
+manipulates InnoDB and XtraDB data files, and the Perl script enables
+enhanced functionality, such as interacting with a running MySQL
+server and backing up MyISAM tables.
%prep
%setup -q -n percona-%{name}-%{version} -a1
+%patch0 -p1
-mv mysql-5.5.* mysql-5.5
-cd mysql-5.5
-%{__patch} -p1 < ../patches/innodb55.patch
+# use system package
+mv storage/innobase/xtrabackup/src/jsmn .
+mv zlib zlib.dist
%build
-# The compiler flags are as per mysql "official" spec ;)
-export CC="%{__cc}"
-export CXX="%{__cxx}"
-export CXXFLAGS="%{rpmcflags} -felide-constructors -fno-rtti -fno-exceptions %{!?debug:-fomit-frame-pointer}"
-export CFLAGS="%{rpmcflags} %{!?debug:-fomit-frame-pointer}"
-
-cd mysql-5.5
-# We need to build with partitioning due to MySQL bug #58632
+install -d build
+cd build
%cmake \
+ -DBUILD_CONFIG=xtrabackup_release \
-DCMAKE_BUILD_TYPE=%{!?debug:RelWithDebInfo}%{?debug:Debug} \
- -DCMAKE_C_FLAGS_RELEASE="%{rpmcflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \
- -DCMAKE_CXX_FLAGS_RELEASE="%{rpmcxxflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \
- -DWITH_ZLIB=bundled \
- %{?with_system_zlib:-DWITH_ZLIB=system} \
- -DENABLED_LOCAL_INFILE=ON \
- -DWITH_INNOBASE_STORAGE_ENGINE=ON \
- -DWITH_PARTITION_STORAGE_ENGINE=ON \
- -DWITH_EXTRA_CHARSETS=all \
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{rpmcflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{rpmcxxflags} -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing" \
-DENABLE_DTRACE=OFF \
- -DWITH_LIBEDIT=OFF \
- -DWITH_READLINE=OFF \
- -DCURSES_INCLUDE_PATH=/usr/include/ncurses \
- .
+ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
+ -DWITH_PIC=ON \
+ -DWITH_READLINE=system \
+ -DWITH_ZLIB=system \
+ -DWITH_SSL=system \
+ -DWITH_BOOST="$(pwd)/$(ls -1d ../boost_*)" \
+ ..
-for dir in include strings mysys dbug extra storage/innobase; do
- %{__make} -C $dir
-done
-
-# build_libarchive()
-cd ../src/libarchive
-%cmake \
- -DENABLE_CPIO=OFF \
- -DENABLE_OPENSSL=OFF \
- -DENABLE_TAR=OFF \
- -DENABLE_TEST=OFF \
- .
%{__make}
-# build_xtrabackup
-cd ../..
-# Read XTRABACKUP_VERSION from the VERSION file
-. ./VERSION
-
-server_dir=$(pwd)/mysql-5.5
-xtrabackup_target=5.5
-cd src
-
-export LIBS="$LIBS -lrt"
-%{__make} MYSQL_ROOT_DIR=$server_dir clean
-%{__make} MYSQL_ROOT_DIR=$server_dir XTRABACKUP_VERSION=$XTRABACKUP_VERSION $xtrabackup_target
-
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
-install -p innobackupex $RPM_BUILD_ROOT%{_bindir}
-install -p src/xbstream $RPM_BUILD_ROOT%{_bindir}
-install -p src/xtrabackup_innodb55 $RPM_BUILD_ROOT%{_bindir}
-cp -p doc/xtrabackup.1 $RPM_BUILD_ROOT%{_mandir}/man1
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+# TODO: find fix in make or cmake rules
+install -d $RPM_BUILD_ROOT%{_mandir}
+b=$(readlink -f %{_builddir})
+mv $RPM_BUILD_ROOT$b/percona-xtrabackup-%{version}/build/man/man1 $RPM_BUILD_ROOT%{_mandir}
+
+%{__rm} -r $RPM_BUILD_ROOT%{_prefix}/xtrabackup-test
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/innobackupex
+%attr(755,root,root) %{_bindir}/xbcloud
+%attr(755,root,root) %{_bindir}/xbcloud_osenv
+%attr(755,root,root) %{_bindir}/xbcrypt
%attr(755,root,root) %{_bindir}/xbstream
-%attr(755,root,root) %{_bindir}/xtrabackup_innodb55
+%attr(755,root,root) %{_bindir}/xtrabackup
+%{_mandir}/man1/innobackupex.1*
+%{_mandir}/man1/xbcrypt.1*
+%{_mandir}/man1/xbstream.1*
%{_mandir}/man1/xtrabackup.1*