2010-02-24 21:58:53 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
2011-04-24 21:37:41 +00:00
|
|
|
include /usr/share/cdbs/1/rules/debhelper.mk
|
|
|
|
include /usr/share/cdbs/1/class/autotools.mk
|
2011-06-03 11:54:46 +00:00
|
|
|
include /usr/share/cdbs/1/class/python-module.mk
|
2010-02-24 21:58:53 +00:00
|
|
|
|
2013-11-24 17:20:21 +00:00
|
|
|
include /usr/share/cdbs/1/rules/autoreconf.mk
|
|
|
|
# We cannot call autoreconf -f -i as it updates INSTALL which is used for doc
|
|
|
|
# generation
|
|
|
|
DEB_DH_AUTORECONF_ARGS = --as-needed
|
|
|
|
|
2010-02-24 21:58:53 +00:00
|
|
|
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
|
|
|
|
|
2011-06-03 09:54:05 +00:00
|
|
|
# List any files which are not installed
|
|
|
|
include /usr/share/cdbs/1/rules/utils.mk
|
|
|
|
common-binary-post-install-arch:: list-missing
|
2010-02-24 21:58:53 +00:00
|
|
|
|
2013-11-24 17:20:21 +00:00
|
|
|
DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed
|
|
|
|
include /usr/share/dpkg/buildflags.mk
|
|
|
|
|
2011-05-09 13:32:04 +00:00
|
|
|
DEB_CONFIGURE_PREFIX :=
|
|
|
|
DEB_CONFIGURE_SYSCONFDIR := /etc/nut
|
|
|
|
DEB_CONFIGURE_INCLUDEDIR := /usr/include
|
|
|
|
DEB_CONFIGURE_MANDIR := /usr/share/man
|
2012-08-12 20:18:54 +00:00
|
|
|
DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
|
2013-11-24 15:15:25 +00:00
|
|
|
--with-ssl --with-nss \
|
2011-04-24 21:37:41 +00:00
|
|
|
--with-cgi \
|
|
|
|
--with-dev \
|
|
|
|
--enable-static \
|
|
|
|
--with-statepath=/var/run/nut \
|
|
|
|
--with-altpidpath=/var/run/nut \
|
|
|
|
--with-drvpath=/lib/nut \
|
|
|
|
--with-cgipath=/usr/lib/cgi-bin/nut \
|
|
|
|
--with-htmlpath=/usr/share/nut/www \
|
|
|
|
--with-pidpath=/var/run/nut \
|
|
|
|
--datadir=/usr/share/nut \
|
2012-08-12 20:18:54 +00:00
|
|
|
--with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
|
2011-04-24 21:37:41 +00:00
|
|
|
--with-user=nut --with-group=nut
|
2010-02-24 21:58:53 +00:00
|
|
|
|
2011-04-24 21:37:41 +00:00
|
|
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
2012-08-12 21:14:24 +00:00
|
|
|
DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system
|
2011-04-24 21:37:41 +00:00
|
|
|
endif
|
2010-02-24 21:58:53 +00:00
|
|
|
|
2011-06-03 09:54:24 +00:00
|
|
|
# only build documentation if asciidoc is installed
|
|
|
|
ifneq ($(shell which asciidoc),)
|
|
|
|
DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf
|
|
|
|
endif
|
|
|
|
|
2011-04-24 21:37:41 +00:00
|
|
|
common-install-arch::
|
2010-02-24 21:58:53 +00:00
|
|
|
# install the bash completion script
|
2013-11-24 16:54:31 +00:00
|
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/
|
2010-02-24 21:58:53 +00:00
|
|
|
cp $(CURDIR)/scripts/misc/nut.bash_completion \
|
2013-11-24 16:54:31 +00:00
|
|
|
$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/nut
|
2010-02-24 21:58:53 +00:00
|
|
|
|
2011-12-02 19:40:30 +00: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 20:02:54 +00:00
|
|
|
# install Augeas lenses
|
|
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/augeas/lenses/dist/tests
|
|
|
|
cp $(CURDIR)/scripts/augeas/*.aug \
|
|
|
|
$(CURDIR)/debian/tmp/usr/share/augeas/lenses/dist/
|
|
|
|
cp $(CURDIR)/scripts/augeas/tests/test_nut.aug \
|
|
|
|
$(CURDIR)/debian/tmp/usr/share/augeas/lenses/dist/tests/
|
|
|
|
|
2010-02-24 21:58:53 +00: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-12 23:11:45 +00: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 19:25:56 +00:00
|
|
|
ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.4 \
|
2012-08-12 20:18:54 +00:00
|
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so
|
2014-10-20 18:06:06 +00: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 20:18:54 +00:00
|
|
|
|
2015-01-25 11:54:03 +00: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
|
|
|
|
|
2012-08-12 21:14:24 +00:00
|
|
|
# Install systemd files only on systems where it's supported
|
|
|
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
2012-08-12 21:49:47 +00:00
|
|
|
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-monitor.service \
|
2012-08-12 21:14:24 +00:00
|
|
|
$(CURDIR)/debian/nut-client/lib/systemd/system/nut-monitor.service
|
2012-08-12 21:49:47 +00:00
|
|
|
install -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system-shutdown/nutshutdown \
|
2012-08-12 21:14:24 +00:00
|
|
|
$(CURDIR)/debian/nut-server/lib/systemd/system-shutdown/nutshutdown
|
2012-08-12 21:49:47 +00:00
|
|
|
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-driver.service \
|
2012-08-12 21:14:24 +00:00
|
|
|
$(CURDIR)/debian/nut-server/lib/systemd/system/nut-driver.service
|
2012-08-12 21:49:47 +00:00
|
|
|
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-server.service \
|
2012-08-12 21:14:24 +00:00
|
|
|
$(CURDIR)/debian/nut-server/lib/systemd/system/nut-server.service
|
2013-01-25 22:17:36 +00:00
|
|
|
|
2013-12-09 19:03:34 +00:00
|
|
|
# Add a symlink to mask the LSB initscript
|
|
|
|
ln -s nut-monitor.service $(CURDIR)/debian/nut-client/lib/systemd/system/nut-client.service
|
|
|
|
|
2013-01-26 00:01:44 +00:00
|
|
|
# Install tmpfiles config file to create /run/nut directory
|
|
|
|
install -m 644 -D $(CURDIR)/debian/nut-client.tmpfiles \
|
|
|
|
$(CURDIR)/debian/nut-client/usr/lib/tmpfiles.d/nut-client.conf
|
|
|
|
install -m 644 -D $(CURDIR)/debian/nut-server.tmpfiles \
|
|
|
|
$(CURDIR)/debian/nut-server/usr/lib/tmpfiles.d/nut-server.conf
|
2012-08-12 21:14:24 +00:00
|
|
|
endif
|
|
|
|
|
2011-06-03 09:54:24 +00:00
|
|
|
common-install-indep::
|
|
|
|
#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
|
|
|
|
|
2011-06-03 14:22:58 +00:00
|
|
|
binary-install/nut-monitor::
|
|
|
|
dh_python2 -pnut-monitor
|
|
|
|
|
2015-03-15 10:14:01 +00:00
|
|
|
DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade --error-handler=handle_start_failure
|
|
|
|
DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --restart-after-upgrade --error-handler=handle_start_failure
|
2013-11-24 19:11:37 +00:00
|
|
|
DEB_DH_SYSTEMD_START_ARGS_nut-server := --restart-after-upgrade
|
|
|
|
DEB_DH_SYSTEMD_START_ARGS_nut-client := --restart-after-upgrade
|
2011-06-03 09:54:24 +00:00
|
|
|
DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf
|
2010-02-24 21:58:53 +00:00
|
|
|
|
|
|
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
2011-04-24 21:37:41 +00:00
|
|
|
# for Debian
|
|
|
|
DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 0.124-1)"
|
2010-02-24 21:58:53 +00:00
|
|
|
# for Ubuntu
|
2011-04-24 21:37:41 +00:00
|
|
|
# DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 136-1)"
|
2010-02-24 21:58:53 +00:00
|
|
|
endif
|