debian: change projectroot to /var/lib/git
[git/debian.git] / debian / rules
blob37381e8b8fe8a50447cecec95796c2f3206daade
1 #!/usr/bin/make -f
3 ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
5 CC =gcc
6 CPPFLAGS :=$(shell dpkg-buildflags --get CPPFLAGS)
7 CFLAGS :=-Wall $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
8 LDFLAGS :=$(shell dpkg-buildflags --get LDFLAGS)
9 STRIP =strip
10 TEST =test
11 OPTS =NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core \
12 mandir=/usr/share/man htmldir=/usr/share/doc/git/html \
13 INSTALLDIRS=vendor \
14 NO_PYTHON=1 \
15 USE_SRV_RR=1 \
16 USE_LIBPCRE=1 \
17 THREADED_DELTA_SEARCH=1 \
18 NO_CROSS_DIRECTORY_HARDLINKS=1 NO_INSTALL_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
30 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
31 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
32 MAKEFLAGS += -j$(NUMJOBS)
33 endif
35 PKG_INDEP =
36 PKG_INDEP += git-doc
37 PKG_INDEP += git-arch
38 PKG_INDEP += git-bzr
39 PKG_INDEP += git-cvs
40 PKG_INDEP += git-svn
41 PKG_INDEP += git-daemon-run
42 PKG_INDEP += git-daemon-sysvinit
43 PKG_INDEP += git-email
44 PKG_INDEP += git-gui
45 PKG_INDEP += gitk
46 PKG_INDEP += gitweb
47 PKG_INDEP += git-all
48 PKG_INDEP += git-el
49 PKG_INDEP += git-man
51 TMP =$(shell pwd)/tmp
52 GIT =$(shell pwd)/debian/git
54 patch: deb-checkdir patch-stamp
55 patch-stamp:
56 for i in `ls -1 debian/diff/*.diff debian/diff/*.patch \
57 2>/dev/null || :`; do \
58 patch -p1 -N -r- <$$i || test $$? = 1 || exit 1; \
59 done
60 touch patch-stamp
62 build: build-arch build-indep
64 build-arch: deb-checkdir build-arch-stamp
65 build-arch-stamp: patch-stamp
66 -$(CC) -v
67 DESTDIR='$(GIT)' $(MAKE) all $(OPTS)
68 test -z '$(TEST)' || \
69 DESTDIR='$(GIT)' $(MAKE) $(TEST) $(OPTS) || \
70 GIT_TEST_OPTS=--verbose DESTDIR='$(GIT)' $(MAKE) $(TEST) $(OPTS)
71 touch build-arch-stamp
73 build-indep: deb-checkdir build-indep-stamp
74 build-indep-stamp: patch-stamp build-arch-stamp
75 $(MAKE) -CDocumentation man html $(DOC_OPTS)
76 $(MAKE) -CDocumentation $(DOC_OPTS) \
77 MAN_TXT=../debian/git-remote-bzr.txt \
78 ../debian/git-remote-bzr.1 \
79 ../debian/git-remote-bzr.html
80 sed -e 's,/usr/bin/env python,/usr/bin/python,' \
81 contrib/remote-helpers/git-remote-bzr >debian/git-remote-bzr
82 sed -e 's/test_have_prereq PYTHON/true/' \
83 contrib/remote-helpers/test-bzr.sh >debian/test-bzr.sh
84 chmod +x debian/git-remote-bzr debian/test-bzr.sh
85 test -z '$(TEST)' || \
86 PATH=$(CURDIR)/debian:$(PATH) \
87 $(MAKE) -C t $(OPTS) $(CURDIR)/debian/test-bzr.sh || \
88 PATH=$(CURDIR)/debian:$(PATH) GIT_TEST_OPTS=--verbose \
89 $(MAKE) -C t $(OPTS) $(CURDIR)/debian/test-bzr.sh
90 touch build-indep-stamp
92 clean: deb-checkdir
93 rm -f debian/git-remote-bzr debian/test-bzr.sh
94 rm -f debian/git-remote-bzr.xml debian/git-remote-bzr.html
95 rm -f Documentation/git-remote-bzr.1
96 $(MAKE) clean $(OPTS)
97 ! test -e patch-stamp || \
98 for i in `ls -1r debian/diff/*.diff debian/diff/*.patch \
99 2>/dev/null || :`; do \
100 patch -p1 -NR -r- <$$i || test $$? = 1 || exit 1; \
101 done
102 rm -rf '$(TMP)'
103 rm -f patch-stamp build-arch-stamp build-indep-stamp
104 set -e; \
105 for i in '' $(patsubst git%,%,$(PKG_INDEP)) -core; do \
106 rm -rf '$(GIT)'$$i; \
107 done
108 rm -f debian/files debian/substvars
110 install: install-arch install-indep
111 git.install: install-arch
112 install-arch: deb-checkdir deb-checkuid build-arch-stamp
113 # git
114 rm -rf '$(GIT)'
115 install -d -m0755 '$(GIT)'/usr/bin
116 DESTDIR='$(GIT)' $(MAKE) install $(OPTS)
117 install -d -m0755 '$(GIT)'/var/lib/git
118 rm -f '$(GIT)'/usr/share/perl5/Error.pm
119 rm -rf '$(GIT)'/usr/share/man
120 chmod 644 '$(GIT)'/usr/share/perl5/Git.pm
121 find '$(GIT)'/usr/share/perl5/Git -type d | xargs chmod 0755
122 find '$(GIT)'/usr/share/perl5/Git -type f | xargs chmod 0644
123 # don't include arch, cvs, svn, email, gui tools, and gitk program
124 for i in git-archimport git-cvs git-svn git-send-email \
125 git-gui git-citool; do \
126 rm -f '$(GIT)'/usr/lib/git-core/$$i*; \
127 done
128 rm -f '$(GIT)'/usr/bin/git-cvsserver
129 rm -f '$(GIT)'/usr/bin/gitk
130 for i in '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*; do \
131 test -d $$i || \
132 test "`head -c2 $$i`" = '#!' || \
133 test "`head -c2 $$i`" = '# ' || \
134 $(STRIP) -R .comment -R .note $$i; \
135 done
136 # don't include git-gui's lib
137 rm -rf '$(GIT)'/usr/share/git-gui/
138 # don't include gitk's lib
139 rm -rf '$(GIT)'/usr/share/gitk/
140 # don't include git-svn's lib
141 rm -rf '$(GIT)'/usr/share/perl5/Git/SVN*
142 # bash completion
143 install -d -m0755 '$(GIT)'/usr/share/bash-completion/completions
144 install -m0644 contrib/completion/git-completion.bash \
145 '$(GIT)'/usr/share/bash-completion/completions/git
146 ln -s git '$(GIT)'/usr/share/bash-completion/completions/gitk
147 # bash prompt
148 install -m0644 contrib/completion/git-prompt.sh \
149 '$(GIT)'/usr/lib/git-core/git-sh-prompt
150 install -d -m0755 '$(GIT)'/etc/bash_completion.d
151 install -m0644 debian/git-prompt.completion \
152 '$(GIT)'/etc/bash_completion.d/git-prompt
153 # sanity check that #642603 fix is still in place
154 test $$(stat -c%h \
155 '$(GIT)'/usr/lib/git-core/git-branch) -le 10
156 # gitweb
157 install -d -m0755 '$(GIT)'/usr/share/gitweb
158 ln -s gitweb.cgi '$(GIT)'/usr/share/gitweb/index.cgi
159 # contrib hooks
160 install -d -m0755 '$(GIT)'/usr/share/git-core/contrib/hooks
161 install -m0755 contrib/hooks/* \
162 '$(GIT)'/usr/share/git-core/contrib/hooks/
163 # contrib
164 install -d -m0755 '$(GIT)'/usr/share/doc/git
165 cp -R contrib '$(GIT)'/usr/share/doc/git/
166 rm -rf '$(GIT)'/usr/share/doc/git/contrib/completion
167 rm -rf '$(GIT)'/usr/share/doc/git/contrib/emacs
168 find '$(GIT)'/usr/share/doc/git/contrib -type f | xargs chmod 0644
169 find '$(GIT)'/usr/share/doc/git/contrib -type d | xargs chmod 0755
170 # remove contrib hooks, they are now installed in
171 # /usr/share/git-core/contrib, keep symlink for backward compatibility
172 rm -rf '$(GIT)'/usr/share/doc/git/contrib/hooks
173 ln -s ../../../git-core/contrib/hooks \
174 '$(GIT)'/usr/share/doc/git/contrib/
175 find '$(GIT)'/usr/share/doc/git/ -name .gitignore | xargs rm -f
177 $(patsubst %,%.install,$(PKG_INDEP)) git-core.install: install-indep
178 install-indep: build-arch-stamp build-indep-stamp
179 rm -rf '$(TMP)'
180 install -d -m0755 '$(TMP)'
181 DESTDIR='$(TMP)' $(MAKE) install install-doc $(OPTS)
182 $(MAKE) -CDocumentation install-webdoc WEBDOC_DEST='$(TMP)'/html \
183 2>/dev/null
184 # RelNotes are shipped in git
185 rm -rf '$(TMP)'/html/RelNotes
186 # git-man
187 rm -rf '$(GIT)'-man
188 install -d -m0755 '$(GIT)'-man/usr/share/man/man3
189 DESTDIR='$(GIT)'-man $(MAKE) install-doc $(OPTS)
190 install -m 0644 '$(TMP)'/usr/share/man/man3/Git* \
191 '$(GIT)'-man/usr/share/man/man3/
192 # don't include arch, cvs, svn, email, gui, and gitk man pages
193 for i in git-archimport git-cvs git-svn git-send-email gitk \
194 git-gui git-citool; do \
195 rm -f '$(GIT)'-man/usr/share/man/man1/$$i*; \
196 done
197 rm -f '$(GIT)'-man/usr/share/man/man3/Git::SVN*.3pm
198 chmod 0644 '$(GIT)'-man/usr/share/man/man?/*.[0-9]*
199 gzip -9 '$(GIT)'-man/usr/share/man/man?/*.[0-9]*
200 # git-doc
201 rm -rf '$(GIT)'-doc
202 install -d -m0755 '$(GIT)'-doc/usr/share/doc/git
203 ln -s ../git-doc '$(GIT)'-doc/usr/share/doc/git/html
204 # git-cvs, git-svn
205 for i in cvs svn; do \
206 rm -rf '$(GIT)'-$$i && \
207 install -d -m0755 '$(GIT)'-$$i/usr/lib/git-core && \
208 install -m0755 '$(TMP)'/usr/lib/git-core/git-$$i* \
209 '$(GIT)'-$$i/usr/lib/git-core/ && \
210 install -d -m0755 '$(GIT)'-$$i/usr/share/man/man1 && \
211 install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \
212 '$(GIT)'-$$i/usr/share/man/man1/ && \
213 gzip -9 '$(GIT)'-$$i/usr/share/man/man1/*.1 || exit 1; \
214 done
215 install -d -m0755 '$(GIT)'-svn/usr/share/perl5/Git
216 cp -R '$(TMP)'/usr/share/perl5/Git/SVN* \
217 '$(GIT)'-svn/usr/share/perl5/Git/
218 find '$(GIT)'-svn/usr/share/perl5/Git -type d | xargs chmod 0755
219 find '$(GIT)'-svn/usr/share/perl5/Git -type f | xargs chmod 0644
220 install -d -m0755 '$(GIT)'-svn/usr/share/man/man3
221 install -m 0644 '$(TMP)'/usr/share/man/man3/Git::SVN*.3pm \
222 '$(GIT)'-svn/usr/share/man/man3/
223 gzip -9 '$(GIT)'-svn/usr/share/man/man3/*.3pm
224 # git-cvs
225 install -d -m0755 '$(GIT)'-cvs/usr/bin
226 install -m0755 '$(TMP)'/usr/bin/git-cvsserver '$(GIT)'-cvs/usr/bin/
227 # git-arch
228 rm -rf '$(GIT)'-arch
229 install -d -m0755 '$(GIT)'-arch/usr/lib/git-core
230 install -m0755 '$(TMP)'/usr/lib/git-core/git-archimport \
231 '$(GIT)'-arch/usr/lib/git-core/
232 install -d -m0755 '$(GIT)'-arch/usr/share/man/man1
233 install -m0644 '$(TMP)'/usr/share/man/man1/git-archimport.1 \
234 '$(GIT)'-arch/usr/share/man/man1/
235 gzip -9 '$(GIT)'-arch/usr/share/man/man1/*.1
236 # git-bzr
237 rm -rf '$(GIT)'-bzr
238 install -d -m0755 '$(GIT)'-bzr/usr/lib/git-core
239 install -m0755 debian/git-remote-bzr \
240 '$(GIT)'-bzr/usr/lib/git-core/git-remote-bzr--git
241 install -d -m0755 '$(GIT)'-bzr/usr/share/man/man1
242 install -m0644 Documentation/git-remote-bzr.1 \
243 '$(GIT)'-bzr/usr/share/man/man1/git-remote-bzr--git.1
244 gzip -9 '$(GIT)'-bzr/usr/share/man/man1/*.1
245 # git-email
246 rm -rf '$(GIT)'-email
247 install -d -m0755 '$(GIT)'-email/usr/lib/git-core
248 install -m0755 '$(TMP)'/usr/lib/git-core/git-send-email \
249 '$(GIT)'-email/usr/lib/git-core/
250 install -d -m0755 '$(GIT)'-email/usr/share/man/man1
251 install -m0644 '$(TMP)'/usr/share/man/man1/git-send-email.1 \
252 '$(GIT)'-email/usr/share/man/man1/
253 gzip -9 '$(GIT)'-email/usr/share/man/man1/*.1
254 # git-daemon-run
255 rm -rf '$(GIT)'-daemon-run
256 install -d -m0755 '$(GIT)'-daemon-run/etc/sv/git-daemon/log
257 install -m0755 debian/git-daemon/run \
258 '$(GIT)'-daemon-run/etc/sv/git-daemon/run
259 install -m0755 debian/git-daemon/log/run \
260 '$(GIT)'-daemon-run/etc/sv/git-daemon/log/run
261 # git-daemon-sysvinit
262 rm -rf '$(GIT)'-daemon-sysvinit
263 install -d -m0755 '$(GIT)'-daemon-sysvinit/etc/init.d
264 install -m0755 debian/git-daemon.init \
265 '$(GIT)'-daemon-sysvinit/etc/init.d/git-daemon
266 install -d -m0755 '$(GIT)'-daemon-sysvinit/etc/default
267 install -m0644 debian/git-daemon.default \
268 '$(GIT)'-daemon-sysvinit/etc/default/git-daemon
269 install -d -m0755 '$(GIT)'-daemon-sysvinit/usr/share/git-core/sysvinit
270 >'$(GIT)'-daemon-sysvinit/usr/share/git-core/sysvinit/sentinel
271 chmod 0644 \
272 '$(GIT)'-daemon-sysvinit/usr/share/git-core/sysvinit/sentinel
273 # git-el
274 rm -rf '$(GIT)'-el
275 install -m0644 -D debian/git-el.emacsen-startup \
276 '$(GIT)'-el/etc/emacs/site-start.d/50git-core.el
277 install -m0755 -D debian/git-el.emacsen-install \
278 '$(GIT)'-el/usr/lib/emacsen-common/packages/install/git
279 install -m0755 -D debian/git-el.emacsen-remove \
280 '$(GIT)'-el/usr/lib/emacsen-common/packages/remove/git
281 install -d -m0755 '$(GIT)'-el/usr/share/git-core/emacs
282 install -m0644 contrib/emacs/git-blame.el \
283 '$(GIT)'-el/usr/share/git-core/emacs/git-blame.el
284 install -m0644 contrib/emacs/git.el \
285 '$(GIT)'-el/usr/share/git-core/emacs/git.el
286 install -d -m0755 '$(GIT)'-el/usr/share/doc/git-el
287 ln -s ../git/README.emacs \
288 '$(GIT)'-el/usr/share/doc/git-el/README.Debian
289 install -d -m0755 '$(GIT)'-el/usr/share/doc/git/contrib
290 ln -s ../../../git-core/emacs \
291 '$(GIT)'-el/usr/share/doc/git/contrib/emacs
292 # git-gui
293 rm -rf '$(GIT)'-gui
294 install -d -m0755 '$(GIT)'-gui/usr/lib/git-core
295 install -m0755 '$(TMP)'/usr/lib/git-core/git-gui \
296 '$(GIT)'-gui/usr/lib/git-core/
297 install -m0755 '$(TMP)'/usr/lib/git-core/git-gui--askpass \
298 '$(GIT)'-gui/usr/lib/git-core/
299 install -m0755 '$(TMP)'/usr/lib/git-core/git-citool \
300 '$(GIT)'-gui/usr/lib/git-core/
301 install -d -m0755 '$(GIT)'-gui/usr/share/man/man1
302 for i in gui citool; do \
303 install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \
304 '$(GIT)'-gui/usr/share/man/man1/; \
305 done
306 gzip -9 '$(GIT)'-gui/usr/share/man/man1/*.1
307 install -d -m0755 '$(GIT)'-gui/usr/share/git-gui
308 cp -a '$(TMP)'/usr/share/git-gui/lib '$(GIT)'-gui/usr/share/git-gui/
309 # gitk
310 rm -rf '$(GIT)'k
311 install -d -m0755 '$(GIT)'k/usr/bin
312 install -m0755 '$(TMP)'/usr/bin/gitk \
313 '$(GIT)'k/usr/bin/gitk
314 install -d -m0755 '$(GIT)'k/usr/share/man/man1
315 install -m0644 '$(TMP)'/usr/share/man/man1/gitk.1 \
316 '$(GIT)'k/usr/share/man/man1/
317 gzip -9 '$(GIT)'k/usr/share/man/man1/*.1
318 install -d -m0755 '$(GIT)'k/usr/share/gitk
319 cp -a '$(TMP)'/usr/share/gitk/lib '$(GIT)'k/usr/share/gitk/
320 # gitweb
321 rm -rf '$(GIT)'web
322 install -d -m0755 '$(GIT)'web/usr/lib/cgi-bin
323 ln -s ../../share/gitweb/gitweb.cgi \
324 '$(GIT)'web/usr/lib/cgi-bin/gitweb.cgi
325 install -d -m0755 '$(GIT)'web/etc
326 install -m0644 debian/gitweb.conf '$(GIT)'web/etc/gitweb.conf
327 install -d -m0755 '$(GIT)'web/etc/apache2/conf.d
328 install -m0644 debian/gitweb.apache2.conf \
329 '$(GIT)'web/etc/apache2/conf.d/gitweb
330 # git-all
331 rm -rf '$(GIT)'-all
332 install -d -m0755 '$(GIT)'-all
333 # git-core
334 rm -rf '$(GIT)'-core
335 install -d -m0755 '$(GIT)'-core/usr/share/doc
336 ln -s git '$(GIT)'-core/usr/share/doc/git-core
338 git-core.deb-docs:
339 : no doc dir
341 binary: binary-arch binary-indep
342 binary-arch: install-arch git.deb
343 rm -f debian/substvars
344 dpkg-shlibdeps '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*
345 dpkg-gencontrol -isp -pgit -P'$(GIT)'
346 dpkg -b '$(GIT)' ..
347 binary-indep: install-indep $(patsubst %,%.deb,$(PKG_INDEP)) git-core.deb-DEBIAN
348 rm -f debian/substvars
349 for i in $(patsubst git%,%,$(PKG_INDEP)) -core; do \
350 dpkg-gencontrol -isp -pgit$$i -P'$(GIT)'$$i && \
351 dpkg -b '$(GIT)'$$i .. || exit 1; \
352 done
354 .PHONY: patch clean
355 .PHONY: build build-arch build-indep
356 .PHONY: install install-arch install-indep
357 .PHONY: binary binary-arch binary-indep
359 include debian/implicit