~ubuntu-branches/ubuntu/karmic/quilt/karmic

« back to all changes in this revision

Viewing changes to debian/patchsys-quilt.mk

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Hertzog
  • Date: 2008-06-19 21:40:27 UTC
  • mfrom: (4.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080619214027-so7yis356zayzu1c
Tags: 0.46-6
Change back patchsys-quilt.mk to enter DEB_SRCDIR by default before
applying patches (8 packages FTBFS due to this change). But we can now
use DEB_QUILT_TOPDIR to override the default choice of DEB_SRCDIR.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- mode: makefile; coding: utf-8 -*-
2
 
# Copyright � 2003 Martin Quinson <martin.quinson@tuxfamily.org>
 
2
# Copyright © 2003 Martin Quinson <martin.quinson@tuxfamily.org>
3
3
# Description: An advanced patch system based on the quilt facilities.
4
4
#  please refere to the documentation of the quilt package for more information.
5
5
#
38
38
include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
39
39
 
40
40
DEB_SRCDIR ?= .
41
 
 
42
41
_cdbs_patch_system_apply_rule := apply-patches
43
42
_cdbs_patch_system_unapply_rule := reverse-patches
44
43
 
 
44
# standard targets, as recommended by Debian policy 3.8.0
 
45
.PHONY: patch unpatch
 
46
patch: apply-patches
 
47
unpatch: reverse-patches
 
48
 
45
49
# DEB_PATCHDIRS: directory containing your source file for patches.
46
 
DEB_PATCHDIRS = $(shell pwd)/debian/patches
 
50
#
 
51
# You might find it convenient to add the snippet below to your
 
52
# $HOME/.quiltrc so that you can use quilt without having to reset
 
53
# QUILT_PATCHES when you switch from one project to the other:
 
54
# for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
 
55
#        if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
 
56
#                export QUILT_PATCHES=debian/patches
 
57
#        fi
 
58
# done
 
59
DEB_PATCHDIRS = $(CURDIR)/debian/patches
47
60
 
48
 
# DEB_QUILT_PATCHDIR_LINK
49
 
# By default, quilt expects to find the patch files into the /patches directory.
50
 
#  Since it is often more pleasant to place them into /debian/patches, a link
51
 
#  is created by this makefile chunk to fix it. 
52
 
# In the case where you already have a /patches directory in your package, 
53
 
#  redefine this variable to somewhere else, and set QUILT_PATCHES in your
54
 
#   $HOME/.quiltrc (so that quilt knows where to search for this)
55
 
DEB_QUILT_PATCHDIR_LINK = patches
 
61
# DEB_QUILT_TOPDIR: directory where patches will be applied
 
62
# Use it only to override back to "." when CDBS sets DEB_SRCDIR
 
63
# and you don't want the quilt patching to happen in a subdirectory
 
64
DEB_QUILT_TOPDIR ?= $(DEB_SRCDIR)
56
65
 
57
66
# Internal variables, do not change it unless you know what you're doing
58
 
DEB_QUILT_CMD = cd $(DEB_SRCDIR) && $(if $(DEB_QUILT_PATCHDIR_LINK),QUILT_PATCHES=$(DEB_QUILT_PATCHDIR_LINK)) quilt --quiltrc /dev/null
 
67
DEB_QUILT_CMD = cd $(DEB_QUILT_TOPDIR) && QUILT_PATCHES=$(DEB_PATCHDIRS) quilt --quiltrc /dev/null
59
68
 
60
69
# Declare Build-Dep of packages using this file onto quilt
61
70
CDBS_BUILD_DEPENDS      := $(CDBS_BUILD_DEPENDS), quilt
67
76
CDBS_BUILD_DEPENDS      := $(CDBS_BUILD_DEPENDS), patchutils (>= 0.2.25)
68
77
 
69
78
# target reverse-config, which we use, don't exist in old cdbs 
70
 
CDBS_BUILD_DEPENDS      := $(CDBS_BUILD_DEPENDS), cdbs (>= 0.4.27-1)
 
79
CDBS_BUILD_DEPENDS      := $(CDBS_BUILD_DEPENDS), cdbs (>= 0.4.27)
71
80
 
72
81
evil_patches_that_do_nasty_things := $(shell \
73
82
if lsdiff=`which lsdiff` ; then \
74
83
  patchlist=`$(DEB_QUILT_CMD) series \
75
 
               | sed 's|^|$(if $(DEB_QUILT_PATCHDIR_LINK),$(DEB_QUILT_PATCHDIR_LINK)/)|' \
 
84
               | sed 's|^|$(DEB_PATCHDIRS)/|' \
76
85
               | tr "\n" " "`; \
77
86
  if [ "x$$patchlist" != x ] ; then \
78
87
    $$lsdiff -H $$patchlist \
91
100
# The patch subsystem
92
101
apply-patches: pre-build debian/stamp-patched
93
102
debian/stamp-patched:
94
 
        # reverse-config must be first
 
103
# reverse-config must be first
95
104
        $(MAKE) -f debian/rules reverse-config
96
105
        
97
 
        if [ -n "$(DEB_QUILT_PATCHDIR_LINK)" ] ; then \
98
 
          if [ -L $(DEB_SRCDIR)/$(DEB_QUILT_PATCHDIR_LINK) ] ; then : ; else \
99
 
            (cd $(DEB_SRCDIR); ln -s $(DEB_PATCHDIRS) $(DEB_QUILT_PATCHDIR_LINK)) ; \
100
 
          fi ; \
101
 
        fi
102
 
        # quilt exits with 2 as return when there was nothing to do. 
103
 
        # That's not an error here (but it's usefull to break loops in crude scripts)
 
106
# quilt exits with 2 as return when there was nothing to do. 
 
107
# That's not an error here (but it's usefull to break loops in crude scripts)
104
108
        $(DEB_QUILT_CMD) push -a || test $$? = 2
105
109
        touch debian/stamp-patched
106
110
        
107
111
        $(MAKE) -f debian/rules update-config
108
 
        # update-config must be last
 
112
# update-config must be last
109
113
 
110
114
reverse-patches:
111
 
        # reverse-config must be first
 
115
# reverse-config must be first
112
116
        $(MAKE) -f debian/rules reverse-config
113
117
        
114
 
        if [ -d "$(DEB_SRCDIR)" ] ; then \
 
118
        if [ -d "$(DEB_QUILT_TOPDIR)" ]; then \
115
119
          $(DEB_QUILT_CMD) pop -a -R || test $$? = 2 ; \
116
 
        fi 
117
 
        if [ -n "$(DEB_QUILT_PATCHDIR_LINK)" ] ; then \
118
 
          if [ -L $(DEB_SRCDIR)/$(DEB_QUILT_PATCHDIR_LINK) ] ; then \
119
 
            rm $(DEB_SRCDIR)/$(DEB_QUILT_PATCHDIR_LINK) ; \
120
 
          fi ; \
121
120
        fi
122
 
        rm -rf $(DEB_SRCDIR)/.pc
 
121
        rm -rf $(DEB_QUILT_TOPDIR)/.pc
123
122
        rm -f debian/stamp-patch*
124
123
 
125
124
endif