~ubuntu-branches/ubuntu/karmic/x11-xserver-utils/karmic

« back to all changes in this revision

Viewing changes to debian/xsfbs/xsfbs.mk

  • Committer: Bazaar Package Importer
  • Author(s): Brice Goglin, Julien Cristau, Brice Goglin
  • Date: 2007-08-17 09:58:34 UTC
  • Revision ID: james.westby@ubuntu.com-20070817095834-ywge2nyzj1s3rqnd
Tags: 7.3+1
[ Julien Cristau ]
* iceauth 1.0.2.
  + removes blank line in the manpage (closes: #25285).
* xmodmap 1.0.3.
  + manpage updated to state that -pm is the default (closes: #236198)
* xgamma 1.0.2.
  + the manpage now explains how to print the gamma value more clearly
    (closes: #296021).
* xsetroot 1.0.2.
* xrdb 1.0.4.
  + fixes manpage typo (closes: #276286).
* Add upstream URL to debian/copyright, and update it from xgamma's COPYING
  file.

[ Brice Goglin ]
* Add menu entries for xrefresh and xvidtune.
* sessreg 1.0.3.
* xset 1.0.3.
* Add myself to Uploaders, and remove Branden with his permission.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make -f
 
2
 
 
3
# Debian X Strike Force Build System (XSFBS): Make portion
 
4
 
 
5
# Copyright 1996 Stephen Early
 
6
# Copyright 1997 Mark Eichin
 
7
# Copyright 1998-2005, 2007 Branden Robinson
 
8
# Copyright 2005 David Nusinow
 
9
#
 
10
# Licensed under the GNU General Public License, version 2.  See the file
 
11
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
 
12
 
 
13
# Originally by Stephen Early <sde1000@debian.org>
 
14
# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
 
15
# Modified by Adam Heath <doogie@debian.org>
 
16
# Modified by Branden Robinson <branden@debian.org>
 
17
# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
 
18
# Modified by David Nusinow <dnusinow@debian.org>
 
19
# Acknowledgements to Manoj Srivastava.
 
20
 
 
21
# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
 
22
export DH_OPTIONS
 
23
 
 
24
# force quilt to not use ~/.quiltrc
 
25
QUILT = quilt --quiltrc /dev/null
 
26
# force QUILT_PATCHES to the default in case it is exported in the environment
 
27
QUILT_PATCHES = patches/
 
28
 
 
29
# Set up parameters for the upstream build environment.
 
30
 
 
31
# Determine (source) package name from Debian changelog.
 
32
SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
 
33
                        | grep '^Source:' | awk '{print $$2}')
 
34
 
 
35
# Determine package version from Debian changelog.
 
36
SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
 
37
                        | grep '^Version:' | awk '{print $$2}')
 
38
 
 
39
# Determine upstream version number.
 
40
UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//')
 
41
 
 
42
# Determine the source version without the epoch for make-orig-tar-gz
 
43
NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://')
 
44
 
 
45
# Figure out who's building this package.
 
46
BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
 
47
 
 
48
# Find out if this is an official build; an official build has nothing but
 
49
# digits, dots, and/or the strings "woody" or "sarge" in the Debian part of the
 
50
# version number.  Anything else indicates an unofficial build.
 
51
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)
 
52
 
 
53
# Set up parameters for the Debian build environment.
 
54
 
 
55
# Determine our architecture.
 
56
BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
57
# Work around some old-time dpkg braindamage.
 
58
BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH))
 
59
# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
 
60
ifdef DEB_HOST_ARCH
 
61
 ARCH:=$(DEB_HOST_ARCH)
 
62
else
 
63
 # dpkg-cross sets the ARCH environment variable; if set, use it.
 
64
 ifdef ARCH
 
65
  ARCH:=$(ARCH)
 
66
 else
 
67
  ARCH:=$(BUILD_ARCH)
 
68
 endif
 
69
endif
 
70
 
 
71
# $(STAMP_DIR) houses stamp files for complex targets.
 
72
STAMP_DIR:=stampdir
 
73
 
 
74
# $(SOURCE_DIR) houses one or more source trees.
 
75
SOURCE_DIR:=build-tree
 
76
 
 
77
# $(SOURCE_TREE) is the location of the source tree to be compiled.  If there
 
78
# is more than one, others are found using this name plus a suffix to indicate
 
79
# the purpose of the additional tree (e.g., $(SOURCE_TREE)-custom).  The
 
80
# "setup" target is responsible for creating such trees.
 
81
#SOURCE_TREE:=$(SOURCE_DIR)/xc
 
82
#FIXME We need to define this in our debian/rules file
 
83
 
 
84
# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
 
85
# their files.
 
