File: rules

package info (click to toggle)
debdelta 0.62
  • links: PTS
  • area: main
  • in suites: buster
  • size: 984 kB
  • sloc: python: 6,032; perl: 1,398; sh: 965; xml: 727; ansic: 215; makefile: 112; awk: 21
file content (127 lines) | stat: -rwxr-xr-x 4,066 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# Sample debian/rules file; from GNU Hello,  Copyright 1994,1995 by Ian Jackson.

package = debdelta

D = debian/debdelta

BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)

docdir = $(D)/usr/share/doc/$(package)
mandir = $(D)/usr/share/man/man1/

D2 = debian/debdelta-doc

docdir2 = $(D2)/usr/share/doc/$(package)
docdir2doc = $(D2)/usr/share/doc/$(package)-doc

PO_FILES := $(wildcard po/*.po)
MO_FILES := $(patsubst %.po,%.mo,$(PO_FILES))
LANGS := $(patsubst po/%.po,%,$(PO_FILES))

CC = gcc

INSTALL_PROGRAM = install

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  INSTALL_PROGRAM += -s
endif

minibzip2: minigzip.c
	$(CC) -DBZIP $(CFLAGS) $(CPPFLAGS) minigzip.c -o minibzip2  $(LDFLAGS) -lbz2

minigzip: minigzip.c
	$(CC) $(CFLAGS) $(CPPFLAGS) minigzip.c -o minigzip $(LDFLAGS) -lz

build-arch: minibzip2 minigzip
	$(checkdir)
	touch build

build-indep:

build: build-arch build-indep

clean:
	$(checkdir)
	rm -f build *~ */*~ debian/files* debian/substvars
	rm -f minigzip minibzip2
	rm -rf $(D) $(D2)

binary-indep:	checkroot build
	$(checkdir)
	rm -rf $(D2)
	install -d $(D2)/DEBIAN  $(docdir2)  $(docdir2doc)
	cp doc/debdelta_suite.pdf debian/copyright debian/changelog $(docdir2doc)
	cd $(docdir2doc) && gzip -9n changelog
	cp -r doc/html  $(docdir2doc)
	ln -s ../debdelta-doc/debdelta_suite.pdf  $(docdir2)
	ln -s ../debdelta-doc/html  $(docdir2)
	# build package
	dpkg-gencontrol -Pdebian/debdelta-doc -pdebdelta-doc
	chown -R root:root $(D2)
	find debian/debdelta-doc -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg-deb --build $(D2) ..

binary-arch:	checkroot build
	$(checkdir)
	rm -rf $(D)
	# dirs
	install -d $(D)/DEBIAN $(D)/usr/bin $(docdir) $(mandir) $(D)/usr/lib/debdelta $(D)/usr/share/debdelta $(D)/usr/share/keyrings
	set -e ; for L in $(LANGS) ; do install -d $(D)/usr/share/locale/$${L}/LC_MESSAGES ; done
	# control
	install -m 755 debian/postrm $(D)/DEBIAN/
	install -m 755 debian/postinst $(D)/DEBIAN/
	# /usr/share
	set -e ; for L in $(LANGS) ; do 	cp po/$${L}.mo $(D)/usr/share/locale/$${L}/LC_MESSAGES/debdelta.mo ; done
	install debpatch.sh $(D)/usr/share/debdelta
	install contrib/debmirror-delta-security $(D)/usr/share/debdelta/
	install contrib/debmirror-marshal-deltas $(D)/usr/share/debdelta/
	install contrib/debmarshal_list_useless_debs $(D)/usr/share/debdelta/
	install contrib/dpkg-sig $(D)/usr/share/debdelta
	cp contrib/debmirror*trash_option.patch  $(D)/usr/share/debdelta
	ln -s ../../bin/debdelta  $(D)/usr/share/debdelta/debpatch-url
	cp keyrings/pub.gpg $(D)/usr/share/keyrings/debian-debdelta-archive-keyring.gpg
	chmod 0644 $(D)/usr/share/keyrings/debian-debdelta-archive-keyring.gpg
	# /usr/lib
	$(INSTALL_PROGRAM)  minigzip $(D)/usr/lib/debdelta/minigzip
	$(INSTALL_PROGRAM)  minibzip2 $(D)/usr/lib/debdelta/minibzip2
	# /etc
	install -d $(D)/etc/debdelta
	cp etc/sources.conf $(D)/etc/debdelta/sources.conf
	echo /etc/debdelta/sources.conf >> $(D)/DEBIAN/conffiles
	# /usr/bin
	install debdelta $(D)/usr/bin/debdelta
	ln -s debdelta  $(D)/usr/bin/debpatch
	ln -s debdelta  $(D)/usr/bin/debdeltas
	ln -s debdelta  $(D)/usr/bin/debdelta-upgrade
	# /usr/share/doc
	cp FAQ README.features debian/copyright debian/changelog $(docdir)
	cd $(docdir) && gzip -9n changelog FAQ
	# man
	cp *.1 $(mandir)
	gzip -9n $(mandir)/*.1 
	# build package
	dpkg-shlibdeps $(D)/usr/lib/debdelta/minigzip  $(D)/usr/lib/debdelta/minibzip2
	dpkg-gencontrol -Pdebian/debdelta -pdebdelta
	chown -R root:root $(D)
	find debian/debdelta -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg-deb --build $(D) ..

define checkdir
	test -f debdelta -a -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test $$(id -u) = 0

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