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

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

# debian/rules file for the Debian GNU/Linux stunnel package
# Copyright 2003 by Julien LEMOINE <speedblue@debian.org>
# Copyright 2014 by Peter Pentchev <roam@ringlet.net>

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
DEB_NODOC=0
else
DEB_NODOC=1
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND=-Wall

multiarch_path=	$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

override_dh_auto_configure:
	dh_auto_configure -- \
	  --enable-ipv6 --with-threads=pthread

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	env TEST_STUNNEL=$(CURDIR)/src/stunnel debian/tests/runtime
	dh_auto_test
endif

override_dh_auto_install:
	dh_auto_install -- -C src
ifeq ($(DEB_NODOC),0)
	dh_auto_install -- -C doc
endif

	# .la file is useless
	rm $(CURDIR)/debian/stunnel4/usr/lib/$(multiarch_path)/stunnel/libstunnel.la

	# Rename binary
	mv $(CURDIR)/debian/stunnel4/usr/bin/stunnel 			\
	  $(CURDIR)/debian/stunnel4/usr/bin/stunnel4

	# Copy sample init script into place for dh_installinit
	cp $(CURDIR)/tools/stunnel.init $(CURDIR)/debian/stunnel4.init

ifeq ($(DEB_NODOC),0)
	ln doc/stunnel.8 doc/stunnel4.8
	ln doc/stunnel.pl.8 doc/stunnel4.pl.8

	# Manpages will be installed by dh_installman
	rm -rf $(CURDIR)/debian/stunnel4/usr/share/man

	# Move docs into proper dir
	mv $(CURDIR)/debian/stunnel4/usr/share/doc/stunnel		\
	  $(CURDIR)/debian/stunnel4/usr/share/doc/stunnel4

	# Basic docs for the user on how to create an initial configuration
	install -p -m 0644 $(CURDIR)/debian/stunnel4.conf.README \
	  $(CURDIR)/debian/stunnel4/etc/stunnel/README
endif

ifeq ($(DEB_NODOC),1)
override_dh_installdocs:
	mkdir -p $(CURDIR)/debian/stunnel4/usr/share/doc/stunnel4
	install -p -m 644 $(CURDIR)/debian/copyright $(CURDIR)/debian/stunnel4/usr/share/doc/stunnel4/

override_dh_installman:

override_dh_link:
	dh_link
	rm $(CURDIR)/debian/stunnel4/usr/share/man/man8/stunnel.8.gz
	rmdir $(CURDIR)/debian/stunnel4/usr/share/man/man8
	rmdir $(CURDIR)/debian/stunnel4/usr/share/man
endif

override_dh_installchangelogs:
	dh_installchangelogs -X ChangeLog
	install -m 644 ChangeLog $(CURDIR)/debian/stunnel4/usr/share/doc/stunnel4/NEWS

override_dh_installinit:
	dh_installinit --no-start

override_dh_installppp:
	dh_installppp --name=0stunnel4

override_dh_compress:
	dh_compress --exclude=StunnelConf-0.1.pl

%:
	dh $@