~ubuntu-branches/ubuntu/edgy/libxpm/edgy

« back to all changes in this revision

Viewing changes to debian/xsfbs/xsfbs.mk

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-07 17:17:09 UTC
  • Revision ID: james.westby@ubuntu.com-20060707171709-3rl3yutfv3gkawmu
Tags: 1:3.5.4.2-3ubuntu1
* Manual sync from Debian (same orig.tar.gz, different md5sum)
* Dropped APP_MAN_SUFFIX changes (they must be implemented correctly and
  directly in Debian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make -f
 
2
# $Id: rules 593 2005-09-03 20:48:30Z dnusinow $
 
3
 
 
4
# Debian rules file for xorg-x11 source package
 
5
 
 
6
# Copyright 1996 Stephen Early
 
7
# Copyright 1997 Mark Eichin
 
8
# Copyright 1998-2005 Branden Robinson
 
9
# Copyright 2005 David Nusinow
 
10
#
 
11
# Licensed under the GNU General Public License, version 2.  See the file
 
12
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
 
13
 
 
14
# Originally by Stephen Early <sde1000@debian.org>
 
15
# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
 
16
# Modified by Adam Heath <doogie@debian.org>
 
17
# Modified by Branden Robinson <branden@debian.org>
 
18
# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
 
19
# Modified by David Nusinow <dnusinow@debian.org>
 
20
# Acknowledgements to Manoj Srivastava.
 
21
 
 
22
# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
 
23
export DH_OPTIONS
 
24
 
 
25
# Set up parameters for the upstream build environment.
 
26
 
 
27
# Determine (source) package name from Debian changelog.
 
28
SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
 
29
                        | grep '^Source:' | awk '{print $$2}')
 
30
 
 
31
# Determine package version from Debian changelog.
 
32
SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
 
33
                        | grep '^Version:' | awk '{print $$2}')
 
34
 
 
35
# Determine upstream version number.
 
36
UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//')
 
37
 
 
38
# Determine the source version without the epoch for make-orig-tar-gz
 
39
NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://')
 
40
 
 
41
# Figure out who's building this package.
 
42
BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
 
43
 
 
44
# 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
 
46
# 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)
 
48
 
 
49
# Set up parameters for the Debian build environment.
 
50
 
 
51
# Determine our architecture.
 
52
BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
53
# Work around some old-time dpkg braindamage.
 
54
BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH))
 
55
# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
 
56
ifdef DEB_HOST_ARCH
 
57
 ARCH:=$(DEB_HOST_ARCH)
 
58
else
 
59
 # dpkg-cross sets the ARCH environment variable; if set, use it.
 
60
 ifdef ARCH
 
61
  ARCH:=$(ARCH)
 
62
 else
 
63
  ARCH:=$(BUILD_ARCH)
 
64
 endif
 
65
endif
 
66
 
 
67
# $(STAMP_DIR) houses stamp files for complex targets.
 
68
STAMP_DIR:=stampdir
 
69
 
 
70
# $(SOURCE_DIR) houses one or more source trees.
 
71
SOURCE_DIR:=build-tree
 
72
 
 
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
 
79
 
 
80
# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
 
81
# their files.
 
82
DEBTREEDIR:=$(CURDIR)/debian/tmp
 
83
 
 
84
# All "important" targets have four lines:
 
85
#   1) A target name that is invoked by a package-building tool or the user.
 
86
#      This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart.
 
87
#   2) A line delcaring 1) as a phony target (".PHONY:").
 
88
#   3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may
 
89
#   depend on other targets.
 
90
#   4) A line declaring 3) as a member of the $(stampdir_targets) variable; the
 
91
#   "$(STAMP_DIR)/" prefix is omitted.
 
92
#
 
93
# This indirection is needed so that the "stamp" files that signify when a rule
 
94
# is done can be located in a separate "stampdir".  Recall that make has no way
 
95
# to know when a goal has been met for a phony target (like "build" or
 
96
# "install").
 
97
#
 
98
# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@"
 
99
# so that the target will not be run again.  Removing the file will make Make
 
