File: rules

package info (click to toggle)
xterm 222-1etch4
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,552 kB
  • ctags: 4,131
  • sloc: ansic: 45,739; sh: 3,719; perl: 740; makefile: 333
file content (198 lines) | stat: -rwxr-xr-x 5,659 bytes parent folder | download | duplicates (2)
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/make -f
# $Id$

# Debian rules file for xterm source package

# Copyright 2005 David Martínez Moreno
#
# Licensed under the GNU General Public License, version 2.  See the file
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.

# debhelper
export DH_OPTIONS

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

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	confflags += --build $(DEB_HOST_GNU_TYPE)
else
	confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

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

# Figure out who's building this package.
BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2> /dev/null))}})

# Set some Imake variables for the regular and server-debugging builds.
TIMESTAMP:=$(shell env TZ=UTC date +%Y%m%d%H%M%S)

HTML2TEXT:=lynx -dump -nolist

STAMP_DIR:=stampdir

DEBINSTALLTREE:=$(CURDIR)/debian/tmp

# Set up the $(STAMP_DIR) directory.
.PHONY: stampdir
stampdir: $(STAMP_DIR)/stampdir
$(STAMP_DIR)/stampdir:
	mkdir $(STAMP_DIR)
	>$@

# Set up the package build directory as quilt expects to find it.
.PHONY: prepare
prepare: $(STAMP_DIR)/prepare
$(STAMP_DIR)/prepare: $(STAMP_DIR)/stampdir
	mkdir $(STAMP_DIR)/patches $(STAMP_DIR)/log
	echo 2 >$(STAMP_DIR)/patches/.version
	ln -s debian/patches patches
	ln -s $(STAMP_DIR)/patches .pc
	>$@

# Apply all patches to the upstream source.
.PHONY: patch
patch: $(STAMP_DIR)/patch
$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
	@echo -n "Applying patches... "
	@if quilt push -a -v > $(STAMP_DIR)/log/patch 2>&1; then \
	  echo "successful."; \
	else \
	  echo "failed! (Check $(STAMP_DIR)/log/patch for details)"; \
	  exit 1; \
	fi; \

	touch $@

# Revert all patches to the upstream source.
.PHONY: unpatch
unpatch: 
	@if [ -e $(STAMP_DIR)/patches/applied-patches ]; then \
	  echo -n "Unapplying patches... "; \
	  if quilt pop -a > $(STAMP_DIR)/log/unpatch 2>&1; then \
	    echo " successful."; \
	  else \
	    echo " failed! (Check $(STAMP_DIR)/log/unpatch for details)"; \
	    exit 1; \
	  fi; \
	fi

configure: $(STAMP_DIR)/patch $(STAMP_DIR)/configure
$(STAMP_DIR)/configure: $(STAMP_DIR)/patch
	dh_testdir
	./configure --enable-logging --enable-wide-chars --enable-luit \
		--enable-256-color \
		--prefix=/usr --exec-prefix=/usr --mandir=/usr/share/man \
		--with-app-defaults=/etc/X11/app-defaults \
		--disable-imake --enable-narrowproto
	touch $@


.PHONY: build
build: $(STAMP_DIR)/build
$(STAMP_DIR)/build: $(STAMP_DIR)/configure debian/local/xterm.faq.gz
	dh_testdir
	$(MAKE)
	touch $@

.PHONY: clean
clean: unpatch
	dh_testdir
	dh_testroot
	rm -f .pc patches
	rm -rf $(STAMP_DIR)
	-$(MAKE) distclean
	dh_clean debian/local/xterm.faq.gz

.PHONY: install
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	# General installation
	$(MAKE) install mandir=/usr/share/man/man1 libdir=/etc manext=1x DESTDIR=$(DEBINSTALLTREE)
	
	## Install lxterm command and manual page.
	install -m 755 debian/local/lxterm $(DEBINSTALLTREE)/usr/bin
	install -m 755 debian/local/lxterm.1x $(DEBINSTALLTREE)/usr/share/man/man1
	## Install koi8rxterm command, manual page, and app-defaults file.
	install -m 755 debian/local/koi8rxterm $(DEBINSTALLTREE)/usr/bin
	install -m 755 debian/local/koi8rxterm.1x $(DEBINSTALLTREE)/usr/share/man/man1
	install -d $(DEBINSTALLTREE)/etc/X11/app-defaults
	install -m 644 debian/local/KOI8RXTerm $(DEBINSTALLTREE)/etc/X11/app-defaults
	## Install manual page for uxterm.
	install -m 644 debian/local/uxterm.1x $(DEBINSTALLTREE)/usr/share/man/man1
	## Install terminfo and termcap precompiled definitions.
	install -d $(DEBINSTALLTREE)/usr/lib
	install -m 644 termcap  $(DEBINSTALLTREE)/usr/lib/xterm.termcap
	install -m 644 terminfo $(DEBINSTALLTREE)/usr/lib/xterm.terminfo
	dh_installdocs
	dh_installchangelogs
	dh_installmenu
	dh_install --sourcedir=debian/tmp --list-missing
	# Lintian overrides.
	cp debian/xterm.overrides $(CURDIR)/debian/xterm/usr/share/lintian/overrides/xterm

# Generate plain text XTerm FAQ from HTML.
debian/local/xterm.faq.gz: debian/local/xterm.faq.html
	$(HTML2TEXT) $< >debian/local/xterm.faq
	# dh_compress doesn't recognize this file extension, so we must
	# compress it manually.
	gzip -9f debian/local/xterm.faq

.PHONY: binary
binary: binary-arch

.PHONY: binary-arch
binary-arch: install
	dh_testdir
	dh_testroot
	dh_strip
	dh_compress
	dh_fixperms
	chown :utmp debian/xterm/usr/bin/xterm
	chmod g+s debian/xterm/usr/bin/xterm
	dh_installdeb
	dh_makeshlibs
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# this target is required by policy
.PHONY: binary-indep
binary-indep:

# Note: This rule is for Debian package maintainers' convenience, and is not
# needed for conventional build scenarios.
.PHONY: patch-audit
patch-audit: prepare unpatch
	touch stampdir/log/patch; \
	FUZZY=no; \
	while [ -n "`quilt next`" ]; do \
	  RESULT=`quilt push -v | tee -a stampdir/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/'`;\
	  case "$$RESULT" in \
	    succeeded) \
	      echo "The patch is fuzzy: `quilt top`"; \
		  echo "The patch is fuzzy: `quilt top`" > stampdir/log/`quilt top`; \
	      FUZZY=yes; \
	    ;; \
	    FAILED) \
	      echo "The patch is broken: `quilt next`"; \
		  echo "The patch is fuzzy: `quilt next`" > stampdir/log/`quilt next`; \
	      exit 1; \
	    ;; \
	  esac; \
	done; \
	if [ $$FUZZY = "yes" ]; then \
	  echo "There were fuzzy patches. Please Fix."; \
	  exit 1; \
	fi

# vim:set noet ai sts=8 sw=8 tw=0: