4
# Debian rules file for xorg-x11 source package
3
# Debian X Strike Force Build System (XSFBS): Make portion
6
5
# Copyright 1996 Stephen Early
7
6
# Copyright 1997 Mark Eichin
8
# Copyright 1998-2005 Branden Robinson
7
# Copyright 1998-2005, 2007 Branden Robinson
9
8
# Copyright 2005 David Nusinow
11
10
# Licensed under the GNU General Public License, version 2. See the file
22
21
# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
24
# force quilt to not use ~/.quiltrc and to use debian/patches
25
QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null
25
27
# Set up parameters for the upstream build environment.
27
29
# Determine (source) package name from Debian changelog.
42
44
BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
44
46
# Find out if this is an official build; an official build has nothing but
45
# digits, dots, and/or the strings "woody" or "sarge" in the Debian part of the
47
# digits, dots, and/or the codename of a release in the Debian part of the
46
48
# version number. Anything else indicates an unofficial build.
47
OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi)
49
OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi)
49
51
# Set up parameters for the Debian build environment.
67
69
# $(STAMP_DIR) houses stamp files for complex targets.
68
70
STAMP_DIR:=stampdir
70
# $(SOURCE_DIR) houses one or more source trees.
71
SOURCE_DIR:=build-tree
73
# $(SOURCE_TREE) is the location of the source tree to be compiled. If there
74
# is more than one, others are found using this name plus a suffix to indicate
75
# the purpose of the additional tree (e.g., $(SOURCE_TREE)-custom). The
76
# "setup" target is responsible for creating such trees.
77
#SOURCE_TREE:=$(SOURCE_DIR)/xc
78
#FIXME We need to define this in our debian/rules file
80
72
# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
82
74
DEBTREEDIR:=$(CURDIR)/debian/tmp
117
109
# Set up the package build directory as quilt expects to find it.
119
111
stampdir_targets+=prepare
120
prepare: $(STAMP_DIR)/genscripts $(STAMP_DIR)/prepare $(STAMP_DIR)/patches $(STAMP_DIR)/log
121
$(STAMP_DIR)/prepare: $(STAMP_DIR)/stampdir
122
if [ ! -e $(STAMP_DIR)/patches ]; then \
123
mkdir $(STAMP_DIR)/patches; \
124
ln -s $(STAMP_DIR)/patches .pc; \
125
echo 2 >$(STAMP_DIR)/patches/.version; \
127
if [ ! -e $(STAMP_DIR)/log ]; then \
128
mkdir $(STAMP_DIR)/log; \
130
if [ ! -e patches ]; then \
131
ln -s debian/patches patches; \
112
prepare: $(STAMP_DIR)/prepare
113
$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts
117
stampdir_targets+=log
118
log: $(STAMP_DIR)/log
119
$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir
120
mkdir -p $(STAMP_DIR)/log
135
122
# Apply all patches to the upstream source.
137
124
stampdir_targets+=patch
141
128
echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
144
if quilt next; then \
131
if $(QUILT) next >/dev/null 2>&1; then \
145
132
echo -n "Applying patches..."; \
146
if quilt push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
133
if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
134
cat $(STAMP_DIR)/log/patch; \
147
135
echo "successful."; \
137
cat $(STAMP_DIR)/log/patch; \
149
138
echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
157
146
# Revert all patches to the upstream source.
148
unpatch: $(STAMP_DIR)/log
160
149
rm -f $(STAMP_DIR)/patch
161
150
@echo -n "Unapplying patches..."; \
162
if [ -e $(STAMP_DIR)/patches/applied-patches ]; then \
163
if quilt pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
151
if $(QUILT) applied >/dev/null 2>/dev/null; then \
152
if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
153
cat $(STAMP_DIR)/log/unpatch; \
164
154
echo "successful."; \
156
cat $(STAMP_DIR)/log/unpatch; \
166
157
echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
201
191
updatepo: debian/po/pothead
202
192
debian/scripts/debconf-updatepo --pot-header=pothead --verbose
204
# Use the MANIFEST files to determine whether we're shipping everything we
205
# expect to ship, and not shipping anything we don't expect to ship.
206
.PHONY: check-manifest
207
stampdir_targets+=check-manifest
208
check-manifest: $(STAMP_DIR)/check-manifest
209
$(STAMP_DIR)/check-manifest: $(STAMP_DIR)/install
211
(cd debian/tmp && find -type f | LC_ALL=C sort | cut -c3-) \
212
>debian/MANIFEST.$(ARCH).new
213
# Construct MANIFEST files from MANIFEST.$(ARCH).in and
214
# MANIFEST.$(ARCH).all or MANIFEST.all.
215
if expr "$(findstring -DBuildFonts=NO,$(IMAKE_DEFINES))" \
216
: "-DBuildFonts=NO" >/dev/null 2>&1; then \
217
LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in >debian/MANIFEST.$(ARCH); \
219
if [ -e debian/MANIFEST.$(ARCH).all ]; then \
220
LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in debian/MANIFEST.$(ARCH).all >debian/MANIFEST.$(ARCH); \
222
LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in debian/MANIFEST.all >debian/MANIFEST.$(ARCH); \
225
# Confirm that the installed file list has not changed.
226
if [ -e debian/MANIFEST.$(ARCH) ]; then \
227
if ! cmp -s debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new; then \
228
diff -U 0 debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new || DIFFSTATUS=$$?; \
229
case $${DIFFSTATUS:-0} in \
231
1) if [ -n "$$IGNORE_MANIFEST_CHANGES" ]; then \
232
echo 'MANIFEST check failed; ignoring problem because \$$IGNORE_MANIFEST_CHANGES set' >&2; \
233
echo 'Please ensure that the package maintainer has an up-to-date version of the' >&2; \
234
echo 'MANIFEST.$(ARCH).in file.' >&2; \
236
echo 'MANIFEST check failed; please see debian/README' >&2; \
240
*) echo "diff reported unexpected exit status $$DIFFSTATUS when performing MANIFEST check" >&2; \
248
# Because we build (and install) different files depending on whether or not
249
# any architecture-independent packages are being created, the list of files we
250
# expect to see will differ; see the discussion of the "build" target above.
251
.PHONY: check-manifest-arch check-manifest-indep
252
check-manifest-arch: IMAKE_DEFINES+= -DBuildSpecsDocs=NO -DBuildFonts=NO -DInstallHardcopyDocs=NO
253
check-manifest-arch: check-manifest
254
check-manifest-indep: check-manifest
256
194
# Remove files from the upstream source tree that we don't need, or which have
257
195
# licensing problems. It must be run before creating the .orig.tar.gz.
265
203
grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
267
# Change to what should be the correct directory, ensure it is, and if
268
# so, create the .orig.tar.gz file. Exclude the debian directory and its
269
# contents, and any .svn directories and their contents (so that we can safely
270
# build an .orig.tar.gz from SVN checkout, not just an export).
272
# Note: This rule is for Debian package maintainers' convenience, and is not
273
# needed for conventional build scenarios.
275
# This rule *IS* the recommended method for creating a new .orig.tar.gz file,
276
# for the rare situations when one is needed.
277
.PHONY: make-orig-tar-gz
278
make-orig-tar-gz: clean prune-upstream-tree
280
&& if [ $(shell basename $(CURDIR)) != $(SOURCE_NAME)-$(NO_EPOCH_VER) ]; then \
281
echo "Our current working directory has the wrong name. Renaming..." >&2; \
282
mv $(CURDIR) $(SOURCE_NAME)-$(NO_EPOCH_VER); \
284
tar --exclude=debian --exclude=debian/* \
285
--exclude=.svn --exclude=.svn/* \
286
-cf - $(SOURCE_NAME)-$(NO_EPOCH_VER) \
287
| gzip -9 >$(SOURCE_NAME)_$(NO_EPOCH_VER).orig.tar.gz; \
290
205
# Verify that there are no offsets or fuzz in the patches we apply.
292
207
# Note: This rule is for Debian package maintainers' convenience, and is not
296
211
@echo -n "Auditing patches..."; \
297
212
>$(STAMP_DIR)/log/patch; \
299
while [ -n "$$(quilt next)" ]; do \
300
RESULT=$$(quilt push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
214
while [ -n "$$($(QUILT) next)" ]; do \
215
RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
301
216
case "$$RESULT" in \
303
echo "fuzzy patch: $$(quilt top)" \
304
| tee -a $(STAMP_DIR)/log/$$(quilt top); \
218
echo "fuzzy patch: $$($(QUILT) top)" \
219
| tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \
308
echo "broken patch: $$(quilt next)" \
309
| tee -a $(STAMP_DIR)/log/$$(quilt next); \
223
echo "broken patch: $$($(QUILT) next)" \
224
| tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \