File: rules

package info (click to toggle)
xterm 235-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,780 kB
  • ctags: 4,528
  • sloc: ansic: 48,756; sh: 3,793; perl: 1,036; makefile: 406
file content (210 lines) | stat: -rwxr-xr-x 6,008 bytes parent folder | download
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
199
200
201
202
203
204
205
206
207
208
209
210
#!/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

# force quilt to not use ~/.quiltrc
QUILT = quilt --quiltrc /dev/null
# force QUILT_PATCHES to the default in case it is exported in the environment
QUILT_PATCHES = patches/

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

CFLAGS = -g -Wall -DDEF_POINTER_MODE=pNever
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -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

DESKTOP_FLAGS = --vendor debian \
		--dir=$(DEBINSTALLTREE)/usr/share/applications

# 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 \
	  cat $(STAMP_DIR)/log/patch; \
	  echo "successful."; \
	else \
	  cat $(STAMP_DIR)/log/patch; \
	  echo "failed! (Check $(STAMP_DIR)/log/patch for details)"; \
	  exit 1; \
	fi; \

	touch $@

# Revert all patches to the upstream source.
.PHONY: unpatch
unpatch: 
	rm -f $(STAMP_DIR)/patch
	@if [ -e $(STAMP_DIR)/patches/applied-patches ]; then \
	  echo -n "Unapplying patches... "; \
	  if $(QUILT) pop -a -v > $(STAMP_DIR)/log/unpatch 2>&1; then \
	    cat $(STAMP_DIR)/log/unpatch; \
	    echo " successful."; \
	  else \
	    cat $(STAMP_DIR)/log/unpatch; \
	    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
	[ -d obj-$(DEB_BUILD_GNU_TYPE) ] || mkdir obj-$(DEB_BUILD_GNU_TYPE)
	cd obj-$(DEB_BUILD_GNU_TYPE) && \
	../configure --enable-logging --enable-wide-chars --enable-luit \
		--with-tty-group=tty --enable-256-color \
		--prefix=/usr --exec-prefix=/usr --mandir=/usr/share/man \
		--with-app-defaults=/etc/X11/app-defaults \
		--disable-imake --enable-narrowproto --enable-exec-xterm \
		$(confflags) DESKTOP_FLAGS="$(DESKTOP_FLAGS)" \
		CFLAGS="$(CFLAGS)" LUIT=/usr/bin/luit
	touch $@


.PHONY: build
build: $(STAMP_DIR)/build
$(STAMP_DIR)/build: $(STAMP_DIR)/configure debian/local/xterm.faq.gz
	dh_testdir
	cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
	touch $@

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

.PHONY: install
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	# General installation
	cd obj-$(DEB_BUILD_GNU_TYPE) && \
	$(MAKE) install mandir=/usr/share/man/man1 libdir=/etc DESTDIR=$(DEBINSTALLTREE)
	
	## Install lxterm command and manual page.
	install -m 755 debian/local/lxterm $(DEBINSTALLTREE)/usr/bin
	install -m 755 debian/local/lxterm.1 $(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 ai noet sw=8 ts=8 tw=0: