summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 0721253ca5fd56a29cad1da44232dd90fa286623 (plain)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/make -f
#
# $Id$
#

DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

# Set proper Provides
ifeq ($(DEB_HOST_ARCH_OS),linux)
  syslogd_provides = linux-kernel-log-daemon
else
  tools_provides = net-tools
endif

D = $(CURDIR)/debian/tmp
mandir = usr/share/man
man1dir = $(mandir)/man1
man8dir = $(mandir)/man8

include /usr/share/quilt/quilt.make

configure: configure.ac
	dh_testdir
	
	autoreconf -f -i

config.status: configure
	dh_testdir
	
	./configure \
	  --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
	  --prefix=/usr \
	  --sysconfdir=/etc \
	  --localstatedir=/var \
	  --libexecdir=\$${prefix}/sbin \
	  --mandir=\$${prefix}/share/man \
	  --infodir=\$${prefix}/share/info \
	  --with-wrap --with-pam

build: patch debian/control config.status
	dh_testdir
	
	$(MAKE) CFLAGS="$(CFLAGS)"

# We need it forced on all builds.
.PHONY: debian/control

debian/control: debian/control.in
	# Set proper Priority and Section
ifeq ($(DEB_HOST_ARCH_OS),linux)
	sed \
	  -e 's/@inetutils:Priority@/extra/g' \
	  -e 's/@syslogd:Priority@/extra/g' \
	  -e 's/@syslogd:Section@/net/g' \
	< debian/control.in \
	> debian/control
else
	sed \
	  -e 's/@inetutils:Priority@/standard/g' \
	  -e 's/@syslogd:Priority@/required/g' \
	  -e 's/@syslogd:Section@/base/g' \
	< debian/control.in \
	> debian/control
endif

clean: unpatch
	dh_testdir
	dh_testroot
	
	-$(MAKE) clean
	
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs -a
	
	-$(MAKE) install DESTDIR=$(D)
	
	# Move ping to /bin
	mkdir -p $(D)/bin
	mv $(D)/usr/bin/ping $(D)/bin/
	
	# Rename ifconfig to not break existing systems using net-tools
	mv $(D)/usr/bin/ifconfig $(D)/usr/bin/inetutils-ifconfig
	
	# Rename inetd to be able to coexist with not purged netkit-inetd
	mv $(D)/usr/sbin/inetd $(D)/usr/sbin/inetutils-inetd
	mv $(D)/$(man8dir)/inetd.8 $(D)/$(man8dir)/inetutils-inetd.8
	
	# Needed to enable alternatives
	mv $(D)/usr/bin/telnet $(D)/usr/bin/inetutils-telnet
	mv $(D)/$(man1dir)/telnet.1 $(D)/$(man1dir)/inetutils-telnet.1
	mv $(D)/usr/bin/ftp $(D)/usr/bin/inetutils-ftp
	mv $(D)/$(man1dir)/ftp.1 $(D)/$(man1dir)/inetutils-ftp.1
	mv $(D)/usr/bin/talk $(D)/usr/bin/inetutils-talk
	mv $(D)/$(man1dir)/talk.1 $(D)/$(man1dir)/inetutils-talk.1

binary-indep:
# Nothing to do.

binary-arch: install
	dh_testdir
	dh_testroot
	dh_install -a --sourcedir=$(D)
	# Install ping6 only if built
	if [ -x $(D)/usr/bin/ping6 ]; then \
	  mv $(D)/usr/bin/ping6 \
	     $(CURDIR)/debian/inetutils-ping/bin/; \
	fi
	# This should be in some dh_installoverrides
	cp $(CURDIR)/debian/inetutils-ping.overrides \
	   $(CURDIR)/debian/inetutils-ping/usr/share/lintian/overrides/inetutils-ping
	dh_installdebconf -a
	dh_installdocs -a -A NEWS AUTHORS THANKS
	dh_installexamples -a
	dh_installinit -pinetutils-syslogd -- defaults 10 90
	dh_installinit -a -Ninetutils-syslogd
	dh_installlogrotate -a
	dh_installman -a
	dh_installinfo -a
	dh_installchangelogs -a ChangeLog
	dh_link -a
	dh_strip -a
	dh_compress -a
	# pings are setuid
	dh_fixperms -a -Xbin/ping -Xbin/ping6
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a -- \
	  -Vsyslogd:Provides="$(syslogd_provides)" \
	  -Vtools:Provides="$(tools_provides)"
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

.PHONY: build build-udeb clean binary-indep binary-arch binary install