summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 8e388be72b184e4ae7d102fdbec1701362eb4eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/make -f

CC =gcc
CPPFLAGS :=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS :=-Wall $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
LDFLAGS :=$(shell dpkg-buildflags --get LDFLAGS)
HOST_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
TEST =test
TEST_OPTS =
OPTS =NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core \
  mandir=/usr/share/man htmldir=/usr/share/doc/git/html \
  INSTALLDIRS=vendor \
  SANE_TOOL_PATH= INSTALL=install TAR=tar \
  NO_CROSS_DIRECTORY_HARDLINKS=1 NO_INSTALL_HARDLINKS=1 \
  NO_PERL_CPAN_FALLBACKS=1 \
  PYTHON_PATH=/usr/bin/python3 \
  DEFAULT_PAGER=pager DEFAULT_EDITOR=editor \
  CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \
  HOST_CPU='$(HOST_CPU)'
DOCS =html
DOC_OPTS =prefix=/usr htmldir=/usr/share/doc/git/html \
  ASCIIDOC8=1 ASCIIDOC_NO_ROFF=1

# https://wiki.debian.org/ReproducibleBuilds/TimestampsInDocumentationGeneratedByAsciidoc
DOC_OPTS += ASCIIDOC='TZ=UTC asciidoc'

ifeq (,$(findstring terse,$(DEB_BUILD_OPTIONS)))
  OPTS += V=1
  DOC_OPTS += V=1
  TEST_OPTS = --verbose
endif
ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  TEST =
endif
ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
  DOCS =
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  MAKEFLAGS += -j$(NUMJOBS)
  # Setting this with a pattern-specific rule prevents -O from
  # affecting the top-level make, which would break realtime build
  # output (unless dh is run as +dh, which causes other problems).
  %: MAKEFLAGS += -O
endif
ifneq (,$(shell dpkg-query -f '$${Version}' -W libpcre2-dev))
  OPTS += USE_LIBPCRE2=1
else
  OPTS += USE_LIBPCRE1=1
endif

TMP = $(CURDIR)/debian/tmp
GIT = $(CURDIR)/debian/git

%:
	dh $@ --with apache2 --without autoreconf

override_dh_auto_configure:

build-stamp:
	-$(CC) -v
	$(MAKE) all $(OPTS)
	touch $@

override_dh_auto_build-arch: build-stamp
	$(MAKE) -C contrib/subtree all $(OPTS)
	ln -s contrib/subtree/git-subtree

override_dh_auto_test-arch:
	test -z '$(TEST)' || \
	  GIT_SKIP_TESTS="t9128 t9167" \
	  GIT_TEST_OPTS='$(TEST_OPTS)' $(MAKE) $(TEST) $(OPTS)
	test -z '$(TEST)' || \
	  GIT_TEST_OPTS='$(TEST_OPTS)' \
	  $(MAKE) -C t \
	  t9128-git-svn-cmd-branch.sh \
	  t9167-git-svn-cmd-branch-subproject.sh \
	  $(OPTS) || :
	test -z '$(TEST)' || \
	  GIT_TEST_OPTS='$(TEST_OPTS)' $(MAKE) -C contrib/subtree $(TEST) $(OPTS)

override_dh_auto_build-indep: build-stamp
	# git-man, git-doc
	$(MAKE) -CDocumentation man $(DOCS) $(DOC_OPTS)
	# git-mediawiki
	$(MAKE) -Ccontrib/mw-to-git all $(OPTS)

override_dh_auto_test-indep:

override_dh_auto_clean:
	$(MAKE) -C contrib/mw-to-git clean $(OPTS)
	$(MAKE) -C contrib/subtree clean $(OPTS)
	$(MAKE) clean $(OPTS)
	rm -f git-subtree

override_dh_clean:
	dh_clean -Xmailinfo.c.orig

