summaryrefslogtreecommitdiff
path: root/sysutils/boxbackup/Makefile
blob: 6d00ff746a4642ec5b26dbfe8599521cef7b869d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# New ports collection makefile for: boxbackup
# Date created:		19 December 2004
# Whom:			James O'Gorman <james@netinertia.co.uk>
#
# $FreeBSD$
#

PORTNAME=	boxbackup
PORTVERSION=	0.10
PORTREVISION=	1
CATEGORIES=	sysutils
MASTER_SITES=	SF
EXTRACT_SUFX=	.tgz

MAINTAINER=	james@netinertia.co.uk
COMMENT=	An open source, completely automatic on-line backup system for UNIX

USE_OPENSSL=	yes
GNU_CONFIGURE=	yes
USE_PERL5=	yes
USE_AUTOTOOLS=	autoconf:262 aclocal:19 autoheader:262
ACLOCAL_ARGS+=	-I ${WRKSRC}/infrastructure/m4

PKGMESSAGE=	${WRKDIR}/pkg-message

OPTIONS=	CLIENT "Install the bbackupd client" On \
		SERVER "Install the bbstored server" On \
		GNUREADLINE "Enable the use of GNU readline" Off \
		TESTS  "Allows use of a 'test' target to run tests" Off

.include <bsd.port.pre.mk>

TARGETOS!=	${ECHO_CMD} `${UNAME} -s``${UNAME} -r | ${SED} -e 's/[-(].*//'` | ${TR} A-Z a-z

.if defined(WITH_GNUREADLINE)
CONFIGURE_ARGS+=--enable-gnu-readline
.endif

.if defined(WITHOUT_CLIENT) && defined(WITHOUT_SERVER)
IGNORE=		requires at least CLIENT or SERVER to be defined.\
		Please 'make config' again
.endif

.if defined(WITHOUT_CLIENT)
PLIST_SUB+=	CLIENT="@comment "
.else
USE_RC_SUBR+=	bbackupd.sh
PLIST_SUB+=	CLIENT=""
ALL_TARGET+=	parcels/${DISTNAME}-backup-client-${TARGETOS}.tgz
INSTALL_TARGET+=install-backup-client
.endif

.if defined(WITHOUT_SERVER)
PLIST_SUB+=	SERVER="@comment "
.else
USE_RC_SUBR+=	bbstored.sh
PLIST_SUB+=	SERVER=""
ALL_TARGET+=	parcels/${DISTNAME}-backup-server-${TARGETOS}.tgz
INSTALL_TARGET+=install-backup-server
.endif

CONFLICTS=	boxbackup-server-[0-9]* boxbackup-client-[0-9]*
.if defined(WITHOUT_CLIENT)
CONFLICTS=	boxbackup-client-[0-9]*
PKGNAMESUFFIX=	-server
.elif defined(WITHOUT_SERVER)
CONFLICTS=	boxbackup-server-[0-9]*
PKGNAMESUFFIX=	-client
.endif

post-patch:
# Replace hard-coded /etc/box with $PREFIX/etc/box
	@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \
		${WRKSRC}/lib/common/BoxPortsAndFiles.h
# Fix path to perl
	@${FIND} ${WRKSRC} -name "*.pl" -exec \
		${REINPLACE_CMD} -e 's,/usr/bin/perl,${PERL},g' {} \;
	@${REINPLACE_CMD} -e 's,/usr/bin/perl,${PERL},g' \
		${WRKSRC}/bin/bbackupd/bbackupd-config \
		${WRKSRC}/bin/bbstored/bbstored-certs \
		${WRKSRC}/bin/bbstored/bbstored-config \
		${WRKSRC}/lib/raidfile/raidfile-config
	@${FIND} ${WRKSRC} -name "Makefile.extra" -exec \
		${REINPLACE_CMD} -e 's,perl,${PERL},g' {} \;
	@${REINPLACE_CMD} -e 's,perl ,${PERL} ,g' \
		${WRKSRC}/test/bbackupd/testfiles/bbackupd.conf \
		${WRKSRC}/infrastructure/makebuildenv.pl
	@${REINPLACE_CMD} -e 's,"perl ,PERL_EXECUTABLE " ,g' \
		${WRKSRC}/test/backupstorefix/testbackupstorefix.cpp
# Fix hard-coded g++
	@${REINPLACE_CMD} -e 's,g++,${CXX},' \
		 ${WRKSRC}/infrastructure/makebuildenv.pl
.if !defined(WITHOUT_CLIENT)
	@${CAT} ${FILESDIR}/pkg-message.client >> ${PKGMESSAGE}
.endif
.if !defined(WITHOUT_SERVER)
	@${CAT} ${FILESDIR}/pkg-message.server >> ${PKGMESSAGE}
.endif

.if !defined(WITHOUT_SERVER)
pre-install:
	@${SETENV} PKG_PREFIX=${PREFIX} \
		${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
.endif

post-install:
.if !defined(WITHOUT_CLIENT)
	@${MKDIR} -m 0700 ${PREFIX}/etc/box/bbackupd
.endif
.if !defined(WITHOUT_SERVER)
	@${MKDIR} -m 0700 ${PREFIX}/etc/box/bbstored
.endif
	@${CAT} ${PKGMESSAGE}

.if defined(WITH_TESTS)
test:
	 @${ECHO_CMD} "===> Running tests"
	 @${MAKE} -C ${WRKSRC} test
.endif

.include <bsd.port.post.mk>