114 lines
4.8 KiB
Makefile
Executable file
114 lines
4.8 KiB
Makefile
Executable file
#!/usr/bin/make -f
|
|
|
|
include /usr/share/cdbs/1/rules/debhelper.mk
|
|
include /usr/share/cdbs/1/class/autotools.mk
|
|
include /usr/share/cdbs/1/class/python-module.mk
|
|
|
|
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
|
|
|
|
# List any files which are not installed
|
|
include /usr/share/cdbs/1/rules/utils.mk
|
|
common-binary-post-install-arch:: list-missing
|
|
|
|
DEB_CONFIGURE_PREFIX :=
|
|
DEB_CONFIGURE_SYSCONFDIR := /etc/nut
|
|
DEB_CONFIGURE_INCLUDEDIR := /usr/include
|
|
DEB_CONFIGURE_MANDIR := /usr/share/man
|
|
DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
|
|
--with-ssl --with-nss \
|
|
--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 \
|
|
--with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
|
|
--with-user=nut --with-group=nut
|
|
|
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
|
DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system
|
|
endif
|
|
|
|
# only build documentation if asciidoc is installed
|
|
ifneq ($(shell which asciidoc),)
|
|
DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf
|
|
endif
|
|
|
|
common-install-arch::
|
|
# install the bash completion script
|
|
mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/
|
|
cp $(CURDIR)/scripts/misc/nut.bash_completion \
|
|
$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/nut
|
|
|
|
# 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
|
|
|
|
# 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/
|
|
|
|
# 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
|
|
|
|
# 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
|
|
ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.3 \
|
|
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so
|
|
|
|
# Install systemd files only on systems where it's supported
|
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
|
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-monitor.service \
|
|
$(CURDIR)/debian/nut-client/lib/systemd/system/nut-monitor.service
|
|
install -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system-shutdown/nutshutdown \
|
|
$(CURDIR)/debian/nut-server/lib/systemd/system-shutdown/nutshutdown
|
|
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-driver.service \
|
|
$(CURDIR)/debian/nut-server/lib/systemd/system/nut-driver.service
|
|
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-server.service \
|
|
$(CURDIR)/debian/nut-server/lib/systemd/system/nut-server.service
|
|
|
|
# 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
|
|
endif
|
|
|
|
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
|
|
|
|
binary-install/nut-monitor::
|
|
dh_python2 -pnut-monitor
|
|
|
|
DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server -- start 50 2 3 4 5 . stop 51 0 1 6 .
|
|
DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client -- start 51 2 3 4 5 . stop 50 0 1 6 .
|
|
DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf
|
|
|
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
|
# for Debian
|
|
DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 0.124-1)"
|
|
# for Ubuntu
|
|
# DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 136-1)"
|
|
endif
|