~ubuntu-branches/ubuntu/trusty/librep/trusty

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-01-14 14:18:11 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050114141811-k2x3wczuc17qai2v
Tags: 0.17-7
Build with -Oo for amd64

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/make -f
2
 
#-*- makefile -*-
3
 
 
4
 
export DH_COMPAT=3
5
 
 
6
 
# Patches applied in this order.
7
 
debian_patches = news.texi
8
 
 
9
 
ARCH = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
10
 
 
11
 
version := $(shell sed -n 's/Package: \(.*\)/\1/p' debian/control | head -1)
12
 
 
13
 
# Uncomment this to turn on verbose mode. 
 
2
 
14
3
#export DH_VERBOSE=1
15
4
 
 
5
version := $(shell sed -n 's/Package: \(.*\)/\1/p' debian/control | head -n 1)
 
6
 
 
7
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
8
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
9
 
 
10
CFLAGS = -Wall -g
 
11
 
 
12
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 
13
        CFLAGS += -O0
 
14
else
 
15
        CFLAGS += -O2
 
16
endif
 
17
 
 
18
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),m68k))
 
19
        CFLAGS = -Wall -g -O0
 
20
endif
 
21
 
 
22
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),amd64))
 
23
        CFLAGS = -Wall -g -O0
 
24
endif
 
25
 
 
26
configure: configure-stamp
 
27
configure-stamp: patch-stamp
 
28
        dh_testdir
 
29
 
 
30
        ./configure --prefix=/usr --libexecdir=/usr/lib --mandir=/usr/share/man \
 
31
        --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
 
32
        --with-readline CFLAGS="$(CFLAGS)"
 
33
 
 
34
        touch configure-stamp
 
35
 
16
36
build: build-stamp
17
 
build-stamp: patched-stamp
 
37
build-stamp: configure-stamp
18
38
        dh_testdir
19
39
 
20
 
        cp /usr/share/misc/config.guess /usr/share/misc/config.sub .
 
40
        LC_ALL=C $(MAKE)
21
41
 
22
 
        ./configure --prefix=/usr --libexecdir=/usr/lib \
23
 
        --mandir=/usr/share/man --with-readline $(ARCH)
24
 
        LC_ALL=C $(MAKE) -j 2
25
42
        touch build-stamp
26
43
 
27
44
clean:
28
45
        dh_testdir
29
46
        dh_testroot
30
 
        rm -f build-stamp install-stamp
31
 
        -$(MAKE) realclean
32
 
 
33
 
        debian/rules reverse-patches
34
 
 
35
 
        dh_clean src/rep-xgettext debian/librep-dev.files \
36
 
        config.guess config.sub config.cache *.1 manpage.links manpage.refs
37
 
 
38
 
install: install-stamp
39
 
install-stamp: build-stamp
 
47
        rm -f build-stamp configure-stamp
 
48
 
 
49
        [ ! -f Makefile ] || $(MAKE) realclean
 
50
 
 
51
        debian/rules unpatch
 
52
 
 
53
        dh_clean src/rep-xgettext debian/librep-dev.files
 
54
 
 
55
install: build
40
56
        dh_testdir
41
57
        dh_testroot
42
58
        dh_clean -k
43
59
        dh_installdirs
44
60
 
45
61
        $(MAKE) install DESTDIR=`pwd`/debian/${version}
46
 
        # dh_installinfo will deal with this
 
62
 
47
63
        -rm -rf debian/${version}/usr/info
48
64
 
49
65
        -rm debian/librep-dev.files
53
69
 
54
70
        dh_movefiles --sourcedir=debian/${version}
55
71
 
 
72
#       cp /usr/bin/libtool debian/librep-dev/usr/lib/rep/*/
 
73
 
56
74
# Intall lintian override file
57
 
 
58
75
        cp debian/librep9.lintian debian/${version}/usr/share/lintian/overrides/librep9
59
76
 
60
 
