summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 4d98df8f34f8b8d3ef7184feb26f2e8ec994fe86 (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
#!/usr/bin/make -f
# debian/rules for gitolite package
# Copyright 2010-2011 by Gerfried Fuchs <rhonda@debian.org>
# Licenced under WTFPLv2

PKG = gitolite3
TMP = $(CURDIR)/debian/$(PKG)

INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -oroot -groot -m644
INSTALL_PROGRAM = $(INSTALL) -p    -oroot -groot -m755
INSTALL_SCRIPT  = $(INSTALL) -p    -oroot -groot -m755
INSTALL_DIR     = $(INSTALL) -p -d -oroot -groot -m755

GL_VERSION = $(shell dpkg-parsechangelog | sed -n -e 's/^Version: \(.*\)/\1 (Debian)/p')

clean:
	$(checkdir)
	$(checkroot)

	-rm -rf $(TMP) debian/files

build: build-arch build-indep
build-arch:
build-indep:
	# uhm, build for a binary-indep package?  Don't try to be funny ;)

debian/gitolite.1: debian/gitolite-man.pod
	pod2man --center='User Commands' --release="$(GL_VERSION)" $< > $@

install: debian/gitolite.1
	$(checkdir)
	$(checkroot)

	-rm -rf $(TMP)
	$(INSTALL_DIR) $(TMP)

	cd $(TMP) && $(INSTALL_DIR) usr/share/$(PKG) \
		etc/$(PKG) \
		usr/bin \
		usr/share/man/man1 \
		$(TMP)/usr/share/doc/$(PKG)

	for subdir in lib syntactic-sugar; do \
	   cp -a src/$${subdir} $(TMP)/usr/share/$(PKG); \
	   find $(TMP)/usr/share/$(PKG)/$${subdir} -type f -exec chmod -x {} \; ; \
        done

	for subdir in commands triggers VREF; do \
	   cp -a src/$${subdir} $(TMP)/usr/share/$(PKG); \
	   find $(TMP)/usr/share/$(PKG)/$${subdir} -type f -exec chmod +x {} \; ; \
        done

	$(INSTALL_SCRIPT) src/gitolite $(TMP)/usr/bin
	$(INSTALL_SCRIPT) src/gitolite-shell $(TMP)/usr/share/$(PKG)
	$(INSTALL_SCRIPT) check-g2-compat $(TMP)/usr/share/$(PKG)
	$(INSTALL_SCRIPT) convert-gitosis-conf $(TMP)/usr/share/$(PKG)

	$(INSTALL_FILE) debian/gitolite.1 $(TMP)/usr/share/man/man1
	gzip -9n $(TMP)/usr/share/man/man1/gitolite.1

	printf "%s\n" "$(GL_VERSION)" > $(TMP)/usr/share/$(PKG)/VERSION

	$(INSTALL_FILE) README.markdown $(TMP)/usr/share/doc/$(PKG)

	dh_installdocs
	dh_installchangelogs
	dh_installdebconf

binary-indep: install
	dh_testdir
	dh_testroot
	dh_installdeb
	dh_compress
	dh_gencontrol
	dh_md5sums
	dh_fixperms
	dh_builddeb

binary-arch:
	# We have nothing to do here.


binary: binary-indep


define checkdir
	test -f debian/rules
endef

define checkroot
	test root = "`whoami`"
endef

.PHONY: build clean binary-indep binary-arch binary install