aboutsummaryrefslogtreecommitdiff
path: root/misc/amanda-server/Makefile
blob: 5077edebf7ffe39041a8e086278a796fb01f0da2 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Created by: gpalmer

PORTNAME=	amanda
PORTVERSION=	3.3.9
PORTREVISION=	4
PORTEPOCH=	1
CATEGORIES=	misc
MASTER_SITES=	SF/amanda/amanda%20-%20stable/${PORTVERSION}
PKGNAMESUFFIX?=	-server

MAINTAINER=	fbsd@dylanleigh.net
COMMENT?=	Advanced Maryland Automatic Network Disk Archiver (server)

RUN_DEPENDS=	perl-amanda:misc/amanda-perl-wrapper
BUILD_DEPENDS=	perl-amanda:misc/amanda-perl-wrapper

WRKSRC=		${WRKDIR}/amanda-${PORTVERSION}

GNU_CONFIGURE=	yes
INSTALL_TARGET=	install-strip
USES=		charsetfix cpe gmake gnome libtool perl5 pkgconfig ssl
USE_GNOME=	glib20
USE_LDCONFIG=	yes
CONFIGURE_ARGS=	--libexecdir=${PREFIX}/libexec/amanda \
		--without-amlibexecdir \
		--with-amandahosts --with-fqdn \
		--with-dump-honor-nodump \
		--prefix=${PREFIX} \
		--disable-glibtest \
		--with-user=${USERS} --with-group=${AMANDA_GROUP} \
		--with-bsdtcp-security --with-bsdudp-security \
		--with-ssh-security \
		--disable-installperms --with-security-file=${ETCDIR}/amanda-security.conf
CONFIGURE_ENV=	PERL=${LOCALBASE}/bin/perl-amanda
SUB_FILES=	pkg-message
SUB_LIST=	PORTSDIR=${PORTSDIR}

# Fix build with clang11
CFLAGS+=	-fcommon
MAKE_JOBS_UNSAFE=	yes

OPTIONS_DEFINE=	GNUTAR
OPTIONS_DEFAULT=	GNUTAR
GNUTAR_DESC=	use GNU tar

.if defined(AMANDA_USER)
USERS=		${AMANDA_USER}
.else
USERS?=		amanda
.endif
.if !defined(AMANDA_GROUP)
AMANDA_GROUP=	amanda
.endif
GROUPS?=	operator amanda

AMANDA_GNUTAR_LISTDIR?=	${PREFIX}/var/amanda/gnutar-lists
AMANDA_DATES?=		${PREFIX}/var/amanda/amandates
PLIST_SUB=		SHLIBVER=${PORTVERSION} AMANDA_GROUP=${AMANDA_GROUP}

# amanda-server/amanda-client common part
.if defined (AMANDA_SERVER)
CONFIGURE_ARGS+=	--with-index-server=${AMANDA_SERVER}
CONFIGURE_ARGS+=	--with-tape-server=${AMANDA_SERVER}
.endif

.if !defined(CLIENT_ONLY)
OPTIONS_DEFINE+=	PLOT SAMBA S3
PLOT_DESC=	Enable ploting, requires X11 libraries
SAMBA_DESC=	Enable the use of smbclient
S3_DESC=	Enable Amazon S3 device support
.endif

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MGNUTAR}
CONFIGURE_ARGS+=--with-gnutar-listdir=${AMANDA_GNUTAR_LISTDIR} \
		--with-gnutar=${LOCALBASE}/bin/gtar
BUILD_DEPENDS+=	gtar:archivers/gtar
RUN_DEPENDS+=	gtar:archivers/gtar
.endif

# amanda-server part
.if !defined(CLIENT_ONLY)

PKGINSTALL=	${WRKDIR}/pkg-install
PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
PLIST_SUB+=	CLIENT_ONLY="@comment " SERVER_ONLY=""
SUB_FILES+=	pkg-install pkg-deinstall
SUB_LIST+=	PERL=${PERL} SITE_PERL_REL=${SITE_PERL_REL}

