2010-02-24 23:58:53 +02:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
2018-02-20 12:36:25 +02:00
|
|
|
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
|
2010-02-24 23:58:53 +02:00
|
|
|
|
2016-07-18 11:22:54 +03:00
|
|
|
DEB_BUILD_MAINT_OPTIONS=hardening=+all
|
2013-11-24 19:20:21 +02:00
|
|
|
DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed
|
|
|
|
include /usr/share/dpkg/buildflags.mk
|
|
|
|
|
2019-07-27 16:16:56 +03:00
|
|
|
DEB_CONFIGURE_EXTRA_FLAGS := --prefix= \
|
|
|
|
--sysconfdir=/etc/nut \
|
|
|
|
--includedir=/usr/include \
|
|
|
|
--mandir=/usr/share/man \
|
|
|
|
--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
|
2013-11-24 17:15:25 +02:00
|
|
|
--with-ssl --with-nss \
|
2011-04-25 00:37:41 +03:00
|
|
|
--with-cgi \
|
|
|
|
--with-dev \
|
|
|
|
--enable-static \
|
2019-07-27 14:25:06 +03:00
|
|
|
--with-statepath=/run/nut \
|
|
|
|
--with-altpidpath=/run/nut \
|
2011-04-25 00:37:41 +03:00
|
|
|
--with-drvpath=/lib/nut \
|
|
|
|
--with-cgipath=/usr/lib/cgi-bin/nut \
|
|
|
|
--with-htmlpath=/usr/share/nut/www \
|
2019-07-27 14:25:06 +03:00
|
|
|
--with-pidpath=/run/nut \
|
2011-04-25 00:37:41 +03:00
|
|
|
--datadir=/usr/share/nut \
|
2012-08-12 23:18:54 +03:00
|
|
|
--with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
|
2019-07-27 19:50:43 +03:00
|
|
|
--with-user=nut --with-group=nut \
|
2019-08-01 15:59:43 +03:00
|
|
|
--with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system \
|
|
|
|
--with-systemdshutdowndir=/lib/systemd/system-shutdown
|
2010-02-24 23:58:53 +02:00
|
|
|
|
2011-06-03 12:54:24 +03:00
|
|
|
# only build documentation if asciidoc is installed
|
|
|
|
ifneq ($(shell which asciidoc),)
|
|
|
|
DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf
|
|
|
|
endif
|
|
|
|
|
2019-07-27 16:16:56 +03:00
|
|
|
%:
|
2019-07-27 18:36:41 +03:00
|
|
|
dh $@ --no-parallel --with python2 --with python3
|
2019-07-27 16:16:56 +03:00
|
|
|
|
|
|
|
override_dh_auto_configure:
|
|
|
|
dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS)
|
|
|
|
|
|
|
|
override_dh_autoreconf:
|
|
|
|
dh_autoreconf --as-needed
|
|
|
|
|
|
|
|
override_dh_auto_install-arch:
|
2019-08-01 20:06:41 +03:00
|
|
|
dh_auto_install
|
2019-07-27 16:16:56 +03:00
|
|
|
|
2010-02-24 23:58:53 +02:00
|
|
|
# install the bash completion script
|
2013-11-24 18:54:31 +02:00
|
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/
|
2010-02-24 23:58:53 +02:00
|
|
|
cp $(CURDIR)/scripts/misc/nut.bash_completion \
|
2013-11-24 18:54:31 +02:00
|
|
|
$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/nut
|
2010-02-24 23:58:53 +02:00
|
|
|
|
2011-12-02 21:40:30 +02:00
|
|
|
# install the avahi service file
|
|
|
|
mkdir -p $(CURDIR)/debian/tmp/etc/avahi/services
|
|
|
|
cp $(CURDIR)/scripts/avahi/nut.service \
|
|
|
|
$(CURDIR)/debian/tmp/etc/avahi/services
|
|
|
|
|
2011-12-02 22:02:54 +02:00
|
|
|
# install Augeas lenses
|
2019-08-02 09:41:28 +03:00
|
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/augeas/lenses/tests
|
2011-12-02 22:02:54 +02:00
|
|
|
cp $(CURDIR)/scripts/augeas/*.aug \
|
2019-08-02 09:41:28 +03:00
|
|
|
$(CURDIR)/debian/tmp/usr/share/augeas/lenses/
|
2011-12-02 22:02:54 +02:00
|
|
|
cp $(CURDIR)/scripts/augeas/tests/test_nut.aug \
|
2019-08-02 09:41:28 +03:00
|
|
|
$(CURDIR)/debian/tmp/usr/share/augeas/lenses/tests/
|
2011-12-02 22:02:54 +02:00
|
|
|
|
2010-02-24 23:58:53 +02:00
|
|
|
# install the default configuration
|
|
|
|
for f in $(CURDIR)/debian/tmp/etc/nut/*; do \
|
|
|
|
nf=`basename $${f} | sed 's/\(.*\).sample/\1/'`; \
|
|
|
|
mv $${f} $(CURDIR)/debian/tmp/etc/nut/$${nf}; \
|
|
|
|
done
|
|
|
|
|
2012-08-13 02:11:45 +03:00
|
|
|
# Move -dev file to /usr
|
|
|
|
mv $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.a \
|
|
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.a
|
|
|
|
rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so
|
2014-04-22 22:25:56 +03:00
|
|
|
ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.4 \
|
2012-08-12 23:18:54 +03:00
|
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so
|
2014-10-20 21:06:06 +03:00
|
|
|
mv $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.a \
|
|
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.a
|
|
|
|
rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so
|
|
|
|
ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.0 \
|
|
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so
|
2012-08-12 23:18:54 +03:00
|
|
|
|
2019-02-26 14:43:33 +02:00
|
|
|
rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so
|
|
|
|
ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.1 \
|
|
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so
|
|
|
|
|
2015-01-25 13:54:03 +02:00
|
|
|
# Move daemons and install wrappers
|
|
|
|
mv $(CURDIR)/debian/tmp/sbin/upsmon $(CURDIR)/debian/tmp/lib/nut/upsmon
|
|
|
|
mv $(CURDIR)/debian/tmp/sbin/upsd $(CURDIR)/debian/tmp/lib/nut/upsd
|
|
|
|
install -m 0755 debian/local/upsmon $(CURDIR)/debian/tmp/sbin/upsmon
|
|
|
|
install -m 0755 debian/local/upsd $(CURDIR)/debian/tmp/sbin/upsd
|
|
|
|
|
2019-08-01 18:05:54 +03:00
|
|
|
# Add a symlink to mask the LSB initscript
|
|
|
|
ln -s nut-monitor.service $(CURDIR)/debian/tmp/lib/systemd/system/nut-client.service
|
|
|
|
ln -s /dev/null $(CURDIR)/debian/tmp/lib/systemd/system/ups-monitor.service
|
|
|
|
|
2019-07-27 16:16:56 +03:00
|
|
|
override_dh_auto_install-indep:
|
2011-06-03 12:54:24 +03:00
|
|
|
#install documentation
|
|
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf
|
|
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html
|
|
|
|
cp $(CURDIR)/docs/*.pdf $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf
|
|
|
|
cp $(CURDIR)/docs/FAQ.html $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html
|
|
|
|
|
|
|
|
for f in $(CURDIR)/docs/*.chunked/; do \
|
|
|
|
nf=`basename $${f} | sed 's/\(.*\)\.chunked/\1/'`; \
|
|
|
|
cp -a $${f} $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html/$${nf}/; \
|
|
|
|
done
|
|
|
|
|
2019-07-27 16:16:56 +03:00
|
|
|
override_dh_installinit:
|
2019-07-27 18:36:41 +03:00
|
|
|
dh_installinit --error-handler=handle_start_failure
|
2010-02-24 23:58:53 +02:00
|
|
|
|
2019-07-27 16:16:56 +03:00
|
|
|
override_dh_compress:
|
|
|
|
dh_compress -X.pdf
|
|
|
|
|
|
|
|
override_dh_installdocs:
|
|
|
|
dh_installdocs -A ./README ./NEWS ./TODO ./AUTHORS
|
|
|
|
|
|
|
|
override_dh_installchangelogs:
|
|
|
|
# dh_installchangelogs automagically rename history.txt to changelog, let's try
|
|
|
|
# to avoid that
|
|
|
|
dh_installchangelogs -pnut -Xhistory.txt
|
|
|
|
dh_installchangelogs --remaining-packages
|