summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 446a346d543ca1985251620f17fda9fa942baa46 (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
#!/usr/bin/make -f

STRIP =strip
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  STRIP =: nostrip
endif

CFLAGS =-g -O2 -Wall
LDFLAGS =
CC =gcc
ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
  CC =diet -v -Os gcc
  CFLAGS =-Wall
endif

DIR =$(shell pwd)/debian/socklog

build: deb-checkdir build-arch-stamp build-indep-stamp

build-arch: deb-checkdir build-arch-stamp
build-arch-stamp:
	rm -rf admin
	tar xzf socklog-2.1.0.tar.gz
	patch -p0 <debian/diff/tryto-n.diff
	patch -p0 <debian/diff/socklog-conf-update-service.diff
	-gcc -v
	rm -f admin/socklog && ln -s socklog-2.1.0 admin/socklog
	echo '$(CC) $(CFLAGS)' >admin/socklog/src/conf-cc
	echo '$(CC) $(LDFLAGS)' >admin/socklog/src/conf-ld
	$(MAKE) -Cadmin/socklog/src
	$(MAKE) -Cadmin/socklog/src check
	touch build-arch-stamp

build-indep: deb-checkdir build-indep-stamp
build-indep-stamp: 
	touch build-indep-stamp

clean: deb-checkdir deb-checkuid
	rm -rf admin
	rm -rf '$(DIR)' '$(DIR)'-run
	rm -f build-arch-stamp build-indep-stamp
	rm -f debian/files debian/substvars changelog

install: install-arch install-indep

install-arch: deb-checkdir deb-checkuid build-arch-stamp
	rm -rf '$(DIR)'
	install -d -m0755 '$(DIR)'/usr/sbin
	install -d -m0755 '$(DIR)'/usr/bin
	for i in socklog socklog-conf; do \
	  install -m0755 admin/socklog/src/$$i '$(DIR)'/usr/sbin/ || exit 1; \
	done
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/*
	for i in socklog-check tryto uncat; do \
	  install -m0755 admin/socklog/src/$$i '$(DIR)'/usr/bin/ || exit 1; \
	done
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/*
	# man pages
	install -d -m0755 '$(DIR)'/usr/share/man/man1
	install -d -m0755 '$(DIR)'/usr/share/man/man8
	install -m0644 admin/socklog/man/*.1 '$(DIR)'/usr/share/man/man1/
	gzip -9n '$(DIR)'/usr/share/man/man1/*.1
	install -m0644 admin/socklog/man/*.8 '$(DIR)'/usr/share/man/man8/
	gzip -9n '$(DIR)'/usr/share/man/man8/*.8
	# changelog
	test -r changelog || ln -s admin/socklog/package/CHANGES changelog

install-indep: deb-checkdir deb-checkuid build-indep-stamp
	rm -rf '$(DIR)'-run
	for i in unix klog inet ucspi-tcp; do \
	  install -d -m0755 '$(DIR)'-run/etc/sv/socklog-$$i/log && \
	  install -m0755 debian/etc/$$i/run \
	    '$(DIR)'-run/etc/sv/socklog-$$i/run && \
	  install -m0755 debian/etc/$$i/log/run \
	    '$(DIR)'-run/etc/sv/socklog-$$i/log/run || exit 1; \
	done
	install -m0755 debian/etc/unix/check \
	  '$(DIR)'-run/etc/sv/socklog-unix/check
	install -d -m0755 '$(DIR)'-run/etc/sv/socklog-notify
	install -m0755 debian/etc/notify/run \
	  '$(DIR)'-run/etc/sv/socklog-notify/run
	for i in klog inet ucspi-tcp; do \
	  ln -s /var/log/socklog-$$i '$(DIR)'-run/etc/sv/socklog-$$i/log/main \
	    || exit 1; \
	done
	ln -s /var/log/socklog '$(DIR)'-run/etc/sv/socklog-unix/log/main
	# changelog
	test -r changelog || ln -s admin/socklog/package/CHANGES changelog

binary-arch: deb-checkdir deb-checkuid install-arch socklog.deb
	test '$(CC)' != 'gcc' || \
	  dpkg-shlibdeps '$(DIR)'/usr/bin/* '$(DIR)'/usr/sbin/*
	dpkg-gencontrol -isp -psocklog -P'$(DIR)' 
	dpkg -b '$(DIR)' ..

binary-indep: deb-checkdir deb-checkuid install-indep socklog-run.deb
	dpkg-gencontrol -isp -psocklog-run -P'$(DIR)'-run
	dpkg -b '$(DIR)'-run ..

binary: binary-indep binary-arch

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

include debian/implicit