aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/bacula5-server/Makefile
blob: 177dbe8ca7e5c26d2711dd74373e97b60e798a48 (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
181
182
183
184
185
186
187
188
# Created by: Dmitry Sivachenko <demon@FreeBSD.org>
# $FreeBSD$

PORTNAME=   bacula
DISTVERSION=    5.2.12
PORTREVISION?=  1
CATEGORIES?=    sysutils
MASTER_SITES=   SF/bacula/bacula/${PORTVERSION}
PKGNAMEPREFIX?= #
PKGNAMESUFFIX?= 5-server

MAINTAINER= dan@langille.org
COMMENT?=   Network backup solution (server)

USES+=      libtool:keepla

CONFLICTS?= bacula-server-*

LIB_DEPENDS+=   liblzo2.so:${PORTSDIR}/archivers/lzo2

USERS=      bacula
GROUPS=     ${USERS}

PLIST_SUB+= MAJOR=${PORTVERSION:R:R}

GNU_CONFIGURE=  yes
USE_LDCONFIG=   yes

CPPFLAGS+=  -I/usr/include/readline -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib

OPTIONS_DEFINE?=    SQLITE3 MYSQL PGSQL MTX PYTHON NLS OPENSSL
OPTIONS_DEFAULT?=   NLS OPENSSL PGSQL
MTX_DESC=       Install mtx for control of autochanger devices

OPENSSL_USE=    OPENSSL=yes
OPENSSL_CONFIGURE_ON=   --with-openssl=${OPENSSLBASE}
OPENSSL_CONFIGURE_OFF=  --with-openssl="no"

.if ${PKGNAMESUFFIX} == "5-client" || ${PKGNAMESUFFIX} == "5-server"  #Till end of the file

PYTHON_USES=        python
PYTHON_CONFIGURE_ON=    --with-python=yes

.if !defined(WITH_CLIENT_ONLY)
LIB_DEPENDS+=   libbac.so:${PORTSDIR}/sysutils/bacula5-client
USE_RC_SUBR?=   bacula-dir bacula-sd
.endif

.if defined(WITH_CLIENT_ONLY)
SUB_FILES+= pkg-install.client pkg-deinstall.client pkg-message.client
.else
SUB_FILES+= pkg-message.server
.endif

CONFIGURE_ARGS+=--with-tcp-wrappers=/usr/lib \
        --enable-smartalloc \
        --sysconfdir=${ETCDIR} \
        --with-working-dir=${BACULA_DIR} \
        --with-scriptdir=${PREFIX}/share/${PORTNAME} \
        --with-readline=yes \
        --disable-conio \
        --enable-batch-insert \
        --with-plugindir=${PREFIX}/lib \
        --with-dump-email=root@localhost \
        --with-job-email=root@localhost \
        --with-db-name=bacula \
        --with-sbin-perm=755 \
        --with-db-user=bacula \
        --with-baseport=9101

.if defined(WITH_CLIENT_ONLY)
CONFIGURE_ARGS+=--with-fd-user=root \
        --with-fd-group=wheel
.else
CONFIGURE_ARGS+=--with-dir-user=${BACULA_USER} \
        --with-dir-group=${BACULA_GROUP} \
        --with-sd-user=${BACULA_USER} \
        --with-sd-group=operator
.endif

# The user/group IDs below are registered, see
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html#DADS-UID
#
BACULA_USER?=   bacula
BACULA_GROUP?=  ${BACULA_USER}
BACULA_UID?=    910
BACULA_GID?=    ${BACULA_UID}
BACULA_DIR?=    /var/db/bacula

PLIST_SUB+= BACULA_DIR=${BACULA_DIR}

SUB_LIST=   BACULA_USER=${BACULA_USER} \
        BACULA_GROUP=${BACULA_GROUP} \
        BACULA_UID=${BACULA_UID} \
        BACULA_GID=${BACULA_GID} \
        BACULA_DIR=${BACULA_DIR}

NLS_USES=       gettext
NLS_CONFIGURE_ENABLE=   nls

# Client only or full server version
.if defined(WITH_CLIENT_ONLY)
CONFFILES=  fd
CONFIGURE_ARGS+=    --enable-client-only

PKGDEINSTALL=   ${FILESDIR}/pkg-deinstall.client
PKGINSTALL= ${FILESDIR}/pkg-install.client
.else
# Server only Options
CONFFILES=      sd dir
# Server default database

MYSQL_CONFIGURE_ON= --with-mysql=yes
MYSQL_USE=  MYSQL=yes
SQLITE3_CONFIGURE_ON=   --with-sqlite3=yes
SQLITE3_LIB_DEPENDS=    libsqlite3.so:${PORTSDIR}/databases/sqlite3
PGSQL_CONFIGURE_ON= --with-postgresql=yes
PGSQL_USES= pgsql

MTX_RUN_DEPENDS=    ${LOCALBASE}/sbin/mtx:${PORTSDIR}/misc/mtx

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MMYSQL}
DBTYPE=         mysql
SUB_LIST+=      REQ_MYSQL=mysql REQ_PGSQL=""
.elif ${PORT_OPTIONS:MSQLITE3}
DBTYPE=         sqlite3
.else
DBTYPE=         postgresql
SUB_LIST+=      REQ_MYSQL="" REQ_PGSQL=postgresql
.endif
PLIST_SUB+=     DBTYPE=${DBTYPE}

