source: trunk/dports/sysutils/bacula/Portfile

Last change on this file was 153706, checked in by g5pw@…, 12 months ago

sysutils/bacula: fix hardcoded prefix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.2 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 153706 2016-10-08 14:34:59Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                bacula
7version             7.0.4
8revision            4
9categories          sysutils
10platforms           darwin
11license             {AGPL-3 OpenSSLException}
12maintainers         nomaintainer
13
14description         network based backup program
15long_description    Bacula is a set of computer programs that permit you to \
16                    manage backup, recovery, and verification of computer data across \
17                    a network of computers of different kinds.
18
19homepage            http://www.bacula.org/
20master_sites        sourceforge
21
22checksums           rmd160  09d033f4ea3431f57d8018647af41c1ae417652d \
23                    sha256  ebf802b843a95f6526e82dd181dff7cd7dc7d1fdc55cec8636e0fe3af69acf7e
24
25depends_build       port:pkgconfig
26depends_lib         port:gawk \
27                    port:gettext \
28                    port:libiconv \
29                    port:ncurses \
30                    path:lib/libssl.dylib:openssl \
31                    port:tcp_wrappers \
32                    port:zlib \
33                    port:lzo2
34
35configure.ccache    no
36configure.args      --mandir=${prefix}/share/man \
37                    --docdir=${prefix}/share/doc/bacula \
38                    --datarootdir=${prefix}/share \
39                    --with-pid-dir=${prefix}/var/run \
40                    --with-subsys-dir=${prefix}/var/run/subsys \
41                    --sysconfdir=${prefix}/etc/${name} \
42                    --with-libintl-prefix=${prefix} \
43                    --with-openssl=${prefix} \
44                    --with-libiconv-prefix=${prefix} \
45                    --with-archivedir=/var/tmp \
46                    --with-working-dir=${prefix}/var/bacula/working \
47                    --with-included-gettext=${prefix} \
48                    --enable-smartalloc \
49                    --enable-largefile \
50                    --enable-conio \
51                    --without-sqlite3 \
52                    --without-postgresql \
53                    --without-mysql \
54                    --with-tcp-wrappers
55
56configure.cppflags-append   -I${prefix}/ncurses
57configure.ldflags           ""
58
59destroot.keepdirs   ${destroot}${prefix}/var/run/subsys \
60                    ${destroot}${prefix}/var/bacula/working
61
62# Don't overwrite preference files
63post-destroot {
64    file rename ${destroot}${prefix}/etc/bacula/bacula-fd.conf ${destroot}${prefix}/etc/bacula/bacula-fd.conf.example
65    file rename ${destroot}${prefix}/etc/bacula/bconsole.conf ${destroot}${prefix}/etc/bacula/bconsole.conf.example
66    file rename ${destroot}${prefix}/etc/bacula/mtx-changer.conf ${destroot}${prefix}/etc/bacula/mtx-changer.conf.example
67}
68
69startupitem.create  yes
70startupitem.init    "BIN=${prefix}/sbin/bacula-fd\nPID=${prefix}/var/run/bacula-fd.*.pid"
71startupitem.start   "\[ -x \${BIN} \] && \${BIN} -c ${prefix}/etc/bacula/bacula-fd.conf"
72startupitem.stop    "\[ -r \${PID} \] && /bin/kill \$(cat \${PID})"
73
74notes "To use the Bacula FD client, you'll need to configure \"${prefix}/etc/bacula/bacula-fd.conf\"."
75notes-append "To use bconsole, you'll need to configure \"${prefix}/etc/bacula/bconsole.conf\"."
76
77variant client_only conflicts mysql51 mysql55 postgresql83 postgresql84 sqlite3 description "Install bacula client (bacula-fd) only" {
78    configure.args-append --enable-client-only
79}
80
81variant console_bat description "Install BAT console GUI application" {
82    depends_build-append  port:tcp_wrappers \
83                          port:makeicns
84    depends_lib-append    port:qt4-mac \
85                          port:qwt52
86    configure.args-append --enable-bat
87
88    patchfiles-append     patch-configure-qt4.diff
89
90    post-patch {
91        system "makeicns -in ${worksrcpath}/src/qt-console/images/bat_icon.png -out ${worksrcpath}/src/qt-console/images/bat_icon.icns"
92    }
93    post-destroot {
94        file rename ${destroot}${prefix}/etc/bacula/bat.conf ${destroot}${prefix}/etc/bacula/bat.conf.example
95        # for now, copy manually until upstream provider fixes bat.app install routines
96        xinstall -m 755 -d ${destroot}${applications_dir}
97        copy ${worksrcpath}/src/qt-console/bat.app ${destroot}${applications_dir}/Bacula-BAT.app
98    }
99    notes-append "To use the Bacula BAT GUI, you'll need to configure \"${prefix}/etc/bacula/bat.conf\"."
100}
101
102variant mysql51 conflicts client_only mysql55 postgresql83 postgresql84 sqlite3 description "Install bacula client and server with mysql 5.1 backend" {
103    depends_lib-append    port:mysql51
104    configure.args-append --with-mysql=${prefix}/include/mysql51/mysql
105    configure.args-delete --without-mysql
106    configure.args-append --enable-batch-insert
107    configure.cppflags-append   -I${prefix}/include/mysql51/mysql
108
109    patchfiles-append     patch-configure-mysql.diff
110    post-patch {
111                     reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure
112    }
113    notes-append "
114       To use the Bacula Director, you'll need to perform the following steps:
115         1. create user \"bacula\" on a mysql database
116         2. execute \"${prefix}/etc/bacula/create_bacula_database -h <mysql_server> -u <db_admin_user> -p\"
117         3. execute \"${prefix}/etc/bacula/make_bacula_tables -h <mysql_server> -u <db_admin_user> -p\"
118         4. execute \"${prefix}/etc/bacula/grant_bacula_privileges -h <mysql_server> -u <db_admin_user> -p\"
119         5. configure \"${prefix}/etc/bacula/bacula-dir.conf\" and set the catalog database settings for the bacula db user.
120    "
121}
122
123variant mysql55 conflicts client_only mysql51 postgresql83 postgresql84 sqlite3 description "Install bacula client and server with mysql 5.5 backend" {
124    depends_lib-append    port:mysql55
125    configure.args-append --with-mysql=${prefix}/include/mysql55/mysql
126    configure.args-delete --without-mysql
127    configure.args-append --enable-batch-insert
128    configure.cppflags-append   -I${prefix}/include/mysql55/mysql
129
130    patchfiles-append     patch-configure-mysql.diff
131    post-patch {
132                     reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure
133    }
134    notes-append "
135       To use the Bacula Director, you'll need to perform the following steps:
136         1. create user \"bacula\" on a mysql database
137         2. execute \"${prefix}/etc/bacula/create_bacula_database -h <mysql_server> -u <db_admin_user> -p\"
138         3. execute \"${prefix}/etc/bacula/make_bacula_tables -h <mysql_server> -u <db_admin_user> -p\"
139         4. execute \"${prefix}/etc/bacula/grant_bacula_privileges -h <mysql_server> -u <db_admin_user> -p\"
140         5. configure \"${prefix}/etc/bacula/bacula-dir.conf\" and set the catalog database settings for the bacula db user.
141    "
142}
143
144variant postgresql83 conflicts mysql51 mysql55 postgresql84 sqlite3 client_only description "Install bacula client and server with postgresql 8.3 backend" {
145    depends_lib-append    port:postgresql83
146    configure.args-append --with-postgresql
147    configure.args-delete --without-postgresql
148    configure.args-append --enable-batch-insert
149    configure.env-append  PATH=${prefix}/lib/postgresql83/bin:$env(PATH)
150
151    patchfiles-append     patch-create_postgresql_database.diff
152
153    notes-append "
154       To use the Bacula Director, you'll need to perform the following steps:
155         1. create user \"bacula\" on a PostgreSQL database
156         2. execute \"${prefix}/etc/bacula/create_bacula_database -h <postgresql-server> -U <db_admin_user>\"
157         3. execute \"${prefix}/etc/bacula/make_bacula_tables -h <postgresql-server> -U <db_admin_user>\"
158         4. execute \"${prefix}/etc/bacula/grant_bacula_privileges -h <postgresql-server> -U <db_admin_user> -p\"
159         5. configure \"${prefix}/etc/bacula/bacula-dir.conf\" and set the catalog database settings for the bacula db user.
160    "
161}
162
163variant postgresql84 conflicts mysql51 mysql55 postgresql83 sqlite3 client_only description "Install bacula client and server with postgresql 8.4 backend" {
164    depends_lib-append    port:postgresql84
165    configure.args-append --with-postgresql
166    configure.args-delete --without-postgresql
167    configure.args-append --enable-batch-insert
168    configure.env-append  PATH=${prefix}/lib/postgresql84/bin:$env(PATH)
169
170    patchfiles-append     patch-create_postgresql_database.diff
171
172    notes-append "
173       To use the Bacula Director, you'll need to perform the following steps:
174         1. create user \"bacula\" on a PostgreSQL database
175         2. execute \"${prefix}/etc/bacula/create_bacula_database -h <postgresql-server> -U <db_admin_user>\"
176         3. execute \"${prefix}/etc/bacula/make_bacula_tables -h <postgresql-server> -U <db_admin_user>\"
177         4. execute \"${prefix}/etc/bacula/grant_bacula_privileges -h <postgresql-server> -U <db_admin_user> -p\"
178         5. configure \"${prefix}/etc/bacula/bacula-dir.conf\" and set the catalog database settings for the bacula db user.
179    "
180}
181
182variant sqlite3 conflicts client_only mysql51 mysql55 postgresql83 postgresql84 description "Install bacula client and server with sqlite 3 backend" {
183    depends_lib-append    port:sqlite3
184    configure.args-append --with-sqlite3=${prefix}
185    configure.args-delete --without-sqlite3
186    configure.args-append --enable-batch-insert
187    notes-append "
188       To use the Bacula Director, you'll need to perform the following steps:
189         1. execute \"${prefix}/etc/bacula/create_bacula_database\"
190         2. execute \"${prefix}/etc/bacula/make_bacula_tables\"
191         3. configure \"${prefix}/etc/bacula/bacula-dir.conf\" and set the catalog database settings for the bacula db user.
192    "
193}
194
195default_variants +console_bat
196
197if {![variant_isset mysql51] && ![variant_isset mysql55] && ![variant_isset postgresql83] && ![variant_isset postgresql84] && ![variant_isset sqlite3]} {
198    default_variants-append +client_only
199} else {
200    # is a server installation
201
202    # Add the server daemons to the startupitem wrapper
203    startupitem.init-append    "BIN_DIR=${prefix}/sbin/bacula-dir\nPID_DIR=${prefix}/var/run/bacula-dir.*.pid\n"
204    startupitem.init-append    "BIN_SD=${prefix}/sbin/bacula-sd\nPID_SD=${prefix}/var/run/bacula-sd.*.pid\n"
205    startupitem.start-append   "\[ -x \${BIN_DIR} -a -f ${prefix}/etc/bacula/bacula-dir.conf \] && \${BIN_DIR} -c ${prefix}/etc/bacula/bacula-dir.conf"
206    startupitem.start-append   "\[ -x \${BIN_SD} -a -f ${prefix}/etc/bacula/bacula-sd.conf \] && \${BIN_SD} -c ${prefix}/etc/bacula/bacula-sd.conf"
207    startupitem.stop-append    "\[ -r \${PID_DIR} \] && /bin/kill \$(cat \${PID_DIR})"
208    startupitem.stop-append    "\[ -r \${PID_SD} \] && /bin/kill \$(cat \${PID_SD})"
209
210    # Don't overwrite existing preference files
211    post-destroot {
212        file rename ${destroot}${prefix}/etc/bacula/bacula-dir.conf ${destroot}${prefix}/etc/bacula/bacula-dir.conf.example
213        file rename ${destroot}${prefix}/etc/bacula/bacula-sd.conf ${destroot}${prefix}/etc/bacula/bacula-sd.conf.example
214    }
215    notes-append "To use the Bacula Storage Daemon, you'll need to configure \"${prefix}/etc/bacula/bacula-sd.conf\"."
216}
217
218pre-deactivate {
219    if {[file exists /Library/LaunchDaemons/org.macports.bacula.plist]} {
220         system "launchctl unload /Library/LaunchDaemons/org.macports.bacula.plist"
221    }
222}
223
224livecheck.type           regex
225livecheck.url            ${homepage}
226livecheck.regex          {Bacula ([0-9\.]+)}
Note: See TracBrowser for help on using the repository browser.