# porting percona's xtrabackup (1.6.4 & 1.6.5) - FINISHED - call for testers!



## da1 (Feb 7, 2012)

Hi guys,

The last version of percona's xtrabackup utility in the ports is 1.1. I think this is a bit old. Therefore, I have written an e-mail to the maintainer of the port asking if it would be possible to create a newer version. No answer yet.

Since I'm the curious type of guy, I went ahead and tried it out myself. So far, I have this:


```
PORTNAME=	xtrabackup
PORTVERSION=	1.6.4
CATEGORIES=	databases
MASTER_SITES=	http://www.percona.com/downloads/XtraBackup/XtraBackup-1.6.4/source/

COMMENT=	OpenSource version of InnoDB backup with support of Percona extensions

MAKE_JOBS_SAFE=	yes
USE_GMAKE=	yes

OPTIONS=        innodb51_builtin	"built-in InnoDB in MySQL 5.1"		off \
                innodb51    		"InnoDB plugin in MySQL 5.1"		off \
                innodb55        	"InnoDB in MySQL 5.5"			on \
		xtradb51		"Percona Server with XtraDB 5.1"	off \
                xtradb55        	"Percona Server with XtraDB 5.5"	off

BUILD_DEPENDS=  bash:${PORTSDIR}/shells/bash
                bzr:${PORTSDIR}/devel/bazaar-ng



.include <bsd.port.options.mk>

.if defined(WITH_innodb51_builtin)
.endif

.if defined(WITH_innodb55)
.endif

.if defined(WITH_xtradb51)
.endif

.if defined(WITH_xtradb55)
.endif


.include <bsd.port.mk>
```

Problems so far:
The xtrabackup archive has no configure script. Instead, there is 1 script (build.sh) that takes care of everything (using bash). Installation rolls down to:

```
AUTO_DOWNLOAD="YES" ./utils/build.sh <engine_option>   [B]<<<--- this is where the dialog box should kick in[/B]
```

So:
1) Is there a way to connect this script to the make (I think) command of the ports framework and to the OPTIONS parameter from the port?
[/code]

Problems so far:
The xtrabackup archive has no configure script. Instead, there is 1 script (build.sh) that takes care of everything (using bash). Installation rolls down to:

```
AUTO_DOWNLOAD=
```


----------



## da1 (Feb 9, 2012)

Some progress:


```
PORTNAME=     xtrabackup
PORTVERSION=     1.6.4
CATEGORIES=      databases
MASTER_SITES=    http://www.percona.com/downloads/XtraBackup/XtraBackup-1.6.4/source/

MAINTAINER=      claudiu.vasadi@gmail.com
COMMENT=         OpenSource version of InnoDB backup with support of Percona extensions

MAKE_JOBS_SAFE=  yes

OPTIONS=        INNODB51_BUILTIN    "built-in InnoDB in MySQL 5.1"        off \
                INNODB55            "InnoDB in MySQL 5.5"            off \
                XTRADB51            "Percona Server with XtraDB 5.1"    off \
                XTRADB55            "Percona Server with XtraDB 5.5"    off


BUILD_DEPENDS=  bash:${PORTSDIR}/shells/bash \
                wget:${PORTSDIR}/ftp/wget \
                automake-1.11:${PORTSDIR}/devel/automake


HAS_CONFIGURE=       yes
CONFIGURE_ENV=       AUTO_DOWNLOAD="yes"
CONFIGURE_WRKSRC=    ${WRKSRC}
CONFIGURE_SCRIPT=    utils/build.sh


.include <bsd.port.options.mk>

.if defined(WITH_INNODB51_BUILTIN)
   CONFIGURE_ARGS+=    innodb51_builtin
.endif

.if defined(WITH_INNODB55)
   CONFIGURE_ARGS+=    innodb55
.endif

.if defined(WITH_XTRADB51)
   RUN_DEPENDS+=    bzr:${PORTSDIR}/devel/bazaar-ng
   CONFIGURE_ARGS+=    xtradb51
.endif

.if defined(WITH_XTRADB55)
   RUN_DEPENDS+=        bzr:${PORTSDIR}/devel/bazaar-ng
   CONFIGURE_ARGS+=    xtradb55
.endif


NO_BUILD=          yes
NO_INSTALL=        yes




#
# install process goes here
#

.include <bsd.port.mk>
```

