File: rules

package info (click to toggle)
dpkg 1.4.0.23.2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,208 kB
  • ctags: 1,683
  • sloc: ansic: 10,310; perl: 5,453; cpp: 3,825; sh: 2,177; makefile: 591; lisp: 243
file content (154 lines) | stat: -rwxr-xr-x 5,558 bytes parent folder | download
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
#!/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


Makefile.in: Makefile.am
	$(checkdir)
	$(RM) config.status
	aclocal -I ./automake
	autoheader
	autoconf
	gettextize --force
	libtoolize --automake --copy --force
	$(RM) config.sub config.guess 
	ln -s /usr/share/automake/config.sub .
	automake --add-missing

$(BUILD)/Makefile: Makefile.in
	$(checkdir)
	$(RM) -r debian/build
	install -d debian/build
	cd $(BUILD) && ../../configure \
		--enable-shared --with-included-gettext \
		--prefix=/usr \
		--datadir=/usr/share \
		--sysconfdir=/etc \
		--sharedstatedir=/var/lib \
		--localstatedir=/var/lib

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

build: $(BUILD)/Makefile
	$(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/doc/dpkg}
	install -d debian/tmp-dev/usr/{lib/dpkg,doc/dpkg-dev,man/man1,man/man8,sbin,bin}
	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)/.
	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/etc/xemacs/site-start-19.d
	install -c debian/50dpkg-dev.el debian/tmp-dev/etc/xemacs/site-start-19.d/
	chmod +x $(mcidir)/{postinst,prerm,preinst}
	$(MAKE) -C $(BUILD) top_distdir=. dist 
	$(MAKE) -C $(BUILD) \
		prefix=$(DIR)/debian/tmp-main/usr \
		sysconfdir=$(DIR)/debian/tmp-main/etc \
		datadir=$(DIR)/debian/tmp-main/usr/share \
		sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
		localstatedir=$(DIR)/debian/tmp-main/var/lib \
		install
	find debian/tmp-main/usr/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/man/man1/$$f.1; \
		ln -s dpkg-source.1.gz debian/tmp-main/usr/man/man1/$$f.1.gz ; \
	done
	gzip -9vf debian/tmp-main/usr/doc/dpkg/changelog*
	cp debian/copyright debian/tmp-main/usr/doc/dpkg/copyright
	cp debian/copyright debian/tmp-dev/usr/doc/dpkg-dev/copyright
	cp debian/dev-README debian/tmp-dev/usr/doc/dpkg-dev/README
	set -e; for f in \
 usr/doc/dpkg/{internals.html,developer-keys.pgp,changelog.manuals.gz} \
 usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \
 usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages,dpkg-name} \
 usr/man/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage}.1.gz \
 usr/man/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date,dpkg-name}.1.gz \
 usr/man/man5 usr/man/man8/dpkg-scanpackages.8.gz \
 usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \
 usr/doc/dpkg/packaging.html \
		; do mv debian/tmp-main/$$f debian/tmp-dev/$$f; 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 packaging; 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