File: rules

package info (click to toggle)
nut 2.4.3-1.1squeeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,816 kB
  • ctags: 5,658
  • sloc: ansic: 45,735; sh: 11,290; makefile: 668; python: 448; perl: 179
file content (138 lines) | stat: -rwxr-xr-x 3,480 bytes parent folder | download
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
#!/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