139 lines
3.4 KiB
Plaintext
139 lines
3.4 KiB
Plaintext
|
#!/usr/bin/make -f
|
||
|
|
||
|
#export DH_VERBOSE=1
|
||
|
export DH_OPTIONS=
|
||
|
|
||
|
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
|
||
|
CFLAGS+=$(if $(findstring debug,$(DEB_BUILD_OPTIONS)),-g)
|
||
|
CFLAGS+=$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),-O0,-O2)
|
||
|
CONFIGUREFLAGS+=$(if $(findstring nostrip,$(DEB_BUILD_OPTIONS)),,--enable-strip)
|
||
|
CONFIGUREFLAGS+=--build=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||
|
CONFIGUREFLAGS+=--host=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||
|
CONFIGUREFLAGS+=$(if $(wildcard /usr/include/linux/hiddev.h),--with-linux-hiddev=/usr/include/linux/hiddev.h,--without-linux-hiddev)
|
||
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
||
|
CONFIGUREFLAGS+=--with-udev-dir=/lib/udev
|
||
|
endif
|
||
|
|
||
|
configure: patch configure-stamp
|
||
|
configure-stamp:
|
||
|
dh_testdir
|
||
|
CFLAGS='$(CFLAGS)' ./configure $(CONFIGUREFLAGS) \
|
||
|
--prefix=/usr \
|
||
|
--exec-prefix=/ \
|
||
|
--sysconfdir=/etc/nut \
|
||
|
--mandir=/usr/share/man \
|
||
|
--libdir=/lib \
|
||
|
--includedir=/usr/include \
|
||
|
--without-ssl \
|
||
|
--with-hal \
|
||
|
--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/pkgconfig \
|
||
|
--with-user=nut --with-group=nut
|
||
|
touch $@
|
||
|
|
||
|
build: configure
|
||
|
build: build-stamp
|
||
|
build-stamp:
|
||
|
dh_testdir
|
||
|
$(MAKE)
|
||
|
touch $@
|
||
|
|
||
|
clean: clean-patched unpatch
|
||
|
clean-patched:
|
||
|
dh_testdir
|
||
|
dh_testroot
|
||
|
rm -f configure-stamp build-stamp install-stamp
|
||
|
[ ! -f Makefile ] || $(MAKE) distclean
|
||
|
dh_clean
|
||
|
# debconf-updatepo
|
||
|
# -test -r /usr/share/misc/config.sub && \
|
||
|
# cp -f /usr/share/misc/config.sub config.sub
|
||
|
# -test -r /usr/share/misc/config.guess && \
|
||
|
# cp -f /usr/share/misc/config.guess config.guess
|
||
|
|
||
|
patch: patch-stamp
|
||
|
patch-stamp:
|
||
|
# dpatch apply-all
|
||
|
# touch $@
|
||
|
# run autoreconf for dpatch
|
||
|
# autoreconf
|
||
|
|
||
|
unpatch:
|
||
|
# dpatch deapply-all
|
||
|
# rm -rf patch-stamp debian/patched
|
||
|
|
||
|
uninstall:
|
||
|
dh_testdir
|
||
|
dh_testroot
|
||
|
rm -f install-stamp
|
||
|
dh_prep
|
||
|
|
||
|
install: build
|
||
|
install: install-stamp
|
||
|
install-stamp: DH_OPTIONS=
|
||
|
install-stamp:
|
||
|
dh_testdir
|
||
|
dh_testroot
|
||
|
dh_prep
|
||
|
dh_installdirs
|
||
|
|
||
|
$(MAKE) install \
|
||
|
DESTDIR=$(CURDIR)/debian/tmp RUNUID=65534 RUNGID=65534
|
||
|
|
||
|
# install the bash completion script
|
||
|
mkdir -p $(CURDIR)/debian/tmp/etc/bash_completion.d
|
||
|
cp $(CURDIR)/scripts/misc/nut.bash_completion \
|
||
|
$(CURDIR)/debian/tmp/etc/bash_completion.d/nut
|
||
|
|
||
|
# 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
|
||
|
|
||
|
dh_installchangelogs ChangeLog
|
||
|
dh_installinit -- start 50 2 3 4 5 . stop 50 0 1 6 .
|
||
|
dh_install
|
||
|
dh_installman
|
||
|
dh_installdocs -XMakefile
|
||
|
dh_link
|
||
|
touch $@
|
||
|
|
||
|
binary-indep: DH_OPTIONS=-i
|
||
|
binary-indep: install
|
||
|
|
||
|
binary-arch: DH_OPTIONS=-a
|
||
|
binary-arch: install
|
||
|
dh_testdir
|
||
|
dh_testroot
|
||
|
# dh_installdebconf
|
||
|
dh_strip
|
||
|
dh_compress
|
||
|
dh_fixperms
|
||
|
dh_makeshlibs
|
||
|
dh_lintian -pnut
|
||
|
dh_installdeb
|
||
|
dh_shlibdeps
|
||
|
# dh_shlibdeps -Xlibupsclient.a
|
||
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
||
|
dh_gencontrol -- -Vudev="udev (>= 0.124-1)"
|
||
|
# for Ubuntu
|
||
|
# dh_gencontrol -- -Vudev="udev (>= 136-1)"
|
||
|
else
|
||
|
dh_gencontrol -- -Vudev=""
|
||
|
endif
|
||
|
dh_md5sums
|
||
|
dh_builddeb
|
||
|
|
||
|
binary: binary-indep binary-arch
|
||
|
.PHONY: build clean binary-indep binary-arch binary configure install uninstall patch unpatch
|