override_dh_auto_install-arch:
	# git
	DESTDIR='$(GIT)' $(MAKE) install $(OPTS)
	DESTDIR='$(GIT)' $(MAKE) -C contrib/subtree install $(OPTS)
	install -d -m0755 '$(GIT)'/var/lib/git
	rm -rf '$(GIT)'/usr/share/man
	# don't include arch, cvs, p4, svn, email, gui tools, and gitk program
	for i in git-archimport git-cvs git-p4 git-svn git-send-email \
	 git-gui git-citool; do \
	  rm -f '$(GIT)'/usr/lib/git-core/$$i*; \
	done
	rm -f '$(GIT)'/usr/bin/git-cvsserver
	rm -f '$(GIT)'/usr/bin/gitk
	# don't include git-gui's lib
	rm -rf '$(GIT)'/usr/share/git-gui/
	# don't include gitk's lib
	rm -rf '$(GIT)'/usr/share/gitk/
	# don't include git-svn's lib
	rm -rf '$(GIT)'/usr/share/perl5/Git/SVN*
	# sanity check that #642603 fix is still in place
	test $$(stat -c%h \
	  '$(GIT)'/usr/lib/git-core/git-branch) -le 10

override_dh_auto_install-indep:
	DESTDIR='$(TMP)' $(MAKE) install install-doc $(OPTS)
	DESTDIR='$(TMP)' $(MAKE) -Ccontrib/mw-to-git install $(OPTS) \
	  INSTLIBDIR=/usr/share/perl5
	test -z '$(DOCS)' || \
	  $(MAKE) -CDocumentation install-webdoc WEBDOC_DEST='$(TMP)'/html \
	  2>/dev/null
	test -z '$(DOCS)' || \
	  DESTDIR='$(TMP)' $(MAKE) -Ccontrib/subtree install-doc $(OPTS)
	install -m 0644 contrib/subtree/git-subtree.txt '$(TMP)'/html
	# RelNotes are shipped in git
	rm -rf '$(TMP)'/html/RelNotes
	# don't include git-p4 man page
	rm -f '$(TMP)'/html/git-p4.*

override_dh_install-arch:
	dh_install --arch
	rm -rf '$(GIT)'/usr/share/git-core/contrib/hooks/multimail

override_dh_install-indep:
	dh_install --indep
	for i in git-archimport git-cvs git-p4 git-svn git-send-email gitk \
	 git-gui git-citool; do \
	  rm -f '$(GIT)'-man/usr/share/man/man1/$$i*; \
	done

override_dh_installdocs-arch:
	dh_installdocs --arch -X.gitignore
	# These licenses are replaced with symlinks in git.links.
	diff -q '$(GIT)'/usr/share/doc/git/contrib/persistent-https/LICENSE /usr/share/common-licenses/Apache-2.0
	diff -bq '$(GIT)'/usr/share/doc/git/contrib/subtree/COPYING /usr/share/common-licenses/GPL-2
	rm -rf '$(GIT)'/usr/share/doc/git/contrib/completion
	rm -rf '$(GIT)'/usr/share/doc/git/contrib/emacs
	rm -rf '$(GIT)'/usr/share/doc/git/contrib/hooks
	rm -rf '$(GIT)'/usr/share/doc/git/contrib/mw-to-git
	rm -f '$(GIT)'/usr/share/doc/git/contrib/subtree/git-subtree.1
	rm -f '$(GIT)'/usr/share/doc/git/contrib/subtree/git-subtree.html
	rm -f '$(GIT)'/usr/share/doc/git/contrib/subtree/git-subtree.xml
	find '$(GIT)'/usr/share/doc/git/ -name .gitattributes | xargs rm -f
	find '$(GIT)'/usr/share/doc/git/ -name .gitignore | xargs rm -f

override_dh_installdocs-indep:
	dh_installdocs --indep -X.gitignore

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog.upstream

override_dh_installinit:
	dh_installinit -pgit-daemon-sysvinit --name=git-daemon
	dh_installinit

override_dh_compress:
	dh_compress -X.txt -Xcontrib