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

DIR:=$(shell pwd)

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

build:
	$(checkdir)
	./configure --prefix=/usr
	$(MAKE)
	touch build

clean:
	$(checkdir)
	-rm -f build
	-$(MAKE) -i distclean || $(MAKE) -f Makefile.in -i distclean
	-rm -rf debian/tmp* *~ *.orig ./#*# tmp.* debian/files*
	-rm -f config.cache config.status config.h install config.log
	find -name '*~' -print0 | xargs -r0 rm --

binary:		binary-arch binary-indep

binary-indep:
	$(checkdir)

binary-arch:	checkroot build
	$(checkdir)
	-rm -rf debian/tmp
	install -d debian/tmp debian/tmp/DEBIAN debian/tmp/etc/dpkg
	install -d debian/tmp/usr/doc/{copyright,dpkg}
	set -e; if [ $(arch) = i386 ]; then \
		sed -e 's/^# i386elf: //' <debian/preinst >$(cidir)/preinst ; \
	else \
		sed -e '/^# i386elf: /d' debian/preinst >$(cidir)/preinst ; \
	fi
	set -e; if [ -f debian/shlibs.default.$(arch) ]; then \
		echo /etc/dpkg/shlibs.default >$(cidir)/conffiles ; \
		cp debian/shlibs.default.$(arch) debian/tmp/etc/dpkg/shlibs.default ; \
	fi
	cp debian/{prerm,postinst} $(cidir)/.
	chmod +x $(cidir)/{postinst,prerm,preinst}
	$(MAKE) prefix=$(DIR)/debian/tmp/usr \
		datadir=$(DIR)/debian/tmp/var/lib/dpkg \
		etcdir=$(DIR)/debian/tmp/etc \
		install
	cp debian/copyright debian/tmp/usr/doc/copyright/dpkg
	cp TODO debian/tmp/usr/doc/dpkg/WISHLIST
	gzip -9v debian/tmp/usr/doc/dpkg/changelog.*
	touch debian/tmp/var/lib/dpkg/{status,available}
	dpkg-shlibdeps -dPre-Depends main/dpkg dselect/dselect
	dpkg-gencontrol
	chown -R root.root debian/tmp
	chmod -R g-ws,a+r,u+w debian/tmp
	set -e; cd debian/tmp; \
	 version=`sed -n 's/^Version: //p' DEBIAN/control`; \
	 file=dpkg_$${version}_$(arch).nondebbin.tar; \
	 tar cf ../../../$${file} usr var && gzip -9vf ../../../$${file}; \
	 cd ../..; dpkg-distaddfile $${file}.gz byhand -
	mv debian/tmp/usr/bin/dpkg-deb{,.dist}
	rm debian/tmp/var/lib/dpkg/{status,available}
	dpkg-deb --build debian/tmp ..

define checkdir
	test -f include/dpkg.h
endef

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary source diff clean checkroot