.endif

.if defined(WITH_CLIENT_ONLY)
MP8+=   bacula-fd.8 bconsole.8
.else
MP8+=   bacula.8 bacula-dir.8 bacula-sd.8 bcopy.8 bextract.8 bls.8 bscan.8 \
    btape.8 btraceback.8 dbcheck.8 bwild.8 bregex.8
MP1+=   bsmtp.1 bacula-tray-monitor.1 bacula-bwxconsole.1
.endif

MAKE_ENV+=  MAN8="${MP8}" MAN1="${MP1}"

post-patch:
#   This port does not install docs.  See bacula-docs for that
    ${REINPLACE_CMD} -e '/docdir/d' ${WRKSRC}/Makefile.in
#   Change $(ECHO) to echo in some Makefile.in files
    @${REINPLACE_CMD} -e 's|$$(ECHO)|echo|g' ${WRKSRC}/src/filed/Makefile.in \
        ${WRKSRC}/src/console/Makefile.in
#   Default bconsole.conf is in ${ETCDIR}
    @${REINPLACE_CMD} -e 's|./bconsole.conf|${ETCDIR}/bconsole.conf|g' ${WRKSRC}/src/console/console.c
    @${REINPLACE_CMD} -e 's|^MAN8 =|MAN8 ?=|g' -e 's|^MAN1 =|MAN1 ?=|g' ${WRKSRC}/manpages/Makefile.in
.if defined(WITH_CLIENT_ONLY)
#   In client port only install startup script out of script dir (see below post-install)
#   Dont mkdir ${PREFIX}/share/bacula cause it's empty
    @${REINPLACE_CMD} -e 's|^\(fd_subdirs = .*\)scripts\(.*\)|\1\2|g' ${WRKSRC}/Makefile.in
    ${REINPLACE_CMD} -e 's|\(.*$${MKDIR} $${DESTDIR}$${scriptdir}\)|#\1|g' ${WRKSRC}/Makefile.in
.else
#   In server port don't install filed
    @${REINPLACE_CMD} -e '/^fd_subdirs = /s|src/filed||' -e 's|src/console||' \
        -e 's|src/lib||' -e 's|src/findlib||' -e 's|@FD_PLUGIN_DIR@||' ${WRKSRC}/Makefile.in
    @${REINPLACE_CMD} -e 's|../lib/|$$(LOCALBASE)/lib/|g' -e 's|../findlib/|$$(LOCALBASE)/lib/|g' ${WRKSRC}/src/dird/Makefile.in \
        ${WRKSRC}/src/stored/Makefile.in ${WRKSRC}/src/tools/Makefile.in
    @${REINPLACE_CMD} -e 's|fd_plugins.h|filed/fd_plugins.h|g' -e 's|dir_plugins.h|dird/dir_plugins.h|g' -e 's|stored.h|stored/stored.h|g' \
        ${WRKSRC}/src/tools/bpluginfo.c
.endif

.if !target(post-install)
post-install:
.if defined(WITH_CLIENT_ONLY)
    ${MV} ${STAGEDIR}${ETCDIR}/bconsole.conf ${STAGEDIR}${ETCDIR}/bconsole.conf.sample
.else
    ${INSTALL_SCRIPT} ${FILESDIR}/chio-bacula ${STAGEDIR}${PREFIX}/sbin
    ${INSTALL_DATA} ${FILESDIR}/bacula-barcodes ${STAGEDIR}${ETCDIR}/bacula-barcodes.sample
    ${CHMOD} o+x ${STAGEDIR}${PREFIX}/sbin/bsmtp
.endif
    for na in ${CONFFILES}; do \
        ${MV} ${STAGEDIR}${ETCDIR}/bacula-$$na.conf ${STAGEDIR}${ETCDIR}/bacula-$$na.conf.sample; \
    done
.endif
.else
.include "${MASTERDIR}/Makefile.common"
.endif # -client and -server are defined
.include <bsd.port.mk>