summary refs log tree commit diff
path: root/debian/rules
blob: e8aea4bb5e75aa857035db4e684b25c86940be29 (plain) (blame)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

export DH_COMPAT=3

DEB_HOST_ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH)

CFLAGS =-O2 -Wall
LDFLAGS =-s -Os -pipe
CC =diet -v -Os gcc

ifneq ($(DEB_HOST_ARCH),alpha)
ifneq ($(DEB_HOST_ARCH),arm)
ifneq ($(DEB_HOST_ARCH),hppa)
ifneq ($(DEB_HOST_ARCH),i386)
ifneq ($(DEB_HOST_ARCH),ia64)
ifneq ($(DEB_HOST_ARCH),mips)
ifneq ($(DEB_HOST_ARCH),mipsel)
ifneq ($(DEB_HOST_ARCH),powerpc)
ifneq ($(DEB_HOST_ARCH),sparc)
	CC =gcc
endif
endif
endif
endif
endif
endif
endif
endif
endif

configure: configure-stamp
configure-stamp:
	dh_testdir

	touch configure-stamp

build-arch: configure-stamp build-arch-stamp
build-arch-stamp:
	dh_testdir

	tar xfzvp runit-0.12.0.tar.gz
#	for i in debian/diff/*.diff; do \
#	  cat $$i | ( cd admin/runit-0.12.0 && patch -p0 ); \
#	done
	-gcc -v

	( \
	set -e; \
	cd admin/runit-0.12.0/src; \
	ln -s runit-0.12.0 runit; mv runit ../..; \
	echo "$(CC) $(CFLAGS)" >conf-cc; \
	echo "$(CC) $(LDFLAGS)" >conf-ld; \
	$(MAKE); \
	)

	touch build-arch-stamp

build-indep: configure-stamp build-indep-stamp
build-indep-stamp:
	dh_testdir

	touch build-indep-stamp

build: build-arch build-indep

clean:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp configure-stamp

	rm -rf admin
	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# runit
	install -m0500 admin/runit-0.12.0/src/runit \
	  $(CURDIR)/debian/runit/sbin/runit
	install -m0500 admin/runit-0.12.0/src/runit-init \
	  $(CURDIR)/debian/runit/sbin/runit-init
	install -m0755 admin/runit-0.12.0/src/runsvdir \
	  $(CURDIR)/debian/runit/usr/bin/runsvdir
	install -m0755 admin/runit-0.12.0/src/runsv \
	  $(CURDIR)/debian/runit/usr/bin/runsv
	install -m0755 admin/runit-0.12.0/src/runsvchdir \
	  $(CURDIR)/debian/runit/usr/sbin/runsvchdir
	install -m0755 admin/runit-0.12.0/src/svlogd \
	  $(CURDIR)/debian/runit/usr/bin/svlogd
	install -m0755 admin/runit-0.12.0/src/svwaitdown \
	  $(CURDIR)/debian/runit/usr/bin/svwaitdown
	install -m0755 admin/runit-0.12.0/src/svwaitup \
	  $(CURDIR)/debian/runit/usr/bin/svwaitup
	install -m0755 admin/runit-0.12.0/src/utmpset \
	  $(CURDIR)/debian/runit/usr/sbin/utmpset
	install -m0755 admin/runit-0.12.0/src/runsvstat \
	  $(CURDIR)/debian/runit/usr/bin/runsvstat
	install -m0755 admin/runit-0.12.0/src/runsvctrl \
	  $(CURDIR)/debian/runit/usr/bin/runsvctrl
	install -m0755 admin/runit-0.12.0/src/chpst \
	  $(CURDIR)/debian/runit/usr/bin/chpst

	# runsvdir-start to be used from /etc/inittab
	install -m0755 debian/2 \
	  $(CURDIR)/debian/runit/usr/sbin/runsvdir-start

	# temporary?
	( cd $(CURDIR)/debian/runit/usr/sbin/ && ln -s ../bin/chpst setuidgid )

	install -m0755 admin/runit-0.12.0/etc/debian/getty-tty5/run \
	  $(CURDIR)/debian/runit/etc/runit/getty-5/run
	install -m0755 admin/runit-0.12.0/etc/debian/getty-tty5/finish \
	  $(CURDIR)/debian/runit/etc/runit/getty-5/finish

	# lintian overrides
	install -m0755 -d $(CURDIR)/debian/runit/usr/share/lintian/overrides
	install -m0644 debian/runit.lintian \
	  $(CURDIR)/debian/runit/usr/share/lintian/overrides/runit

	# docs
	install -m0755 -d $(CURDIR)/debian/runit/usr/share/doc/runit
	for i in README THANKS; do \
	  install -m0644 admin/runit/package/$$i \
	    $(CURDIR)/debian/runit/usr/share/doc/runit/; \
	done
	for i in README.Debian copyright; do \
	  install -m0644 debian/$$i \
	    $(CURDIR)/debian/runit/usr/share/doc/runit/; \
	done
	install -m0755 -d $(CURDIR)/debian/runit/usr/share/doc/runit/doc
	for i in admin/runit/doc/*.html; do \
	  install -m0644 $$i $(CURDIR)/debian/runit/usr/share/doc/runit/doc/; \
	done
	install -m0755 -d $(CURDIR)/debian/runit/usr/share/doc/runit/doc/debian
	for i in 1 2 3 ctrlaltdel; do \
	  install -m0644 admin/runit/etc/debian/$$i \
	    $(CURDIR)/debian/runit/usr/share/doc/runit/doc/debian/; \
	done

# Build architecture-independent files here.
binary-indep: build install

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
#	dh_installdebconf -a
#	dh_installdocs -an
#	dh_installexamples -a
	dh_installman -a admin/runit/man/*.8
	dh_installchangelogs -a admin/runit-0.12.0/package/CHANGES
	dh_strip -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a -X/sbin
#	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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