debian/control: new Debian policy version
[debian-git.git] / debian / rules
blob4894bf8948dec54f6d161ad1d1c121ec174d79f5
1 #!/usr/bin/make -f
3 ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
4 BUILD_DOCS =$(shell if type asciidoc >/dev/null 2>&1; then echo 1; fi)
6 CC =gcc
7 CPPFLAGS :=$(shell dpkg-buildflags --get CPPFLAGS)
8 CFLAGS :=-Wall $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
9 LDFLAGS :=$(shell dpkg-buildflags --get LDFLAGS)
10 STRIP =strip
11 TEST =test
12 OPTS =NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core \
13 mandir=/usr/share/man htmldir=/usr/share/doc/git/html \
14 INSTALLDIRS=vendor \
15 NO_PYTHON=1 \
16 USE_SRV_RR=1 \
17 THREADED_DELTA_SEARCH=1 \
18 NO_CROSS_DIRECTORY_HARDLINKS=1 NO_HARDLINKS=1 \
19 DEFAULT_PAGER=pager DEFAULT_EDITOR=editor \
20 CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)'
21 DOC_OPTS =prefix=/usr htmldir=/usr/share/doc/git/html \
22 ASCIIDOC8=1 ASCIIDOC_NO_ROFF=1
24 ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
25 STRIP =: strip
26 endif
27 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
28 TEST =
29 endif
31 TMP =$(shell pwd)/tmp
32 GIT =$(shell pwd)/debian/git
34 patch: deb-checkdir patch-stamp
35 patch-stamp:
36 for i in `ls -1 debian/diff/*.diff debian/diff/*.patch \
37 2>/dev/null || :`; do \
38 patch -p1 -N -r- <$$i || test $$? = 1 || exit 1; \
39 done
40 touch patch-stamp
42 build: build-arch build-indep
44 build-arch: deb-checkdir build-arch-stamp
45 build-arch-stamp: patch-stamp
46 -$(CC) -v
47 DESTDIR='$(GIT)' $(MAKE) all $(OPTS)
48 test -z '$(TEST)' || \
49 DESTDIR='$(GIT)' $(MAKE) $(TEST) $(OPTS) || \
50 GIT_TEST_OPTS=--verbose DESTDIR='$(GIT)' $(MAKE) $(TEST) $(OPTS)
51 touch build-arch-stamp
53 build-indep: deb-checkdir build-indep-stamp
54 build-indep-stamp: patch-stamp build-arch-stamp
55 : 'Work around bug #478524'
56 set -e; if test '$(BUILD_DOCS)' = 1; \
57 then \
58 $(MAKE) -CDocumentation man html $(DOC_OPTS); \
60 touch build-indep-stamp
62 clean: deb-checkdir
63 $(MAKE) clean $(OPTS)
64 ! test -e patch-stamp || \
65 for i in `ls -1r debian/diff/*.diff debian/diff/*.patch \
66 2>/dev/null || :`; do \
67 patch -p1 -NR -r- <$$i || test $$? = 1 || exit 1; \
68 done
69 rm -rf '$(TMP)'
70 rm -f patch-stamp build-arch-stamp build-indep-stamp
71 rm -rf '$(GIT)' '$(GIT)'-doc '$(GIT)'-arch '$(GIT)'-cvs
72 rm -rf '$(GIT)'-svn '$(GIT)'-email '$(GIT)'-el
73 rm -rf '$(GIT)'-daemon-run '$(GIT)'-daemon-sysvinit '$(GIT)'-gui
74 rm -rf '$(GIT)'k '$(GIT)'web '$(GIT)'-all '$(GIT)'-man '$(GIT)'-core
75 rm -f debian/files debian/substvars changelog
77 install: install-arch install-indep
78 install-arch: deb-checkdir deb-checkuid build-arch-stamp
79 # git
80 rm -rf '$(GIT)'
81 install -d -m0755 '$(GIT)'/usr/bin
82 DESTDIR='$(GIT)' $(MAKE) install $(OPTS)
83 install -d -m0755 '$(GIT)'/var/cache/git
84 rm -f '$(GIT)'/usr/share/perl5/Error.pm
85 rm -rf '$(GIT)'/usr/share/man
86 chmod 644 '$(GIT)'/usr/share/perl5/Git.pm
87 # don't include arch, cvs, svn, email, gui tools, and gitk program
88 for i in git-archimport git-cvs git-svn git-send-email \
89 git-gui git-citool; do \
90 rm -f '$(GIT)'/usr/lib/git-core/$$i*; \
91 done
92 rm -f '$(GIT)'/usr/bin/git-cvsserver
93 rm -f '$(GIT)'/usr/bin/gitk
94 for i in '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*; do \
95 test -d $$i || \
96 test "`head -c2 $$i`" = '#!' || \
97 test "`head -c2 $$i`" = '# ' || \
98 $(STRIP) -R .comment -R .note $$i; \
99 done
100 # don't include git-gui's lib
101 rm -rf '$(GIT)'/usr/share/git-gui/
102 # don't include gitk's lib
103 rm -rf '$(GIT)'/usr/share/gitk/
104 # bash completion
105 install -d -m0755 '$(GIT)'/etc/bash_completion.d
106 install -m0644 contrib/completion/git-completion.bash \
107 '$(GIT)'/etc/bash_completion.d/git
108 # gitweb
109 install -d -m0755 '$(GIT)'/usr/share/gitweb
110 ln -s gitweb.cgi '$(GIT)'/usr/share/gitweb/index.cgi
111 # contrib hooks
112 install -d -m0755 '$(GIT)'/usr/share/git-core/contrib/hooks
113 install -m0644 contrib/hooks/* \
114 '$(GIT)'/usr/share/git-core/contrib/hooks/
115 # contrib
116 install -d -m0755 '$(GIT)'/usr/share/doc/git
117 cp -R contrib '$(GIT)'/usr/share/doc/git/
118 rm -rf '$(GIT)'/usr/share/doc/git/contrib/completion
119 rm -rf '$(GIT)'/usr/share/doc/git/contrib/emacs
120 find '$(GIT)'/usr/share/doc/git/contrib -type f | xargs chmod 0644
121 find '$(GIT)'/usr/share/doc/git/contrib -type d | xargs chmod 0755
122 # remove contrib hooks, they are now installed in
123 # /usr/share/git-core/contrib, keep symlink for backward compatibility
124 rm -rf '$(GIT)'/usr/share/doc/git/contrib/hooks
125 ln -s ../../../git-core/contrib/hooks \
126 '$(GIT)'/usr/share/doc/git/contrib/
127 find '$(GIT)'/usr/share/doc/git/ -name .gitignore | xargs rm -f
128 # upstream changelog
129 test -r changelog || ln -s debian/changelog.upstream changelog
131 install-indep:
132 : 'Work around bug #478524'
133 set -e; if test '$(BUILD_DOCS)' = 1; \
134 then \
135 $(MAKE) -f debian/rules install-indep-real; \
137 install-indep-real: build-arch-stamp build-indep-stamp
138 rm -rf '$(TMP)'
139 install -d -m0755 '$(TMP)'
140 DESTDIR='$(TMP)' $(MAKE) install install-doc $(OPTS)
141 $(MAKE) -CDocumentation install-webdoc WEBDOC_DEST='$(TMP)'/html \
142 2>/dev/null
143 # RelNotes are shipped in git
144 rm -rf '$(TMP)'/html/RelNotes
145 # git-man
146 rm -rf '$(GIT)'-man
147 install -d -m0755 '$(GIT)'-man/usr/share/man/man3
148 DESTDIR='$(GIT)'-man $(MAKE) install-doc $(OPTS)
149 install -m 0644 '$(TMP)'/usr/share/man/man3/Git.3pm \
150 '$(GIT)'-man/usr/share/man/man3/Git.3pm
151 rm -f '$(GIT)'-man/usr/share/man/man3/private-Error.3pm
152 # don't include arch, cvs, svn, email, gui, and gitk man pages
153 for i in git-archimport git-cvs git-svn git-send-email gitk \
154 git-gui git-citool; do \
155 rm -f '$(GIT)'-man/usr/share/man/man1/$$i*; \
156 done
157 chmod 0644 '$(GIT)'-man/usr/share/man/man?/*.[0-9]*
158 gzip -9 '$(GIT)'-man/usr/share/man/man?/*.[0-9]*
159 # git-doc
160 rm -rf '$(GIT)'-doc
161 install -d -m0755 '$(GIT)'-doc/usr/share/doc/git
162 ln -s ../git-doc '$(GIT)'-doc/usr/share/doc/git/html
163 # git-cvs, git-svn
164 for i in cvs svn; do \
165 rm -rf '$(GIT)'-$$i && \
166 install -d -m0755 '$(GIT)'-$$i/usr/lib/git-core && \
167 install -m0755 '$(TMP)'/usr/lib/git-core/git-$$i* \
168 '$(GIT)'-$$i/usr/lib/git-core/ && \
169 install -d -m0755 '$(GIT)'-$$i/usr/share/man/man1 && \
170 install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \
171 '$(GIT)'-$$i/usr/share/man/man1/ && \
172 gzip -9 '$(GIT)'-$$i/usr/share/man/man1/*.1 || exit 1; \
173 done
174 # git-cvs
175 install -d -m0755 '$(GIT)'-cvs/usr/bin
176 install -m0755 '$(TMP)'/usr/bin/git-cvsserver '$(GIT)'-cvs/usr/bin/
177 # git-arch
178 rm -rf '$(GIT)'-arch
179 install -d -m0755 '$(GIT)'-arch/usr/lib/git-core
180 install -m0755 '$(TMP)'/usr/lib/git-core/git-archimport \
181 '$(GIT)'-arch/usr/lib/git-core/
182 install -d -m0755 '$(GIT)'-arch/usr/share/man/man1
183 install -m0644 '$(TMP)'/usr/share/man/man1/git-archimport.1 \
184 '$(GIT)'-arch/usr/share/man/man1/
185 gzip -9 '$(GIT)'-arch/usr/share/man/man1/*.1
186 # git-email
187 rm -rf '$(GIT)'-email
188 install -d -m0755 '$(GIT)'-email/usr/lib/git-core
189 install -m0755 '$(TMP)'/usr/lib/git-core/git-send-email \
190 '$(GIT)'-email/usr/lib/git-core/
191 install -d -m0755 '$(GIT)'-email/usr/share/man/man1
192 install -m0644 '$(TMP)'/usr/share/man/man1/git-send-email.1 \
193 '$(GIT)'-email/usr/share/man/man1/
194 gzip -9 '$(GIT)'-email/usr/share/man/man1/*.1
195 # git-daemon-run
196 rm -rf '$(GIT)'-daemon-run
197 install -d -m0755 '$(GIT)'-daemon-run/etc/sv/git-daemon/log
198 install -m0755 debian/git-daemon/run \
199 '$(GIT)'-daemon-run/etc/sv/git-daemon/run
200 install -m0755 debian/git-daemon/log/run \
201 '$(GIT)'-daemon-run/etc/sv/git-daemon/log/run
202 # git-daemon-sysvinit
203 rm -rf '$(GIT)'-daemon-sysvinit
204 install -d -m0755 '$(GIT)'-daemon-sysvinit/etc/init.d
205 install -m0755 debian/git-daemon.init \
206 '$(GIT)'-daemon-sysvinit/etc/init.d/git-daemon
207 install -d -m0755 '$(GIT)'-daemon-sysvinit/etc/default
208 install -m0644 debian/git-daemon.default \
209 '$(GIT)'-daemon-sysvinit/etc/default/git-daemon
210 install -d -m0755 '$(GIT)'-daemon-sysvinit/usr/share/git-core/sysvinit
211 >'$(GIT)'-daemon-sysvinit/usr/share/git-core/sysvinit/sentinel
212 chmod 0644 \
213 '$(GIT)'-daemon-sysvinit/usr/share/git-core/sysvinit/sentinel
214 # git-el
215 rm -rf '$(GIT)'-el
216 install -m0644 -D debian/git-el.emacsen-startup \
217 '$(GIT)'-el/etc/emacs/site-start.d/50git-core.el
218 install -m0755 -D debian/git-el.emacsen-install \
219 '$(GIT)'-el/usr/lib/emacsen-common/packages/install/git
220 install -m0755 -D debian/git-el.emacsen-remove \
221 '$(GIT)'-el/usr/lib/emacsen-common/packages/remove/git
222 install -d -m0755 '$(GIT)'-el/usr/share/git-core/emacs
223 install -m0644 contrib/emacs/git-blame.el \
224 '$(GIT)'-el/usr/share/git-core/emacs/git-blame.el
225 install -m0644 contrib/emacs/git.el \
226 '$(GIT)'-el/usr/share/git-core/emacs/git.el
227 install -d -m0755 '$(GIT)'-el/usr/share/doc/git-el
228 ln -s ../git/README.emacs \
229 '$(GIT)'-el/usr/share/doc/git-el/README.Debian
230 install -d -m0755 '$(GIT)'-el/usr/share/doc/git/contrib
231 ln -s ../../../git-core/emacs \
232 '$(GIT)'-el/usr/share/doc/git/contrib/emacs
233 # git-gui
234 rm -rf '$(GIT)'-gui
235 install -d -m0755 '$(GIT)'-gui/usr/lib/git-core
236 install -m0755 '$(TMP)'/usr/lib/git-core/git-gui \
237 '$(GIT)'-gui/usr/lib/git-core/
238 install -m0755 '$(TMP)'/usr/lib/git-core/git-gui--askpass \
239 '$(GIT)'-gui/usr/lib/git-core/
240 install -m0755 '$(TMP)'/usr/lib/git-core/git-citool \
241 '$(GIT)'-gui/usr/lib/git-core/
242 install -d -m0755 '$(GIT)'-gui/usr/share/man/man1
243 for i in gui citool; do \
244 install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \
245 '$(GIT)'-gui/usr/share/man/man1/; \
246 done
247 gzip -9 '$(GIT)'-gui/usr/share/man/man1/*.1
248 install -d -m0755 '$(GIT)'-gui/usr/share/git-gui
249 cp -a '$(TMP)'/usr/share/git-gui/lib '$(GIT)'-gui/usr/share/git-gui/
250 # gitk
251 rm -rf '$(GIT)'k
252 install -d -m0755 '$(GIT)'k/usr/bin
253 install -m0755 '$(TMP)'/usr/bin/gitk \
254 '$(GIT)'k/usr/bin/gitk
255 install -d -m0755 '$(GIT)'k/usr/share/man/man1
256 install -m0644 '$(TMP)'/usr/share/man/man1/gitk.1 \
257 '$(GIT)'k/usr/share/man/man1/
258 gzip -9 '$(GIT)'k/usr/share/man/man1/*.1
259 install -d -m0755 '$(GIT)'k/usr/share/gitk
260 cp -a '$(TMP)'/usr/share/gitk/lib '$(GIT)'k/usr/share/gitk/
261 # gitweb
262 rm -rf '$(GIT)'web
263 install -d -m0755 '$(GIT)'web/usr/lib/cgi-bin
264 ln -s ../../share/gitweb/gitweb.cgi \
265 '$(GIT)'web/usr/lib/cgi-bin/gitweb.cgi
266 install -d -m0755 '$(GIT)'web/etc
267 install -m0644 debian/gitweb.conf '$(GIT)'web/etc/gitweb.conf
268 install -d -m0755 '$(GIT)'web/etc/apache2/conf.d
269 install -m0644 debian/gitweb.apache2.conf \
270 '$(GIT)'web/etc/apache2/conf.d/gitweb
271 # git-all
272 rm -rf '$(GIT)'-all
273 install -d -m0755 '$(GIT)'-all
274 # git-core
275 rm -rf '$(GIT)'-core
276 install -d -m0755 '$(GIT)'-core/usr/share/doc
277 ln -s git '$(GIT)'-core/usr/share/doc/git-core
278 # upstream changelog
279 test -r changelog || ln -s debian/changelog.upstream changelog
281 binary: binary-arch binary-indep
282 binary-arch: install-arch git.deb
283 rm -f debian/substvars
284 dpkg-shlibdeps '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*
285 dpkg-gencontrol -isp -pgit -P'$(GIT)'
286 dpkg -b '$(GIT)' ..
287 binary-indep: install-indep git-doc.deb git-arch.deb git-cvs.deb git-svn.deb \
288 git-daemon-run.deb git-daemon-sysvinit.deb \
289 git-email.deb git-gui.deb gitk.deb gitweb.deb \
290 git-all.deb git-el.deb git-man.deb git-core.deb-DEBIAN
291 rm -f debian/substvars
292 for i in -doc -arch -cvs -svn -daemon-run -daemon-sysvinit \
293 -email -gui k web -all -core -el -man; do \
294 dpkg-gencontrol -isp -pgit$$i -P'$(GIT)'$$i && \
295 dpkg -b '$(GIT)'$$i .. || exit 1; \
296 done
298 .PHONY: patch clean
299 .PHONY: build build-arch build-indep
300 .PHONY: install install-arch install-indep install-indep-real
301 .PHONY: binary binary-arch binary-indep
303 include debian/implicit