100
# run the target over.
 
101
 
 
102
# All phony targets should be declared as dependencies of .PHONY, even if they
 
103
# do not have "($STAMP_DIR)/"-prefixed counterparts.
 
104
 
 
105
# Define a harmless default rule to keep things from going nuts by accident.
 
106
.PHONY: default
 
107
default:
 
108
 
 
109
# Set up the $(STAMP_DIR) directory.
 
110
.PHONY: stampdir
 
111
stampdir_targets+=stampdir
 
112
stampdir: $(STAMP_DIR)/stampdir
 
113
$(STAMP_DIR)/stampdir:
 
114
        mkdir $(STAMP_DIR)
 
115
        >$@
 
116
 
 
117
# Set up the package build directory as quilt expects to find it.
 
118
.PHONY: prepare
 
119
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; \
 
126
        fi; \
 
127
        if [ ! -e $(STAMP_DIR)/log ]; then \
 
128
                mkdir $(STAMP_DIR)/log; \
 
129
        fi; \
 
130
        if [ ! -e patches ]; then \
 
131
                ln -s debian/patches patches; \
 
132
        fi; \
 
133
        >$@
 
134
 
 
135
# Apply all patches to the upstream source.
 
136
.PHONY: patch
 
137
stampdir_targets+=patch
 
138
patch: $(STAMP_DIR)/patch
 
139
$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
 
140
        if ! [ `which quilt` ]; then \
 
141
                echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
 
142
                exit 1; \
 
143
        fi; \
 
144
        if quilt next; then \
 
145
          echo -n "Applying patches..."; \
 
146
          if quilt push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
 
147
            echo "successful."; \
 
148
          else \
 
149
            echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
 
150
            exit 1; \
 
151
          fi; \
 
152
        else \
 
153
          echo "No patches to apply"; \
 
154
        fi; \
 
155
        >$@
 
156
 
 
157
# Revert all patches to the upstream source.
 
158
.PHONY: unpatch
 
159
unpatch:
 
160
        rm -f $(STAMP_DIR)/patch
 
161
        @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 \
 
164
            echo "successful."; \
 
165
          else \
 
166
            echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
 
167
            exit 1; \
 
168
          fi; \
 
169
        else \
 
170
          echo "nothing to do."; \
 
171
        fi
 
172
 
 
173
# Clean the generated maintainer scripts.
 
174
.PHONY: cleanscripts
 
175
cleanscripts:
 
176
        rm -f $(STAMP_DIR)/genscripts
 
177
        rm -f debian/*.config \
 
178
              debian/*.postinst \
 
179
              debian/*.postrm \
 
180
              debian/*.preinst \
 
181
              debian/*.prerm
 
182
 
 
183
# Clean the package build tree.
 
184
.PHONY: xsfclean
 
185
xsfclean: cleanscripts unpatch
 
186
        dh_testdir
 
187
        rm -f .pc patches
 
188
        rm -rf $(STAMP_DIR) $(SOURCE_DIR)
 
189
        rm -rf imports
 
190
        dh_clean debian/shlibs.local \
 
191
                 debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new \
 
192
                 debian/po/pothead
 
193
 
 
194
# Generate the debconf templates POT file header.
 
195
debian/po/pothead: debian/po/pothead.in
 
196
        sed -e 's/SOURCE_VERSION/$(SOURCE_VERSION)/' \
 
197
          -e 's/DATE/$(shell date "+%F %X%z"/)' <$< >$@
 
198
 
 
199
# Update POT and PO files.
 
200
.PHONY: updatepo
 
201
updatepo: debian/po/pothead
 
202
        debian/scripts/debconf-updatepo --pot-header=pothead --verbose
 
203
 
 
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
 
210
        # Compare manifests.
 
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); \
 
218
        else \
 
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); \
 
221
          else \
 
222
            LC_ALL=C sort -u debian/MANIFEST.$(ARCH).in debian/MANIFEST.all >debian/MANIFEST.$(ARCH); \
 
223
          fi; \
 
224
        fi
 
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 \
 
230
              0) ;; \
 
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; \
 
235
                 else \
 
236
                   echo 'MANIFEST check failed; please see debian/README' >&2; \
 
237
                   exit 1; \
 
238
                 fi; \
 
239
                 ;; \
 
240
              *) echo "diff reported unexpected exit status $$DIFFSTATUS when performing MANIFEST check" >&2; \
 
241
                 exit 1; \
 
242
                 ;; \
 
243
            esac; \
 
244
          fi; \
 
245
        fi
 
246
        >$@
 
247
 
 
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
 
255
 
 
256
# Remove files from the upstream source tree that we don't need, or which have
 
257
# licensing problems.  It must be run before creating the .orig.tar.gz.
 
258
#
 
259
# Note: This rule is for Debian package maintainers' convenience, and is not
 
260
# needed for conventional build scenarios.
 
261
.PHONY: prune-upstream-tree
 
262
prune-upstream-tree:
 
263
        # Ensure we're in the correct directory.
 
264
        dh_testdir
 
265
        grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
 
266
 
 
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).
 
271
#
 
272
# Note: This rule is for Debian package maintainers' convenience, and is not
 
273
# needed for conventional build scenarios.
 
274
#
 
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
 
279
        ( cd .. \
 
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); \
 
283
          fi; \
 
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; \
 
288
           )
 
289
 
 
290
# Verify that there are no offsets or fuzz in the patches we apply.
 
291
#
 
292
# Note: This rule is for Debian package maintainers' convenience, and is not
 
293
# needed for conventional build scenarios.
 
294
.PHONY: patch-audit
 
295
patch-audit: prepare unpatch
 
296
        @echo -n "Auditing patches..."; \
 
297
        >$(STAMP_DIR)/log/patch; \
 
298
        FUZZY=; \
 
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/');\
 
301
          case "$$RESULT" in \
 
302
            succeeded) \
 
303
              echo "fuzzy patch: $$(quilt top)" \
 
304
                | tee -a $(STAMP_DIR)/log/$$(quilt top); \
 
305
              FUZZY=yes; \
 
306
              ;; \
 
307
            FAILED) \
 
308
              echo "broken patch: $$(quilt next)" \
 
309
                | tee -a $(STAMP_DIR)/log/$$(quilt next); \
 
310
              exit 1; \
 
311
              ;; \
 
312
          esac; \
 
313
        done; \
 
314
        if [ -n "$$FUZZY" ]; then \
 
315
          echo "there were fuzzy patches; please fix."; \
 
316
          exit 1; \
 
317
        else \
 
318
          echo "done."; \
 
319
        fi
 
320
 
 
321
# Generate the maintainer scripts.
 
322
.PHONY: genscripts
 
323
stampdir_targets+=genscripts
 
324
genscripts: $(STAMP_DIR)/genscripts
 
325
$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir
 
326
        for FILE in debian/*.config.in \
 
327
                    debian/*.postinst.in \
 
328
                    debian/*.postrm.in \
 
329
                    debian/*.preinst.in \
 
330
                    debian/*.prerm.in; do \
 
331
          if [ -e "$$FILE" ]; then \
 
332
            MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \
 
333
            sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \
 
334
              | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \
 
335
            cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \
 
336
            sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \
 
337
              | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
 
338
            sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
 
339
                -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
 
340
                -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \
 
341
              <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
 
342
            rm $$MAINTSCRIPT.tmp; \
 
343
          fi; \
 
344
        done
 
345
        # Validate syntax of generated shell scripts.
 
346
        #sh debian/scripts/validate-posix-sh debian/*.config \
 
347
        #                                    debian/*.postinst \
 
348
        #                                    debian/*.postrm \
 
349
        #                                    debian/*.preinst \
 
350
        #                                    debian/*.prerm
 
351
        >$@
 
352
 
 
353
# Generate the shlibs.local file.
 
354
debian/shlibs.local:
 
355
        cat debian/*.shlibs >$@
 
356
 
 
357
include debian/xsfbs/xsfbs-autoreconf.mk
 
358
 
 
359
# vim:set noet ai sts=8 sw=8 tw=0: