summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 18b6235779c3442d16cf9c5c402a12bdca455836 (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
#!/usr/bin/make -f

SHELL=bash

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

BUILD := $(shell pwd)/debian/build
DIR := $(shell pwd)

arch=$(shell dpkg --print-architecture)
mcidir=debian/tmp-main/DEBIAN


maintainer-configure: Makefile.am configure.in
	$(checkdir)
	mkdir -p automake
	aclocal -I ./automake
	autoheader
	gettextize --copy --force
	libtoolize --copy --force
	patch -p0 < debian/ltconfig-1.3.2.diff
	automake --copy --add-missing --foreign
	autoconf

$(BUILD)/config.status:
	$(checkdir)
	$(RM) -r debian/build
	install -d debian/build
	cd $(BUILD) && ../../configure \
		--enable-shared \
		--prefix=/usr/share \
		--exec-prefix=/usr \
		--datadir=/usr/share \
		--mandir=/usr/share/man \
		--sysconfdir=/etc \
		--sharedstatedir=/var/lib \
		--localstatedir=/var/lib

clean:
	$(checkdir)
	-$(MAKE) -C $(BUILD) -i distclean
	$(RM) -r debian/{build,files,substvars,tmp*}
	$(RM) $(BUILD)/dpkg-*.tar.gz
	$(RM) po/*.gmo
	$(RM) config.log
	find . \( -name '*~' -o -name '#*#' \) -print0 | xargs -r0 $(RM) --

build: $(BUILD)/config.status
	$(checkdir)
	$(MAKE) -C $(BUILD)

binary: binary-arch binary-indep

binary-trees: build
	$(checkdir)
	-$(RM) -r debian/tmp-{main,dev}
	install -d debian/tmp-{main,dev}/{DEBIAN,etc/dpkg,usr/share/doc/dpkg}
	install -d debian/tmp-dev/usr/{lib/dpkg,share/doc/dpkg-dev,sbin,bin}
	install -d debian/tmp-dev/usr/share/man/{ja/man1,man1,ja/man8,man8}
	install -d debian/tmp-dev/usr/share/emacs/site-lisp/dpkg-dev
	install -d debian/tmp-main/sbin
	set -e; if [ $(arch) = i386 ]; then \
		sed -e 's/^# i386elf: //' <debian/preinst >$(mcidir)/preinst ; \
	else \
		sed -e '/^# i386elf: /d' debian/preinst >$(mcidir)/preinst ; \
	fi
	set -e; if [ -f debian/shlibs.default.$(arch) ]; then \
		echo /etc/dpkg/shlibs.default >debian/tmp-dev/DEBIAN/conffiles ; \
		cp debian/shlibs.default.$(arch) \
			debian/tmp-dev/etc/dpkg/shlibs.default ; \
	fi
	cp debian/{prerm,postinst} $(mcidir)/.
	$(MAKE) -C $(BUILD) top_distdir=. dist 
	$(MAKE) -C $(BUILD) \
		prefix=$(DIR)/debian/tmp-main/usr/share \
		exec_prefix=$(DIR)/debian/tmp-main/usr \
		sysconfdir=$(DIR)/debian/tmp-main/etc \
		datadir=$(DIR)/debian/tmp-main/usr/share \
		mandir=$(DIR)/debian/tmp-main/usr/share/man \
		sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
		localstatedir=$(DIR)/debian/tmp-main/var/lib \
		install
	install -m 755 debian/dev-postinst debian/tmp-dev/DEBIAN/postinst
	install -m 755 debian/dev-prerm debian/tmp-dev/DEBIAN/prerm
	install -d debian/tmp-dev/etc/emacs/site-start.d
	install -c debian/50dpkg-dev.el debian/tmp-dev/etc/emacs/site-start.d/.
	install -d debian/tmp-dev/usr/lib/emacsen-common/packages/{install,remove}
	install -m 755 debian/emacsen-common-remove \
	debian/tmp-dev/usr/lib/emacsen-common/packages/remove/dpkg-dev
	install -m 755 debian/emacsen-common-install \
	debian/tmp-dev/usr/lib/emacsen-common/packages/install/dpkg-dev
	cp scripts/debian-changelog-mode.el \
	debian/tmp-dev/usr/share/emacs/site-lisp/dpkg-dev
	rm -f debian/tmp-main/usr/share/{x,}emacs/site-lisp/debian-changelog-mode.el*
	chmod +x $(mcidir)/{postinst,prerm,preinst}
	find debian/tmp-main/usr/share/man -type f | xargs gzip -9vf
	set -e; for f in dpkg-buildpackage dpkg-gencontrol dpkg-distaddfile \
		  dpkg-parsechangelog dpkg-genchanges dpkg-shlibdeps; do \
		rm debian/tmp-main/usr/share/man/man1/$$f.1; \
		ln -s dpkg-source.1.gz debian/tmp-main/usr/share/man/man1/$$f.1.gz ; \
	done
	ln -s ../man7/undocumented.7.gz debian/tmp-main/usr/share/man/man1/dpkg-divert.1.gz
	gzip -9vf debian/tmp-main/usr/share/doc/dpkg/changelog*
	cp debian/copyright debian/tmp-main/usr/share/doc/dpkg/copyright
	cp debian/copyright debian/tmp-dev/usr/share/doc/dpkg-dev/copyright
	cp debian/dev-README debian/tmp-dev/usr/share/doc/dpkg-dev/README
	set -e; for f in \
 usr/share/doc/dpkg/{internals.html,changelog.manuals.gz} \
 usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \
 usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages,dpkg-name,dpkg-architecture} \
 usr/share/man{/ja,}/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,architecture}.1.gz \
 usr/share/man{/ja,}/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date,dpkg-name}.1.gz \
 usr/share/man{/ja,}/man5 usr/share/man{/ja,}/man8/dpkg-scanpackages.8.gz \
 usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \
		; do if [ -e debian/tmp-main/$$f ]; then mv debian/tmp-main/$$f debian/tmp-dev/$$f; fi \
			done

binary-indep: binary-trees
	$(checkdir)
	dpkg-gencontrol -pdpkg-dev -Pdebian/tmp-dev
	chown -R root.root debian/tmp-dev
	chmod -R g-ws,a+r,u+w debian/tmp-dev
	dpkg-deb --build debian/tmp-dev ..
	set -e -x; for f in internals; do \
		if test -f $(BUILD)/doc/$$f.ps; then \
			cp -p $(BUILD)/doc/$$f.ps $(DIR)/..; \
		elif test -f $(DIR)/doc/$$f.ps; then \
			cp -p $(DIR)/doc/$$f.ps $(DIR)/..; \
		else \
			echo "unable to locate $$f.ps"; false; \
		fi; \
		gzip -9vf $(DIR)/../$$f.ps; \
		dpkg-distaddfile -f$(DIR)/debian/files $$f.ps.gz byhand -; \
		if test -d $(BUILD)/doc/$$f.html; then \
			GZIP=-9vf tar -C $(BUILD)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
		elif test -d $(DIR)/doc/$$f.html; then \
			GZIP=-9vf tar -C $(DIR)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
		else \
			echo "unable to locate $$f.html"; false; \
		fi; \
		dpkg-distaddfile -f$(DIR)/debian/files $$f.html.tar.gz byhand -; \
	done
	set -e; \
		version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-dev/DEBIAN/control`; \
		file=dpkg-$${version}.tar.gz; \
		cp $(BUILD)/$${file} $(DIR)/..; \
		dpkg-distaddfile -f$(DIR)/debian/files $${file} byhand -;

binary-arch: binary-trees
	$(checkdir)
	mv debian/tmp-main/usr/sbin/start-stop-daemon debian/tmp-main/sbin/start-stop-daemon
	-strip debian/tmp-main/usr/{bin,sbin}/*	debian/tmp-main/sbin/*
	-strip --strip-unneeded debian/tmp-main/usr/lib/libdpkg.so.*
	-strip --strip-debug debian/tmp-main/usr/lib/libdpkg.a
	dpkg-shlibdeps -dPre-Depends debian/tmp-main/usr/{bin,sbin}/*
	dpkg-gencontrol -pdpkg -Pdebian/tmp-main
	chown -R root.root debian/tmp-main
	chmod -R g-ws,a+r,u+w debian/tmp-main
	set -e; \
		version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-main/DEBIAN/control`; \
		file=dpkg_$${version}_$(arch).nondebbin.tar; \
		tar -C $(DIR)/debian/tmp-main -cf $(DIR)/../$${file} usr var; \
		gzip -9vf $(DIR)/../$${file}; \
		dpkg-distaddfile -f$(DIR)/debian/files $${file}.gz byhand -
	dpkg-deb --build debian/tmp-main ..

define checkdir
	test -f include/dpkg.h.in
endef