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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
#!/usr/bin/make -f
#export DH_VERBOSE=1
# enable bindnow
# https://wiki.debian.org/HardeningWalkthrough
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Bacula binaries break if linked with symbolic-functions
# https://bugs.bacula.org/view.php?id=2557
# Debian does not (yet) use this, but Ubuntu does. Help them out by
# stripping the flag from LDFLAGS
# https://bugs.launchpad.net/ubuntu/+source/bacula/+bug/1898006
export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions
# Make qtchooser select Qt5
export QT_SELECT=qt5
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
VARIANTS := pgsql mysql sqlite3
VERSION := $(shell sed -n -e 's/^\#define VERSION.*"\(.*\)"$$/\1/p' src/version.h)
######################################################################
DBC := usr/share/dbconfig-common/data/
CONF_ALL = \
--enable-smartalloc \
--with-tcp-wrappers \
--with-openssl \
--with-libiconv-prefix=/usr/include \
--with-readline=/usr/include/readline \
--disable-conio \
--with-libintl-prefix=/usr/include \
--docdir=\$${prefix}/share/doc/bacula-common \
--htmldir=\$${prefix}/share/doc/bacula-common/html \
--libdir=\$${prefix}/lib/bacula \
--enable-batch-insert \
--enable-ipv6 \
--with-dir-password=XXX_DIRPASSWORD_XXX \
--with-fd-password=XXX_FDPASSWORD_XXX \
--with-sd-password=XXX_SDPASSWORD_XXX \
--with-mon-dir-password=XXX_MONDIRPASSWORD_XXX \
--with-mon-fd-password=XXX_MONFDPASSWORD_XXX \
--with-mon-sd-password=XXX_MONSDPASSWORD_XXX \
--with-db-name=XXX_DBNAME_XXX \
--with-db-user=XXX_DBUSER_XXX \
--with-db-password=XXX_DBPASSWORD_XXX \
--with-hostname=localhost \
--config-cache \
--with-archivedir=/nonexistant/path/to/file/archive/dir \
--sysconfdir=/etc/bacula \
--with-scriptdir=/etc/bacula/scripts \
--sharedstatedir=/var/lib/bacula \
--localstatedir=/var/lib/bacula \
--with-logdir=/var/log/bacula \
--with-pid-dir=/run/bacula \
--with-smtp-host=localhost \
--with-working-dir=/var/lib/bacula \
--with-subsys-dir=/run/lock \
--with-dump-email=root \
--with-job-email=root \
--with-mysql --with-postgresql --with-sqlite3 \
--enable-bat --with-x \
--disable-s3
ifeq ($(DEB_HOST_ARCH_OS),linux)
CONF_ALL += --with-systemd=/lib/systemd/system
endif
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
CONF_ALL += --disable-acl --disable-xattr
endif
ifeq ($(DEB_HOST_ARCH_OS),hurd)
CONF_ALL += --disable-acl --disable-xattr
endif
#set to 1 if configured with systemd
HAVE_SYSTEMD = $(findstring 1,$(shell egrep "^\#define HAVE_SYSTEMD" config.log))
LONGNAME_mysql = mysql
LONGNAME_pgsql = postgresql
LONGNAME_sqlite3 = sqlite3
###########################################################################
# Macro for generate file for specified database from specified template
# args: 1 -- template file
# 2 -- db type
define template-subst
sed -e 's/XX_DB_XX/$(2)/' -e 's/XX_DBLONGNAME_XX/$(LONGNAME_$(2))/' -e 's/XX_VERSION_XX/$(VERSION)/' '$(1)' >'$(patsubst %.in,%,$(subst -db.,-$(2).,$(1)))';
endef
# Macro for cleanup file generated for specified database from specified template
# args: 1 -- template file
# 2 -- db type
define template-cleanup
rm -f '$(patsubst %.in,%,$(subst -db.,-$(2).,$(1)))';
endef
# Macro for generate from all templates files for specified database
# args: 1 -- db type
define db-templates-subst
$(foreach template,$(wildcard debian/*-db.*.in),$(call template-subst,$(template),$(1)))
endef
# Macro for cleanup all files generated for specified database from templates
# args: 1 -- db type
define db-templates-cleanup
$(foreach template,$(wildcard debian/*-db.*.in),$(call template-cleanup,$(template),$(1)))
endef
%:
dh $@
# For packages depending on bacula-director-DBTYPE, we handle the
# dependencies on that ourselves, because dpkg-shlibdeps doesn't
# understand the variants
override_dh_shlibdeps:
dh_shlibdeps -pbacula-bscan -pbacula-director -- -xbacula-common-mysql -xbacula-common-pgsql -xbacula-common-sqlite3
dh_shlibdeps -a --remaining-packages
override_dh_auto_build-arch:
dh_auto_build -a
# also build the monitoring plugin from the examples
make -C examples/nagios/check_bacula
override_dh_auto_install-arch:
dh_auto_install -a
override_dh_install-arch:
# sd plugins aren't installed automatically
# make DESTDIR=$(CURDIR)/debian/tmp -C src/stored install-aligned install-cloud
dh_install -a
# create a reference of which database type is installed on the system
# and create a link to the dbconfig information that is dbtype independent
$(foreach db,$(VARIANTS), \
mkdir -p debian/bacula-common-$(db)/usr/share/bacula-common; \
echo $(db) > debian/bacula-common-$(db)/usr/share/bacula-common/dbtype; \
ln -s /etc/dbconfig-common/bacula-director-$(db).conf debian/bacula-common-$(db)/usr/share/bacula-common/dbc_database.conf;)
ifeq ($(HAVE_SYSTEMD),1)
# only install systemd related files if systemd is enabled during build
install -m 644 platforms/systemd/bacula.conf -D debian/bacula-common/usr/lib/tmpfiles.d/bacula.conf
install -m 644 platforms/systemd/bacula-fd.service -D debian/bacula-fd/lib/systemd/system/bacula-fd.service
install -m 644 platforms/systemd/bacula-sd.service -D debian/bacula-sd/lib/systemd/system/bacula-sd.service
install -m 644 platforms/systemd/bacula-dir.service -D debian/bacula-director/lib/systemd/system/bacula-director.service
endif
override_dh_installexamples:
# The monitoring plugin in the examples needs to be cleaned, otherwise
# builds will not be reproducible. But only if the makefile exists,
# which it doesn't if we only build-indep.
@[ -f examples/nagios/check_bacula/Makefile ] && make -C examples/nagios/check_bacula libtool-clean distclean || true
# unfitting permissions reported as https://bugs.bacula.org/view.php?id=2445
chmod 644 examples/autochangers/mtx-changer.Adic-Scalar-100
dh_installexamples
override_dh_installdocs:
cp -a ReleaseNotes NEWS
dh_installdocs -pbacula --link-doc=bacula-server
dh_installdocs -Nbacula-common -Nbacula-client -Nbacula-server -Nbacula-director-mysql -Nbacula-director-sqlite3 -Nbacula-director-pgsql --remaining-packages --link-doc=bacula-common
dh_installdocs --remaining-packages
# We only need the scripts from src/cats for the arch:all packages.
# Compiling and installing is easier than picking out the scripts to
# install manually
override_dh_auto_build-indep:
make DESTDIR=$(CURDIR)/debian/tmp -C src/cats
override_dh_auto_install-indep:
mkdir -p debian/tmp/etc/bacula/scripts
make DESTDIR=$(CURDIR)/debian/tmp -C src/cats install
######### dbconfig-common stuff
# The script install-dbconfig needs to be adapted when upstream changes the database format!
debian/scripts/install-dbconfig # handles install of all upgrade/install scripts to db version 11 and greater
override_dh_missing:
dh_missing --list-missing
override_dh_autoreconf:
dh_autoreconf debian/autogen.sh
override_dh_auto_configure:
$(foreach db,$(VARIANTS),$(call db-templates-subst,$(db)))
# Strange workaround for strange binary path problems in Qt5.9
# https://gitweb.gentoo.org/repo/gentoo.git/tree/app-backup/bacula/bacula-9.0.6-r2.ebuild?id=9b8f311cb9d88f02bebc4bfb51282db4457f87d7#n166
mkdir -p src/qt-console/.libs
touch src/qt-console/.libs/bat
chmod 755 src/qt-console/.libs/bat
#
mkdir -p src/qt-console/tray-monitor/.libs
touch src/qt-console/tray-monitor/.libs/bacula-tray-monitor
chmod 755 src/qt-console/tray-monitor/.libs/bacula-tray-monitor
#
dh_auto_configure -- $(CONF_ALL)
debian/scripts/generate-doc-dir-to-symlink-migration create
debian/scripts/autopostrm create
override_dh_makeshlibs:
dh_makeshlibs -n -Xbpipe-fd.so
# fix shlibs for bacula-common-*
$(foreach db,$(VARIANTS), sed -i 's/libbaccats-[a-z0-9]*/libbaccats/' debian/bacula-common-$(db)/DEBIAN/shlibs;)
override_dh_clean:
$(foreach db,$(VARIANTS),$(call db-templates-cleanup,$(db)))
dh_clean
debian/scripts/generate-doc-dir-to-symlink-migration clean
debian/scripts/autopostrm clean
rm -f NEWS
override_dh_auto_test:
|