At this point, the port builds correctly according to the ${OPTIONS} selected but am stuck at the installation part now.
The problem is that the build.sh script creates a directory for each option selected and that's where the executable(s) reside. For more info on the directory name for each option, see http://www.percona.com/doc/percona-xtrabackup/installation/compiling_xtrabackup.html (the table at the very bottom).

Basically, I'm left with these points:
# 1) *make install* (copy the correct executables to the proper location and adjust line 87 of "innobackupex" to point to the location of the "xtrabackup" utility) How can I manually copy, according to the OPTION that was selected?
# 2) man pages
# 3) pkg_plist
# 4) make the port safe (if no option is selected (not by default) warn and exit)

Any thoughts?


----------



## da1 (Feb 13, 2012)

Finished. Call for testers!

*Version 1.6.4*


```
# New ports collection makefile for:	xtrabackup
# Date created:				04 Feb 2012
# Whom:					Claudiu Vasadi <claudiu.vasadi@gmail.com>
#
# $FreeBSD$
#

PORTNAME=	xtrabackup
PORTVERSION=	1.6.4
CATEGORIES=	databases
MASTER_SITES=	http://www.percona.com/downloads/XtraBackup/XtraBackup-1.6.4/source/

MAINTAINER=	claudiu.vasadi@gmail.com
COMMENT=	OpenSource version of InnoDB backup with support of Percona extensions

BUILD_DEPENDS=  bash:${PORTSDIR}/shells/bash \
		wget:${PORTSDIR}/ftp/wget \
		automake-1.11:${PORTSDIR}/devel/automake
RUN_DEPENDS=	perl:${PORTSDIR}/lang/perl5.10

OPTIONS=        INNODB51_BUILTIN	"built-in InnoDB in MySQL 5.1"		off \
		INNODB55		"InnoDB in MySQL 5.5"			off \
		XTRADB51		"Percona Server with XtraDB 5.1"	off \
		XTRADB55		"Percona Server with XtraDB 5.5"	off

HAS_CONFIGURE=		yes
CONFIGURE_ENV=		AUTO_DOWNLOAD="yes"
CONFIGURE_WRKSRC=	${WRKSRC}
CONFIGURE_SCRIPT=	utils/build.sh

.include <bsd.port.options.mk>

.if defined(WITH_INNODB51_BUILTIN)
   CONFIGURE_ARGS+=	innodb51_builtin
   PLIST_FILES=	bin/tar4ibd \
		bin/xtrabackup_51 \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/mysql-5.1/storage/innobase/xtrabackup/xtrabackup_51 ${LOCALBASE}/bin
	${SED} -e '87s/autodetect/\/usr\/local\/bin\/xtrabackup_51/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

.if defined(WITH_INNODB55)
   CONFIGURE_ARGS+=	innodb55
   PLIST_FILES= bin/tar4ibd \
		bin/xtrabackup_innodb55 \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/mysql-5.5/storage/innobase/xtrabackup/xtrabackup_innodb55 ${LOCALBASE}/bin
	${SED} -e '87s/autodetect/\/usr\/local\/bin\/xtrabackup_innodb55/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

.if defined(WITH_XTRADB51)
   RUN_DEPENDS+=	bzr:${PORTSDIR}/devel/bazaar-ng
   CONFIGURE_ARGS+=	xtradb51
   PLIST_FILES= bin/tar4ibd \
		bin/xtrabackup \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/percona-server-5.1-xtrabackup/Percona-Server/storage/innodb_plugin/xtrabackup/xtrabackup \
	${LOCALBASE}/bin
	${SED} -e '87s/autodetect/\/usr\/local\/bin\/xtrabackup/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

.if defined(WITH_XTRADB55)
   BUILD_DEPENDS+=	quilt:${PORTSDIR}/devel/quilt \
			bzr:${PORTSDIR}/devel/bazaar-ng \
			bison:${PORTSDIR}/devel/bison
   CONFIGURE_ARGS+=	xtradb55
   PLIST_FILES= bin/tar4ibd \
		bin/xtrabackup_55 \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/percona-server-5.5-xtrabackup/Percona-Server/storage/innobase/xtrabackup/xtrabackup_55 \
	${LOCALBASE}/bin
	${SED} -e '87s/autodetect/\/usr\/local\/bin\/xtrabackup_55/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

NO_BUILD=		yes

.include <bsd.port.mk>
```

distinfo

```
SHA256 (xtrabackup-1.6.4.tar.gz) = 627499844ac4e0c9799b5e5b26bebaaf47b9dec99fd69dfe2597495876ff52da
SIZE (xtrabackup-1.6.4.tar.gz) = 931057
```