# Build manpages
61
 
        for file in debian/*.sgml; do \
62
 
        basefile=`basename $$file .sgml`; \
63
 
        docbook2man $$file; \
64
 
        done
65
 
 
66
77
# Prune empty directories in debian/${version}
67
78
        -find debian/${version}  -type d | xargs rmdir -p --ignore-fail-on-non-empty
68
79
 
72
83
        dh_testdir -i
73
84
        dh_testroot -i
74
85
        dh_installdocs -i
75
 
        dh_installinfo -prep-doc
76
 
#       dh_installinfo -n -prep-doc
77
 
#       dh_installexamples -i
78
 
#       dh_installmenu -i
 
86
        dh_installinfo -i
79
87
        dh_installman -i
80
 
        dh_undocumented
81
88
        dh_installchangelogs -i NEWS
82
89
        dh_link -i
83
90
        dh_compress -i
91
98
        dh_testdir -a
92
99
        dh_testroot -a
93
100
        dh_installdocs -A
94
 
#       dh_installexamples -a
95
 
#       dh_installmenu -a
96
101
        dh_installman -a
97
 
#       dh_undocumented
98
102
        dh_installchangelogs -prep NEWS
99
103
        rm -rf debian/librep-dev/usr/share/doc
100
104
        rm -rf debian/${version}/usr/share/doc
104
108
        dh_fixperms -a
105
109
        dh_makeshlibs -p${version} -V 'librep9 (>= 0.15.1)'
106
110
        dh_installdeb -a
107
 
#       dh_perl -a
108
111
        dh_shlibdeps -a -ldebian/${version}/usr/lib
109
112
        dh_gencontrol -a
110
113
        dh_md5sums -a
111
114
        dh_builddeb -a
112
115
 
113
116
binary: binary-indep binary-arch
114
 
.PHONY: build clean binary-indep binary-arch binary
115
 
 
116
 
# ---------------------------------------------------------------------------
117
 
# various rules to unpack addons and (un)apply patches.
118
 
# borrowed from egcs package
119
 
 
120
 
patch_dir       = debian/patches
121
 
 
122
 
apply-patches: patched-stamp
123
 
reverse-patches:
124
 
        @for stamp in none patched-*; do \
125
 
          case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
126
 
          patch=`echo $$stamp | sed -e 's/patched-//'`; \
127
 
          echo "trying to revert patch $$patch ..."; \
128
 
          if [ -x $(patch_dir)/$$patch.dpatch ]; then true; else \
129
 
            chmod +x $(patch_dir)/$$patch.dpatch; fi; \
130
 
          if $(patch_dir)/$$patch.dpatch -unpatch; then \
131
 
            echo "reverted $$patch patch."; \
132
 
            rm -f $$stamp; \
133
 
          else \
134
 
            echo "error in reverting $$patch patch."; \
135
 
            exit 1; \
136
 
          fi; \
137
 
        done
138
 
        @echo "Removing patched-stamp"
139
 
        @rm -f patched-stamp
140
 
 
141
 
patched-%: $(patch_dir)/%.dpatch
142
 
        @if [ -x $< ]; then true; else chmod +x $<; fi
143
 
        @if [ -f $@ ]; then \
144
 
          echo "$* patches already applied."; exit 1; \
145
 
        fi
146
 
        $< -patch
147
 
        @echo "$* patches applied." > $@
148
 
 
149
 
patched-stamp: $(foreach p,$(debian_patches),patched-$(p))
150
 
        @echo -e "\nPatches applied:" >> pxxx
151
 
        @for i in none $(debian_patches); do \
152
 
          if [ -r debian/patches/$$i.dpatch ]; then \
153
 
            echo -e "\n$$i:" >> pxxx; \
154
 
            sed -n 's/^# *DP: */  /p' debian/patches/$$i.dpatch >> pxxx; \
155
 
          fi \
156
 
        done
157
 
        @echo "Writing patched-stamp"
158
 
        @mv -f pxxx patched-stamp
 
117
.PHONY: build clean binary-indep binary-arch binary install configure patch unpatch
 
118
 
 
119
DPATCH_ARCH      = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
120
PATCHLIST_ALL    = $(shell cat debian/patches/00list)
 
121
PATCHLIST_ARCH   = $(shell cat debian/patches/00list.${DPATCH_ARCH} 2>/dev/null)
 
122
PATCHLIST       ?= $(sort ${PATCHLIST_ALL} ${PATCHLIST_ARCH})
 
123
 
 
124
UNPATCHLIST      = $(shell echo ${PATCHLIST} | tr ' ' '\n' | tac)
 
125
 
 
126
patch: patch-stamp
 
127
patch-stamp:
 
128
        test -d debian/patched || install -d debian/patched
 
129
        @echo "Patches applied in the Debian version of ${PACKAGE}:" > $@T
 
130
        @for patch in ${PATCHLIST}; do \
 
131
                  stamp=debian/patched/$$patch.dpatch; \
 
132
                  patch=debian/patches/$$patch.dpatch; \
 
133
                  author=`sed -n "s,^#* *.*dpatch by *,,p" $$patch`; \
 
134
                  test -x $$patch || chmod +x $$patch; \
 
135
                if test -f $$stamp; then \
 
136
                           echo "$$patch already applied."; \
 
137
                           echo -e "\n$$patch ($$author):" >> $@T; \
 
138
                           sed -n 's/^#* *DP: */  /p' $$patch >> $@T; \
 
139
                  else \
 
140
                           echo -n "applying patch $$patch..."; \
 
141
                           if $$patch -patch >$$stamp.new 2>&1; then \
 
142
                                    mv $$stamp.new $$stamp; \
 
143
                                    touch $$stamp; \
 
144
                                    echo -e "\n$$patch ($$author):" >> $@T; \
 
145
                                    sed -n 's/^#* *DP: */  /p' $$patch >> $@T; \
 
146
                                    echo " ok."; \
 
147
                           else \
 
148
                                    echo " failed."; \
 
149
                                    exit 1; \
 
150
                           fi; \
 
151
                  fi; \
 
152
        done
 
153
        mv -f $@T $@
 
154
 
 
155
unpatch:
 
156
        @for patch in ${UNPATCHLIST}; do \
 
157
                  stamp=debian/patched/$$patch.dpatch; \
 
158
                  patch=debian/patches/$$patch.dpatch; \
 
159
                  test -x $$patch || chmod +x $$patch; \
 
160
                  if test -f $$stamp; then \
 
161
                           echo -n "reverting patch $$patch..."; \
 
162
                           if $$patch -unpatch 2>&1 >/dev/null; then \
 
163
                                    rm -f $$stamp; \
 
164
                                    echo " ok."; \
 
165
                           else \
 
166
                                    echo " failed."; \
 
167
                                    exit 1; \
 
168
                           fi; \
 
169
                  fi; \
 
170
        done
 
171
        rm -rf patch-stamp debian/patched