File: rules

package info (click to toggle)
bzip2-old 0.9.5d-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,640 kB
  • ctags: 660
  • sloc: ansic: 4,996; makefile: 177; sh: 56
file content (146 lines) | stat: -rwxr-xr-x 4,160 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
#!/usr/bin/make -f
# debian/rules file for building the Debian GNU/Linux package bzip2.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

SHELL = /bin/sh
package = bzip2

testdir=test -x debian/rules && test -f bzip2.c
testroot=test "`id -nu`" = root

build: build-stamp
build-stamp:
	$(testdir)
	# Add here commands to compile the package.
	$(MAKE)
	makeinfo manual.texi
	touch build-stamp

clean:
	$(testdir)
	$(testroot)
	rm -f build-stamp
	-$(MAKE) clean
	rm -f debian/substvars debian/files bzip2.info*
	rm -fr debian/tmp*
	find . -name "*~" -print0 | xargs -r0 rm -f

# Build architecture-independent files here.
binary-indep: build
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build
	$(testdir)
	$(testroot)
	rm -fr debian/tmp*
	install -d debian/tmp/usr

	$(MAKE) PREFIX=`pwd`/debian/tmp/usr install

	### Split

	# Development package
	install -d debian/tmp-dev/usr/lib
	mv debian/tmp/usr/lib/libbz2.{a,so} debian/tmp-dev/usr/lib/
	mv debian/tmp/usr/include debian/tmp-dev/usr/include

	# Library package
	install -d debian/tmp-lib/usr/lib
	mv debian/tmp/usr/lib/libbz2.so.???* debian/tmp-lib/usr/lib/
	mv debian/tmp/usr/lib/libbz2.so* debian/tmp-lib/usr/lib/
	chmod -x debian/tmp-lib/usr/lib/*

	# Binary package
	install -d debian/tmp-run/usr
	mv debian/tmp/usr/bin debian/tmp-run/usr/bin
	install -d debian/tmp-run/usr/share
	mv debian/tmp/usr/man debian/tmp-run/usr/share/man

	### Check the install hier
	test "$$(find debian/tmp ! -type d -print | wc -l)" -eq 0
	rm -fr debian/tmp

	### Finalize documentation

	# Man pages
	gzip -v9 debian/tmp-run/usr/share/man/man1/bzip2.1
	( cd debian/tmp-run/usr/share/man/man1 && \
	  for i in bunzip2 bzcat bzip2recover; do \
	    ln -s bzip2.1.gz $$i.1.gz; \
	  done )

	# Info
	install -d debian/tmp-run/usr/share/info
	cp bzip2.info* debian/tmp-run/usr/share/info/
	gzip -v9 debian/tmp-run/usr/share/info/*

	# Other docs in lib package
	install -d debian/tmp-run/usr/share/doc/bzip2
	cp *.ps *.html *.texi debian/tmp-run/usr/share/doc/bzip2
	gzip -v9 debian/tmp-run/usr/share/doc/bzip2/*.{ps,texi}
	cp CHANGES debian/tmp-run/usr/share/doc/bzip2/changelog
	cp debian/changelog \
	  debian/tmp-run/usr/share/doc/bzip2/changelog.Debian
	gzip -v9 debian/tmp-run/usr/share/doc/bzip2/changelog*
	cp debian/copyright debian/tmp-run/usr/share/doc/bzip2/

	# Doc-base support
	install -d debian/tmp-run/usr/share/doc-base
	cp debian/docbase debian/tmp-run/usr/share/doc-base/bzip2

	# Library package
	install -d debian/tmp-lib/usr/share/doc/libbz2
	cp debian/copyright debian/tmp-lib/usr/share/doc/libbz2/
	cp CHANGES debian/tmp-lib/usr/share/doc/libbz2/changelog
	cp debian/changelog \
	  debian/tmp-lib/usr/share/doc/libbz2/changelog.Debian
	gzip -v9 debian/tmp-lib/usr/share/doc/libbz2/changelog*

	# Other packages point to libbz2
	install -d debian/tmp-dev/usr/share/doc
	ln -s libbz2 debian/tmp-dev/usr/share/doc/libbz2-dev

	### Package finalize

	# Stripping
	strip debian/tmp-run/usr/bin/*
	strip --strip-unneeded debian/tmp-lib/usr/lib/*.so*

	# Shared lib dependencies
	LD_LIBRARY_PATH=`pwd`:$$LD_LIBRARY_PATH \
	  dpkg-shlibdeps debian/tmp-lib/usr/lib/*.so* debian/tmp-run/usr/bin/*

	# Control files
	install -d debian/tmp-{lib,dev,run}/DEBIAN
	dpkg-gencontrol -isp -Pdebian/tmp-lib -plibbz2
	#dpkg-gencontrol -isp -Pdebian/tmp-dev -plibbz2-dev
	#dpkg-gencontrol -isp -Pdebian/tmp-run -pbzip2

	cp debian/shlibs debian/tmp-lib/DEBIAN/shlibs

	for i in run dev lib; do \
	  cp debian/postinst-$$i debian/tmp-$$i/DEBIAN/postinst; \
	  cp debian/prerm-$$i debian/tmp-$$i/DEBIAN/prerm; \
	  chmod +x debian/tmp-$$i/DEBIAN/postinst; \
	  chmod +x debian/tmp-$$i/DEBIAN/prerm; \
	done
	cp debian/preinst-run debian/tmp-run/DEBIAN/preinst
	chmod +x debian/tmp-run/DEBIAN/preinst

	# Fix perms
	chown -R root.root debian/tmp*
	chmod -R a+rX-wts,u+w debian/tmp*

	# Buildit
	#dpkg --build debian/tmp-run ..
	dpkg --build debian/tmp-lib ..
	#dpkg --build debian/tmp-dev ..

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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