If anything should be adjusted, please inform me.


----------



## da1 (Feb 13, 2012)

*Version 1.6.5*

Makefile:

```
# New ports collection makefile for:	xtrabackup
# Date created:				04 Feb 2012
# Whom:					Claudiu Vasadi <claudiu.vasadi@gmail.com>
#
# $FreeBSD$
#

PORTNAME=	xtrabackup
PORTVERSION=	1.6.5
CATEGORIES=	databases
MASTER_SITES=	http://www.percona.com/downloads/XtraBackup/XtraBackup-1.6.5/source/

MAINTAINER=	claudiu.vasadi@gmail.com
COMMENT=	OpenSource version of InnoDB backup with support of Percona extensions

BUILD_DEPENDS=  bash:${PORTSDIR}/shells/bash \
		wget:${PORTSDIR}/ftp/wget \
		automake-1.11:${PORTSDIR}/devel/automake
RUN_DEPENDS=	perl:${PORTSDIR}/lang/perl5.10

OPTIONS=        INNODB51_BUILTIN	"built-in InnoDB in MySQL 5.1"		off \
		INNODB55		"InnoDB in MySQL 5.5"			off \
		XTRADB51		"Percona Server with XtraDB 5.1"	off \
		XTRADB55		"Percona Server with XtraDB 5.5"	off

HAS_CONFIGURE=		yes
CONFIGURE_ENV=		AUTO_DOWNLOAD="yes"
CONFIGURE_WRKSRC=	${WRKSRC}
CONFIGURE_SCRIPT=	utils/build.sh

.include <bsd.port.options.mk>

.if defined(WITH_INNODB51_BUILTIN)
   CONFIGURE_ARGS+=	innodb51_builtin
   PLIST_FILES=	bin/tar4ibd \
		bin/xtrabackup_51 \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/mysql-5.1/storage/innobase/xtrabackup/xtrabackup_51 ${LOCALBASE}/bin
	${SED} -e '89s/autodetect/\/usr\/local\/bin\/xtrabackup_51/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

.if defined(WITH_INNODB55)
   CONFIGURE_ARGS+=	innodb55
   PLIST_FILES= bin/tar4ibd \
		bin/xtrabackup_innodb55 \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/mysql-5.5/storage/innobase/xtrabackup/xtrabackup_innodb55 ${LOCALBASE}/bin
	${SED} -e '89s/autodetect/\/usr\/local\/bin\/xtrabackup_innodb55/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

.if defined(WITH_XTRADB51)
   RUN_DEPENDS+=	bzr:${PORTSDIR}/devel/bazaar-ng
   CONFIGURE_ARGS+=	xtradb51
   PLIST_FILES= bin/tar4ibd \
		bin/xtrabackup \
	bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/percona-server-5.1-xtrabackup/Percona-Server/storage/innodb_plugin/xtrabackup/xtrabackup \
	${LOCALBASE}/bin
	${SED} -e '89s/autodetect/\/usr\/local\/bin\/xtrabackup/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

.if defined(WITH_XTRADB55)
   BUILD_DEPENDS+=	quilt:${PORTSDIR}/devel/quilt \
			bzr:${PORTSDIR}/devel/bazaar-ng \
			bison:${PORTSDIR}/devel/bison
   CONFIGURE_ARGS+=	xtradb55
   PLIST_FILES= bin/tar4ibd \
		bin/xtrabackup_55 \
		bin/innobackupex-1.5.1
do-install:
	${CP} ${WRKSRC}/libtar-1.2.11/libtar/tar4ibd ${LOCALBASE}/bin
	${CP} ${WRKSRC}/percona-server-5.5-xtrabackup/Percona-Server/storage/innobase/xtrabackup/xtrabackup_55 \
	${LOCALBASE}/bin
	${SED} -e '89s/autodetect/\/usr\/local\/bin\/xtrabackup_55/' < \
	${WRKSRC}/innobackupex > ${LOCALBASE}/bin/innobackupex-1.5.1
.endif

NO_BUILD=		yes

.include <bsd.port.mk>
```

distinfo:

```
SHA256 (xtrabackup-1.6.5.tar.gz) = b9c789a6304712483d9e457a6a39f0c16c9bd028aa0124f7689f814833fdf990
SIZE (xtrabackup-1.6.5.tar.gz) = 933213
```


----------