86
DEBTREEDIR:=$(CURDIR)/debian/tmp
 
87
 
 
88
# All "important" targets have four lines:
 
89
#   1) A target name that is invoked by a package-building tool or the user.
 
90
#      This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart.
 
91
#   2) A line delcaring 1) as a phony target (".PHONY:").
 
92
#   3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may
 
93
#   depend on other targets.
 
94
#   4) A line declaring 3) as a member of the $(stampdir_targets) variable; the
 
95
#   "$(STAMP_DIR)/" prefix is omitted.
 
96
#
 
97
# This indirection is needed so that the "stamp" files that signify when a rule
 
98
# is done can be located in a separate "stampdir".  Recall that make has no way
 
99
# to know when a goal has been met for a phony target (like "build" or
 
100
# "install").
 
101
#
 
102
# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@"
 
103
# so that the target will not be run again.  Removing the file will make Make
 
104
# run the target over.
 
105
 
 
106
# All phony targets should be declared as dependencies of .PHONY, even if they
 
107
# do not have "($STAMP_DIR)/"-prefixed counterparts.
 
108
 
 
109
# Define a harmless default rule to keep things from going nuts by accident.
 
110
.PHONY: default
 
111
default:
 
112
 
 
113
# Set up the $(STAMP_DIR) directory.
 
114
.PHONY: stampdir
 
115
stampdir_targets+=stampdir
 
116
stampdir: $(STAMP_DIR)/stampdir
 
117
$(STAMP_DIR)/stampdir:
 
118
        mkdir $(STAMP_DIR)
 
119
        >$@
 
120
 
 
121
# Set up the package build directory as quilt expects to find it.
 
122
.PHONY: prepare
 
123
stampdir_targets+=prepare
 
124
prepare: $(STAMP_DIR)/genscripts $(STAMP_DIR)/prepare $(STAMP_DIR)/patches $(STAMP_DIR)/log
 
125
$(STAMP_DIR)/prepare: $(STAMP_DIR)/stampdir
 
126
        if [ ! -e $(STAMP_DIR)/patches ]; then \
 
127
                mkdir $(STAMP_DIR)/patches; \
 
128
                ln -s $(STAMP_DIR)/patches .pc; \
 
129
                echo 2 >$(STAMP_DIR)/patches/.version; \
 
130
        fi; \
 
131
        if [ ! -e $(STAMP_DIR)/log ]; then \
 
132
                mkdir $(STAMP_DIR)/log; \
 
133
        fi; \
 
134
        if [ -e debian/patches ] && [ ! -e patches ]; then \
 
135
                ln -s debian/patches patches; \
 
136
        fi; \
 
137
        >$@
 
138
 
 
139
# Apply all patches to the upstream source.
 
140
.PHONY: patch
 
141
stampdir_targets+=patch
 
142
patch: $(STAMP_DIR)/patch
 
143
$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
 
144
        if ! [ `which quilt` ]; then \
 
145
                echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
 
146
                exit 1; \
 
147
        fi; \
 
148
        if $(QUILT) next >/dev/null 2>&1; then \
 
149
          echo -n "Applying patches..."; \
 
150
          if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
 
151
            cat $(STAMP_DIR)/log/patch; \
 
152
            echo "successful."; \
 
153
          else \
 
154
            cat $(STAMP_DIR)/log/patch; \
 
155
            echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
 
156
            exit 1; \
 
157
          fi; \
 
158
        else \
 
159
          echo "No patches to apply"; \
 
160
        fi; \
 
161
        >$@
 
162
 
 
163
# Revert all patches to the upstream source.
 
164
.PHONY: unpatch
 
165
unpatch:
 
166
        rm -f $(STAMP_DIR)/patch
 
167
        @echo -n "Unapplying patches..."; \
 
168
        if [ -e $(STAMP_DIR)/patches/applied-patches ]; then \
 
169
          if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
 
170
            cat $(STAMP_DIR)/log/unpatch; \
 
171
            echo "successful."; \
 
172
          else \
 
173
            cat $(STAMP_DIR)/log/unpatch; \
 
174
            echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
 
175
            exit 1; \
 
176
          fi; \
 
177
        else \
 
178
          echo "nothing to do."; \
 
179
        fi
 
180
 
 
181
# Clean the generated maintainer scripts.
 
182
.PHONY: cleanscripts
 
183
cleanscripts:
 
184
        rm -f $(STAMP_DIR)/genscripts
 
