summaryrefslogtreecommitdiff
path: root/debian/rules
blob: ff2d5f6312917d0ef781e16db83d1daa3064c316 (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
#
# Copyright (C) 1997 joost witteveen <joost@rulcmc.leidenuniv.nl>
# Copyright (C) 1997-2001 Juan Cespedes <cespedes@debian.org>
# Copyright (C) 2001 Adam Lazur <zal@debian.org>

# Uncomment me to turn on debugging
#export DH_VERBOSE=1

package := screen
ROOT := $(CURDIR)/debian/$(package)
# statically define this... sucko
TTYGROUP := 5

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ifeq ($(findstring noopt,$(DEB_BUILD_OPTIONS)),noopt)
CC_OPTFLAGS := -O0 -g3
else
CC_OPTFLAGS := -O2 -g
endif

clean:
	dh_testdir
	dh_testroot
	test ! -s doc/Makefile || $(MAKE) -C doc realclean
	test ! -s Makefile || ! grep -q clean Makefile || $(MAKE) realclean
	dh_autoreconf_clean
	dh_clean config.log config.status Makefile

configure: configure-stamp
configure-stamp:
	dh_testdir
	dh_autoreconf
	./configure --prefix=/usr \
		    $(shell dpkg-buildflags --export=configure) \
		    --infodir='$$(prefix)/share/info' \
		    --mandir='$$(prefix)/share/man' \
		    --with-socket-dir=/var/run/screen \
		    --enable-pam \
		    --with-pty-mode=0620 \
		    --with-pty-group=${TTYGROUP} \
		    --enable-rxvt_osc \
		    --with-sys-screenrc=/etc/screenrc \
		    --enable-colors256 \
		    --enable-telnet \
		    --enable-use-locale

	# Assert the use of fifos instead of sockets
	grep -q "define.*NAMEDPIPE.*1" config.h || echo "#define NAMEDPIPE 1" >> config.h
	touch $@

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: configure-stamp
	dh_testdir
	$(MAKE) CFLAGS+='$(CC_OPTFLAGS) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers'
	$(MAKE) CFLAGS+='$(CC_OPTFLAGS) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers' -C doc
	touch $@

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs
	# can't call the normal install target b/c it installs the info files
	# and other crud
	$(MAKE) prefix=$(ROOT)/usr SCREENENCODINGS='$$(prefix)/share/screen/utf8encodings' installdirs install_bin
	# install the debian screenrc to etc
	install -m 644 debian/screenrc $(ROOT)/etc
	# hack around the fact that the install target makes screen a symlink to screen-$$(VERSION)
	rm -f $(ROOT)/usr/bin/screen
	mv -f $(ROOT)/usr/bin/screen* $(ROOT)/usr/bin/screen
	# make it setgid utmp
	chown root:utmp $(ROOT)/usr/bin/screen
	chmod 2755 $(ROOT)/usr/bin/screen
	touch $@

binary: binary-arch
binary-indep: install
binary-arch: install
	dh_testdir
	dh_testroot
	dh_installdocs
	cp debian/README.terminfo $(ROOT)/usr/share/doc/screen/terminfo/
	dh_installexamples
	dh_installman || true
	dh_installinfo
	dh_installdebconf
	dh_installchangelogs -k patchlevel.h
	dh_installinit --no-start --init-script='screen-cleanup' --update-rcd-params='start 70 S .'
	dh_lintian
	dh_strip
	dh_compress
	dh_fixperms -X/usr/bin/screen
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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