pre-fetch:
	@${ECHO} ""
	@${ECHO} "You may use the following build options:"
	@${ECHO} ""
	@${ECHO} "    AMANDA_SERVER=server to specify a server name"
	@${ECHO} "        The default is `uname -n`"
	@${ECHO} "    AMANDA_USER=user to specify the default user"
	@${ECHO} "        The default is amanda"
	@${ECHO} "    AMANDA_GROUP=group to specify the default group"
	@${ECHO} "        The default is amanda"
	@${ECHO} "    AMANDA_DATES=path to client amandates file"
	@${ECHO} ""

CONFLICTS=	amanda-server-2.* amanda-server-3.2.* amanda2[56]-server

BUILD_DEPENDS+=	${LOCALBASE}/lib/amanda/libamandad-${PORTVERSION}.so:misc/amanda-client
RUN_DEPENDS+=	${LOCALBASE}/lib/amanda/libamandad-${PORTVERSION}.so:misc/amanda-client \
		p5-XML-Simple>=0:textproc/p5-XML-Simple

CONFIGURE_ARGS+=--without-client

.if ${PORT_OPTIONS:MPLOT}
BUILD_DEPENDS+=	gnuplot:math/gnuplot
RUN_DEPENDS+=	gnuplot:math/gnuplot
PLIST_SUB+=	PLOT=''
CONFIGURE_ARGS+=	--with-gnuplot=${LOCALBASE}/bin/gnuplot
.else
PLIST_SUB+=	PLOT='@comment '
CONFIGURE_ARGS+=	--without-gnuplot
.endif

.if ${PORT_OPTIONS:MSAMBA}
USES+=		pkgconfig samba
CONFIGURE_ARGS+=	--with-smbclient=${LOCALBASE}/bin/smbclient
.endif

# If configure founds libcurl, automatically enabled it (with plist change).
.if ${PORT_OPTIONS:MS3}
LIB_DEPENDS+=	libcurl.so:ftp/curl
CONFIGURE_ARGS+=	--enable-s3-device
PLIST_SUB+=	S3DEVICE=''
.else
CONFIGURE_ARGS+=	--disable-s3-device
PLIST_SUB+=	S3DEVICE='@comment '
.endif

# amanda-client part
.else

PKGINSTALL=	${WRKDIR}/pkg-install.client
PKGDEINSTALL=	${PKGINSTALL}
PLIST_SUB+=	CLIENT_ONLY="" SERVER_ONLY="@comment "
SUB_FILES+=	pkg-install.client
SUB_LIST+=	AMANDA_DATES=${AMANDA_DATES} AMANDA_GNUTAR_LISTDIR=${AMANDA_GNUTAR_LISTDIR} \
		USERS=${USERS} AMANDA_GROUP=${AMANDA_GROUP}

pre-fetch:
	@${ECHO} ""
	@${ECHO} "You may use the following build options:"
	@${ECHO} ""
	@${ECHO} "    AMANDA_SERVER=server to specify a server name"
	@${ECHO} "        The default is `uname -n`"
	@${ECHO} "    AMANDA_GNUTAR_LISTDIR=dir to specify the directory that"
	@${ECHO} "        the gnutar index files should live in"
	@${ECHO} "        The default is ${PREFIX}/var/amanda/gnutar-lists"
	@${ECHO} "    AMANDA_USER=user to specify the default user"
	@${ECHO} "        The default is amanda"
	@${ECHO} "    AMANDA_GROUP=group to specify the default group"
	@${ECHO} "        The default is amanda"
	@${ECHO} "    AMANDA_DATES=path to client amandates file"
	@${ECHO} ""

CONFLICTS=	amanda-client-2.* amanda-client-3.2.* amanda2[56]-client-*
CONFIGURE_ARGS+=--without-server --with-amandates=${AMANDA_DATES}
.if defined(AMANDA_NO_SNAPSHOT_DUMP)
CFLAGS=		-DFreeBSD_NO_SNAPSHOT_DUMP=t
.endif

.endif

# See PR 194811.
post-patch:
	${REINPLACE_CMD} -e 's|#undef bool||g' ${WRKSRC}/perl/Amanda/*.c

# MEMO:
#   Prefix @WANT_SERVER_TRUE@ for server only files.
#   Prefix @WANT_CLIENT_TRUE@ for client only files.
#   For debugging: dbprintf(_("getcmd: %s\n"), line);

.include <bsd.port.mk>