Deal with RelNotes being moved to a subdirectory
[git/debian.git] / debian / rules
blob08f89dd7a1a4940ff0a2040ee4c8ad73584517d0
1 #!/usr/bin/make -f
3 ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
5 CC =gcc
6 CFLAGS =-g -Wall
7 STRIP =strip
8 TEST =test
9 OPTS =NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core \
10 mandir=/usr/share/man INSTALLDIRS=vendor \
11 NO_PYTHON=1 \
12 THREADED_DELTA_SEARCH=1 NO_CROSS_DIRECTORY_HARDLINKS=1 \
13 DEFAULT_PAGER=pager DEFAULT_EDITOR=editor
14 DOC_OPTS =prefix=/usr ASCIIDOC8=1 ASCIIDOC_NO_ROFF=1
16 ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
17 STRIP =: strip
18 endif
19 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
20 CFLAGS +=-O0
21 else
22 # workaround #427907
23 ifeq (hppa,$(ARCH))
24 CFLAGS +=-O0
25 else
26 CFLAGS +=-O2
27 endif
28 endif
29 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
30 TEST =
31 endif
33 TMP =$(shell pwd)/tmp
34 GIT =$(shell pwd)/debian/git
36 patch: deb-checkdir patch-stamp
37 patch-stamp:
38 for i in `ls -1 debian/diff/*.diff || :`; do \
39 patch -p1 <$$i || exit 1; \
40 done
41 touch patch-stamp
43 build: deb-checkdir build-arch-stamp build-indep-stamp
44 build-arch-stamp: patch-stamp build-indep-stamp
45 -$(CC) -v
46 DESTDIR='$(GIT)' $(MAKE) all \
47 CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS)
48 test -z '$(TEST)' || \
49 DESTDIR='$(GIT)' $(MAKE) $(TEST) \
50 CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS) || \
51 GIT_TEST_OPTS=--verbose DESTDIR='$(GIT)' \
52 $(MAKE) $(TEST) CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS)
53 touch build-arch-stamp
54 build-indep-stamp:
55 $(MAKE) -CDocumentation man html $(DOC_OPTS)
56 touch build-indep-stamp
58 clean: deb-checkdir
59 $(MAKE) clean $(OPTS)
60 ! test -e patch-stamp || \
61 for i in `ls -1r debian/diff/*.diff || :`; do patch -p1 -R <$$i; done
62 rm -rf '$(TMP)'
63 rm -f patch-stamp build-arch-stamp build-indep-stamp
64 rm -rf '$(GIT)' '$(GIT)'-doc '$(GIT)'-arch '$(GIT)'-cvs \
65 '$(GIT)'-svn '$(GIT)'-email '$(GIT)'-daemon-run '$(GIT)'-gui \
66 '$(GIT)'k '$(GIT)'web '$(GIT)'-all '$(GIT)'-core
67 rm -f debian/files debian/substvars changelog
69 install: install-arch install-indep
70 install-arch: deb-checkdir deb-checkuid build-arch-stamp
71 # git
72 rm -rf '$(GIT)'
73 install -d -m0755 '$(GIT)'/usr/bin
74 DESTDIR='$(GIT)' $(MAKE) install install-doc \
75 CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS)
76 install -d -m0755 '$(GIT)'/var/cache/git
77 rm -f '$(GIT)'/usr/share/perl5/Error.pm
78 rm -f '$(GIT)'/usr/share/man/man3/private-Error.3pm
79 chmod 644 '$(GIT)'/usr/share/perl5/Git.pm
80 # don't include arch, cvs, svn, email, gui tools, and gitk program
81 for i in git-archimport git-cvs git-svn git-send-email \
82 git-gui git-citool; do \
83 rm -f '$(GIT)'/usr/lib/git-core/$$i*; \
84 done
85 rm -f '$(GIT)'/usr/bin/git-cvsserver
86 rm -f '$(GIT)'/usr/bin/gitk
87 for i in '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*; do \
88 test "`head -c2 $$i`" = '#!' || $(STRIP) -R .comment -R .note $$i; \
89 done
90 # don't include git-gui's lib
91 rm -rf '$(GIT)'/usr/share/git-gui/
92 # don't include gitk's lib
93 rm -rf '$(GIT)'/usr/share/gitk/
94 # don't include arch, cvs, svn, email, gui, and gitk man pages
95 for i in git-archimport git-cvs git-svn git-send-email gitk \
96 git-gui git-citool; do \
97 rm -f '$(GIT)'/usr/share/man/man1/$$i*; \
98 done
99 chmod 0644 '$(GIT)'/usr/share/man/man?/*.[0-9]*
100 gzip -9 '$(GIT)'/usr/share/man/man?/*.[0-9]*
101 # emacs
102 install -m0644 -D debian/git.emacsen-startup \
103 '$(GIT)'/etc/emacs/site-start.d/50git-core.el
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
112 install -d -m0755 '$(GIT)'/usr/share/doc/git
113 cp -R contrib '$(GIT)'/usr/share/doc/git/
114 rm -rf '$(GIT)'/usr/share/doc/git/contrib/completion
115 find '$(GIT)'/usr/share/doc/git/contrib -type f | xargs chmod 0644
116 find '$(GIT)'/usr/share/doc/git/contrib -type d | xargs chmod 0755
117 find '$(GIT)'/usr/share/doc/git/ -name .gitignore | xargs rm -f
118 # upstream changelog
119 test -r changelog || ln -s debian/changelog.upstream changelog
121 install-indep: build-arch-stamp build-indep-stamp
122 rm -rf '$(TMP)'
123 install -d -m0755 '$(TMP)'
124 DESTDIR='$(TMP)' $(MAKE) install install-doc \
125 CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS)
126 $(MAKE) -CDocumentation install-webdoc WEBDOC_DEST='$(TMP)'/html \
127 2>/dev/null
128 # RelNotes are shipped in git
129 rm -rf '$(TMP)'/html/RelNotes
130 # git-doc
131 rm -rf '$(GIT)'-doc
132 install -d -m0755 '$(GIT)'-doc
133 # git-cvs, git-svn
134 for i in cvs svn; do \
135 rm -rf '$(GIT)'-$$i && \
136 install -d -m0755 '$(GIT)'-$$i/usr/lib/git-core && \
137 install -m0755 '$(TMP)'/usr/lib/git-core/git-$$i* \
138 '$(GIT)'-$$i/usr/lib/git-core/ && \
139 install -d -m0755 '$(GIT)'-$$i/usr/share/man/man1 && \
140 install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \
141 '$(GIT)'-$$i/usr/share/man/man1/ && \
142 gzip -9 '$(GIT)'-$$i/usr/share/man/man1/*.1 || exit 1; \
143 done
144 # git-cvs
145 install -d -m0755 '$(GIT)'-cvs/usr/bin
146 install -m0755 '$(TMP)'/usr/bin/git-cvsserver '$(GIT)'-cvs/usr/bin/
147 # git-arch
148 rm -rf '$(GIT)'-arch
149 install -d -m0755 '$(GIT)'-arch/usr/lib/git-core
150 install -m0755 '$(TMP)'/usr/lib/git-core/git-archimport \
151 '$(GIT)'-arch/usr/lib/git-core/
152 install -d -m0755 '$(GIT)'-arch/usr/share/man/man1
153 install -m0644 '$(TMP)'/usr/share/man/man1/git-archimport.1 \
154 '$(GIT)'-arch/usr/share/man/man1/
155 gzip -9 '$(GIT)'-arch/usr/share/man/man1/*.1
156 # git-email
157 rm -rf '$(GIT)'-email
158 install -d -m0755 '$(GIT)'-email/usr/lib/git-core
159 install -m0755 '$(TMP)'/usr/lib/git-core/git-send-email \
160 '$(GIT)'-email/usr/lib/git-core/
161 install -d -m0755 '$(GIT)'-email/usr/share/man/man1
162 install -m0644 '$(TMP)'/usr/share/man/man1/git-send-email.1 \
163 '$(GIT)'-email/usr/share/man/man1/
164 gzip -9 '$(GIT)'-email/usr/share/man/man1/*.1
165 # git-daemon-run
166 rm -rf '$(GIT)'-daemon-run
167 install -d -m0755 '$(GIT)'-daemon-run/etc/sv/git-daemon/log
168 install -m0755 debian/git-daemon/run \
169 '$(GIT)'-daemon-run/etc/sv/git-daemon/run
170 install -m0755 debian/git-daemon/log/run \
171 '$(GIT)'-daemon-run/etc/sv/git-daemon/log/run
172 # git-gui
173 rm -rf '$(GIT)'-gui
174 install -d -m0755 '$(GIT)'-gui/usr/lib/git-core
175 install -m0755 '$(TMP)'/usr/lib/git-core/git-gui \
176 '$(GIT)'-gui/usr/lib/git-core/
177 install -m0755 '$(TMP)'/usr/lib/git-core/git-citool \
178 '$(GIT)'-gui/usr/lib/git-core/
179 install -d -m0755 '$(GIT)'-gui/usr/share/man/man1
180 for i in gui citool; do \
181 install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \
182 '$(GIT)'-gui/usr/share/man/man1/; \
183 done
184 gzip -9 '$(GIT)'-gui/usr/share/man/man1/*.1
185 install -d -m0755 '$(GIT)'-gui/usr/share/git-gui
186 cp -a '$(TMP)'/usr/share/git-gui/lib '$(GIT)'-gui/usr/share/git-gui/
187 # gitk
188 rm -rf '$(GIT)'k
189 install -d -m0755 '$(GIT)'k/usr/bin
190 install -m0755 '$(TMP)'/usr/bin/gitk \
191 '$(GIT)'k/usr/bin/gitk
192 install -d -m0755 '$(GIT)'k/usr/share/man/man1
193 install -m0644 '$(TMP)'/usr/share/man/man1/gitk.1 \
194 '$(GIT)'k/usr/share/man/man1/
195 gzip -9 '$(GIT)'k/usr/share/man/man1/*.1
196 install -d -m0755 '$(GIT)'k/usr/share/gitk
197 cp -a '$(TMP)'/usr/share/gitk/lib '$(GIT)'k/usr/share/gitk/
198 # gitweb
199 rm -rf '$(GIT)'web
200 install -d -m0755 '$(GIT)'web/usr/lib/cgi-bin
201 ln -s ../../share/gitweb/gitweb.cgi \
202 '$(GIT)'web/usr/lib/cgi-bin/gitweb.cgi
203 install -d -m0755 '$(GIT)'web/etc
204 install -m0644 debian/gitweb.conf '$(GIT)'web/etc/gitweb.conf
205 install -d -m0755 '$(GIT)'web/etc/apache2/conf.d
206 install -m0644 debian/gitweb.apache2.conf \
207 '$(GIT)'web/etc/apache2/conf.d/gitweb
208 # git-all
209 rm -rf '$(GIT)'-all
210 install -d -m0755 '$(GIT)'-all
211 # git-core
212 rm -rf '$(GIT)'-core
213 install -d -m0755 '$(GIT)'-core/usr/share/doc
214 ln -s git '$(GIT)'-core/usr/share/doc/git-core
215 # upstream changelog
216 test -r changelog || ln -s debian/changelog.upstream changelog
218 binary: binary-arch binary-indep
219 binary-arch: install-arch git.deb
220 rm -f debian/substvars
221 dpkg-shlibdeps '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*
222 dpkg-gencontrol -isp -pgit -P'$(GIT)'
223 dpkg -b '$(GIT)' ..
224 binary-indep: install-indep git-doc.deb git-arch.deb git-cvs.deb git-svn.deb \
225 git-daemon-run.deb git-email.deb git-gui.deb gitk.deb gitweb.deb \
226 git-all.deb git-core.deb-DEBIAN
227 rm -f debian/substvars
228 for i in -doc -arch -cvs -svn -daemon-run -email -gui k web -all \
229 -core; do \
230 dpkg-gencontrol -isp -pgit$$i -P'$(GIT)'$$i && \
231 dpkg -b '$(GIT)'$$i .. || exit 1; \
232 done
234 .PHONY: patch build clean install install-arch install-indep binary \
235 binary-arch binary-indep
237 include debian/implicit