summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 898556df3676f0f47ffd28fa5d3d5620cb2286a1 (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
#!/usr/bin/make -f
# Sample debian.rules file - for GNU Hello (1.3).
# Copyright 1994,1995 by Ian Jackson.
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)
# This file may have to be extensively modified
# Copyright 1996 by Kevin Dalley
#


CC = gcc
CFLAGS = -O2 -g
# LDFLAGS = -s LDFLAGS is not correctly defined in Makefile.in
prefix=/usr
package=xsane
gimp-version=1.0

build:
	$(checkdir)
	-rm -f debian/control
	cp debian/control.$(package) debian/control
	./configure --prefix=$(prefix) --sysconfdir=/etc \
		--datadir='$$(prefix)/share/doc/$(package)' \
		 --mandir='$$(prefix)/share/man'
	$(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)"
	touch build

clean:
	$(checkdir)
	-rm -f build
	-$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
	-rm -rf *~ debian/*~ debian/files*
	-rm -rf debian/tmp-xsane debian/tmp-xsane-gimp1.1
	-rm -f debian/control
	cp debian/control.$(package) debian/control

binary-indep:	checkroot build
	$(checkdir)

# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch:	checkroot build
	$(checkdir)
	-rm -rf debian/tmp-xsane debian/tmp-xsane-gimp1.1
	install -d debian/tmp-$(package) debian/tmp-$(package)/DEBIAN
	install -d debian/tmp-$(package)$(prefix)/share/doc/$(package)
	install -d debian/tmp-$(package)$(prefix)/bin
	install debian/postrm.$(package) debian/tmp-$(package)/DEBIAN/postrm
	install debian/prerm.$(package) debian/tmp-$(package)/DEBIAN/prerm
	install debian/postinst.$(package) debian/tmp-$(package)/DEBIAN/postinst
	install -d debian/tmp-$(package)/usr/share/doc-base
	install -m 0644 debian/doc-base-$(package) \
		debian/tmp-$(package)/usr/share/doc-base/xsane
	$(MAKE) prefix=`pwd`/debian/tmp-$(package)$(prefix) \
		sysconfdir=`pwd`/debian/tmp-$(package)/etc \
		CC="$(CC)" CFLAGS="$(CFLAGS)" \
		INSTALL_PROGRAM='install -s' \
		install
	install -d debian/tmp-$(package)$(prefix)/lib/gimp/$(gimp-version)/plug-ins
	ln -sf ../../../../bin/xsane \
		debian/tmp-$(package)$(prefix)/lib/gimp/$(gimp-version)/plug-ins
	for file in xsane.AUTHOR xsane.CHANGES \
		xsane.IMAGE xsane.LANGUAGES xsane.ONLINEHELP \
		xsane.PROBLEMS xsane.TODO \
		xsane-*.lsm; \
	do \
		install -m 644 $${file} \
			debian/tmp-$(package)$(prefix)/share/doc/$(package); \
		gzip -9v debian/tmp-$(package)$(prefix)/share/doc/$(package)/$${file}; \
	done
	ln -s xsane.CHANGES.gz \
		debian/tmp-$(package)$(prefix)/share/doc/$(package)/changelog.gz
	ln -s ../sane \
		debian/tmp-$(package)$(prefix)/share/doc/$(package)/html
	gzip -9v debian/tmp-$(package)$(prefix)/share/man/man[15]/*
	install -m 0644 debian/copyright debian/tmp-$(package)$(prefix)/share/doc/$(package)/.
	install -m 0644 debian/changelog \
		debian/tmp-$(package)$(prefix)/share/doc/$(package)/changelog.Debian
	gzip -9v \
		debian/tmp-$(package)$(prefix)/share/doc/$(package)/changelog.Debian
	install -d debian/tmp-$(package)/usr/lib/menu
	install -m 0644 debian/menu.$(package) debian/tmp-$(package)/usr/lib/menu/$(package)
	dpkg-shlibdeps debian/tmp-$(package)$(prefix)/bin/*
	strip debian/tmp-$(package)$(prefix)/bin/*
	dpkg-gencontrol -isp -p$(package) -Pdebian/tmp-$(package)
	dpkg --build debian/tmp-$(package) ..

define checkdir
	test -f xsane.INSTALL -a -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

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

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

# change files so that xsane-gimp1.1 will be built
xsane-gimp1.1-files:
	$(checkdir)
	rm -f debian/changelog.new
	sed -e'1,1s/xsane /xsane-gimp1.1 /' debian/changelog > \
		debian/changelog.new
	mv debian/changelog.new debian/changelog
	rm -f debian/rules.new
	sed -e's/^package=xsane$$/package=xsane-gimp1.1/' \
		-e 's/^gimp-version=1.0$$/gimp-version=1.1/' debian/rules > \
		debian/rules.new
	mv debian/rules.new debian/rules
	chmod a+x debian/rules

# change files so that xsane will be built
xsane-files:
	$(checkdir)
	rm -f debian/changelog.new
	sed -e'1,1s/xsane-gimp1.1 /xsane /' debian/changelog > \
		debian/changelog.new
	mv debian/changelog.new debian/changelog
	rm -f debian/rules.new
	sed -e's/^package=xsane-gimp1.1$$/package=xsane/' \
		-e 's/^gimp-version=1.1$$/gimp-version=1.0/' debian/rules > \
		debian/rules.new
	mv debian/rules.new debian/rules
	chmod a+x debian/rules

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