185
        rm -f debian/*.config \
 
186
              debian/*.postinst \
 
187
              debian/*.postrm \
 
188
              debian/*.preinst \
 
189
              debian/*.prerm
 
190
 
 
191
# Clean the package build tree.
 
192
.PHONY: xsfclean
 
193
xsfclean: cleanscripts unpatch
 
194
        dh_testdir
 
195
        rm -f .pc patches
 
196
        rm -rf $(STAMP_DIR) $(SOURCE_DIR)
 
197
        rm -rf imports
 
198
        dh_clean debian/shlibs.local \
 
199
                 debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new \
 
200
                 debian/po/pothead
 
201
 
 
202
# Generate the debconf templates POT file header.
 
203
debian/po/pothead: debian/po/pothead.in
 
204
        sed -e 's/SOURCE_VERSION/$(SOURCE_VERSION)/' \
 
205
          -e 's/DATE/$(shell date "+%F %X%z"/)' <$< >$@
 
206
 
 
207
# Update POT and PO files.
 
208
.PHONY: updatepo
 
209
updatepo: debian/po/pothead
 
210
        debian/scripts/debconf-updatepo --pot-header=pothead --verbose
 
211
 
 
212
# Use the MANIFEST files to determine whether we're shipping everything we
 
213
# expect to ship, and not shipping anything we don't expect to ship.
 
214
.PHONY: check-manifest
 
215
stampdir_targets+=check-manifest
 
216
check-manifest: $(STAMP_DIR)/check-manifest
 
217
$(STAMP_DIR)/check-manifest: $(STAMP_DIR)/install
 
218
        # Compare manifests.
 
219
        (cd debian/tmp && find -type f | LC_ALL=C sort | cut -c3-) \
 
220
          >debian/MANIFEST.$(ARCH).new
 
221
        # Construct MANIFEST files from MANIFEST.$(ARCH).in and
 
222
        # MANIFEST.$(ARCH).all or MANIFEST.all.
 
223
        if expr "$(findstring -DBuildFonts=NO,$(IMAKE_DEFINES))" \
 
224
          : "-DBuildFonts=NO" >/dev/null 2>&1; then \
 
225
          LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in >debian/MANIFEST.$(ARCH); \
 
226
        else \
 
227
          if [ -e debian/MANIFEST.$(ARCH).all ]; then \
 
228
            LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in debian/MANIFEST.$(ARCH).all >debian/MANIFEST.$(ARCH); \
 
229
          else \
 
230
            LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in debian/MANIFEST.all >debian/MANIFEST.$(ARCH); \
 
231
          fi; \
 
232
        fi
 
233
        # Confirm that the installed file list has not changed.
 
234
        if [ -e debian/MANIFEST.$(ARCH) ]; then \
 
235
          if ! cmp -s debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new; then \
 
236
            diff -U 0 debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new || DIFFSTATUS=$$?; \
 
237
            case $${DIFFSTATUS:-0} in \
 
238
              0) ;; \
 
239
              1) if [ -n "$$IGNORE_MANIFEST_CHANGES" ]; then \
 
240
                   echo 'MANIFEST check failed; ignoring problem because \$$IGNORE_MANIFEST_CHANGES set' >&2; \
 
241
                   echo 'Please ensure that the package maintainer has an up-to-date version of the' >&2; \
 
242
                   echo 'MANIFEST.$(ARCH).in file.' >&2; \
 
243
                 else \
 
244
                   echo 'MANIFEST check failed; please see debian/README' >&2; \
 
245
                   exit 1; \
 
246
                 fi; \
 
247
                 ;; \
 
248
              *) echo "diff reported unexpected exit status $$DIFFSTATUS when performing MANIFEST check" >&2; \
 
249
                 exit 1; \
 
250
                 ;; \
 
251
            esac; \
 
252
          fi; \
 
253
        fi
 
254
        >$@
 
255
 
 
256
# Because we build (and install) different files depending on whether or not
 
257
# any architecture-independent packages are being created, the list of files we
 
258
# expect to see will differ; see the discussion of the "build" target above.
 
259
.PHONY: check-manifest-arch check-manifest-indep
 
260
check-manifest-arch: IMAKE_DEFINES+= -DBuildSpecsDocs=NO -DBuildFonts=NO -DInstallHardcopyDocs=NO
 
261
check-manifest-arch: check-manifest
 
262
check-manifest-indep: check-manifest
 
263
 
 
264
# Remove files from the upstream source tree that we don't need, or which have
 
265
# licensing problems.  It must be run before creating the .orig.tar.gz.
 
266
#
 
267
# Note: This rule is for Debian package maintainers' convenience, and is not
 
268
# needed for conventional build scenarios.
 
269
.PHONY: prune-upstream-tree
 
270
prune-upstream-tree:
 
271
        # Ensure we're in the correct directory.
 
272
        dh_testdir
 
273
        grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
 
274
 
 
275
# Change to what should be the correct directory, ensure it is, and if
 
276
# so, create the .orig.tar.gz file.  Exclude the debian directory and its
 
277
# contents, and any .svn directories and their contents (so that we can safely
 
278
# build an .orig.tar.gz from SVN checkout, not just an export).
 
279
#
 
280
# Note: This rule is for Debian package maintainers' convenience, and is not
 
281
# needed for conventional build scenarios.
 
282
#
 
283
# This rule *IS* the recommended method for creating a new .orig.tar.gz file,
 
284
# for the rare situations when one is needed.
 
285
.PHONY: make-orig-tar-gz
 
286
make-orig-tar-gz: clean prune-upstream-tree
 
287
        ( cd .. \
 
288
          && if [ $(shell basename $(CURDIR)) != $(SOURCE_NAME)-$(NO_EPOCH_VER) ]; then \
 
289
            echo "Our current working directory has the wrong name. Renaming..." >&2; \
 
290
                mv $(CURDIR) $(SOURCE_NAME)-$(NO_EPOCH_VER); \
 
291
          fi; \
 
292
            tar --exclude=debian --exclude=debian/* \
 
293
                --exclude=.svn --exclude=.svn/* \
 
294
                -cf - $(SOURCE_NAME)-$(NO_EPOCH_VER) \
 
295
            | gzip -9 >$(SOURCE_NAME)_$(NO_EPOCH_VER).orig.tar.gz; \
 
296
           )
 
297
 
 
298
# Verify that there are no offsets or fuzz in the patches we apply.
 
299
#
 
300
# Note: This rule is for Debian package maintainers' convenience, and is not
 
301
# needed for conventional build scenarios.
 
302
.PHONY: patch-audit
 
303
patch-audit: prepare unpatch
 
304
        @echo -n "Auditing patches..."; \
 
305
        >$(STAMP_DIR)/log/patch; \
 
306
        FUZZY=; \
 
307
        while [ -n "$$($(QUILT) next)" ]; do \
 
308
          RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
 
309
          case "$$RESULT" in \
 
310
            succeeded) \
 
311
              echo "fuzzy patch: $$($(QUILT) top)" \
 
312
                | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \
 
313
              FUZZY=yes; \
 
314
              ;; \
 
315
            FAILED) \
 
316
              echo "broken patch: $$($(QUILT) next)" \
 
317
                | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \
 
318
              exit 1; \
 
319
              ;; \
 
320
          esac; \
 
321
        done; \
 
322
        if [ -n "$$FUZZY" ]; then \
 
323
          echo "there were fuzzy patches; please fix."; \
 
324
          exit 1; \
 
325
        else \
 
326
          echo "done."; \
 
327
        fi
 
328
 
 
329
# Generate the maintainer scripts.
 
330
.PHONY: genscripts
 
331
stampdir_targets+=genscripts
 
332
genscripts: $(STAMP_DIR)/genscripts
 
333
$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir
 
334
        for FILE in debian/*.config.in \
 
335
                    debian/*.postinst.in \
 
336
                    debian/*.postrm.in \
 
337
                    debian/*.preinst.in \
 
338
                    debian/*.prerm.in; do \
 
339
          if [ -e "$$FILE" ]; then \
 
340
            MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \
 
341
            sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \
 
342
              | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \
 
343
            cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \
 
344
            sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \
 
345
              | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
 
346
            sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
 
347
                -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
 
348
                -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \
 
349
              <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
 
350
            rm $$MAINTSCRIPT.tmp; \
 
351
          fi; \
 
352
        done
 
353
        # Validate syntax of generated shell scripts.
 
354
        #sh debian/scripts/validate-posix-sh debian/*.config \
 
355
        #                                    debian/*.postinst \
 
356
        #                                    debian/*.postrm \
 
357
        #                                    debian/*.preinst \
 
358
        #                                    debian/*.prerm
 
359
        >$@
 
360
 
 
361
# Generate the shlibs.local file.
 
362
debian/shlibs.local:
 
363
        cat debian/*.shlibs >$@
 
364
 
 
365
SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null)
 
366
VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null)
 
367
INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null)
 
368
SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS))
 
369
VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI)
 
370
INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI)
 
371
ifeq ($(PACKAGE),)
 
372
PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control)
 
373
endif
 
374
 
 
375
.PHONY: serverabi
 
376
serverabi:
 
377
ifeq ($(SERVERMINVERS),)
 
378
        @echo error: xserver-xorg-dev needs to be installed
 
379
        @exit 1
 
380
else
 
381
        echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars
 
382
        echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
 
383
        echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
 
384
endif
 
385
 
 
386
include debian/xsfbs/xsfbs-autoreconf.mk
 
387
 
 
388
# vim:set noet ai sts=8 sw=8 tw=0: