summaryrefslogtreecommitdiff
path: root/debian/rules
blob: e64174fb7298a66abf37d91fb80cc19bb490bac0 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/make -f
# -*- makefile -*-

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

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
	DEPENDENCIES =
else
	CFLAGS += -O2
ifneq (,$(findstring ratpoison:gendeps,$(DEB_BUILD_OPTIONS)))
	DEPENDENCIES =
else
	DEPENDENCIES = --disable-dependency-tracking
endif
endif

config.status: configure
	dh_testdir
	if grep 'install-info --version | fgrep' doc/Makefile.in ; then \
		echo "incompatible install-info call in doc/Makefile.in!" >&2 ;\
		exit 1 ; \
	fi
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
	    --prefix=/usr \
	    --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
	    --with-xterm=x-terminal-emulator \
	    --with-menu="/etc/X11/ratpoison/ratpoisonmenu debian.menu" \
	    $(DEPENDENCIES) \
	    --x-includes="" --x-libraries="" \
	    CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,syms"

build-arch: build-arch-stamp
build-arch-stamp: config.status
	dh_testdir

	$(MAKE)
	# bindings for the different languages
	cd contrib && ./genrpbindings
	# manpage for rpws
	pod2man contrib/rpws rpws.1
	touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp:
	touch build-indep-stamp
build: build-arch build-indep

clean:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp

	if [ -e config.status ] ; then $(MAKE) distclean ; fi
	-rm -f contrib/Ratpoison.pm contrib/ratpoison-cmd.el contrib/ratpoison.lisp contrib/ratpoison.py contrib/ratpoison.rb
	-rm -f rpws.1
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	dh_clean

install: install-arch install-indep

install-indep: build-indep

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install pkgdatadir=/usr/share/doc/ratpoison/examples DESTDIR=$(CURDIR)/debian/ratpoison
	# Those are installed to different places already by dh_*
	rm $(CURDIR)/debian/ratpoison/usr/share/doc/ratpoison/COPYING
	rm $(CURDIR)/debian/ratpoison/usr/share/doc/ratpoison/ChangeLog
	# not needed two times:
	rm $(CURDIR)/debian/ratpoison/usr/share/doc/ratpoison/examples/rpws
	# The menu command:
	install -D -m 0755 debian/callmenu.sh $(CURDIR)/debian/ratpoison/etc/X11/ratpoison/ratpoisonmenu

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

# Build architecture-dependent files here.
binary-arch: build-arch install-arch
	dh_testdir
	dh_testroot
	dh_install
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installexamples
	dh_installemacsen
	dh_installmenu
	dh_installinfo doc/ratpoison.info
	dh_installman rpws.1
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

RATPOISON_VERSION=1.4.1
RATPOISON_CVSVERSION=1.4.1~CVS$(shell date +%Y%m%d)
RATPOISON_UVERSION=1.4.1-CVS

# some helpers for me
# just ignore those if you want to do a NMU or a security upload, change the files outside
# of debian/patches and do an upload. The patches are only stored there for reference and
# so I do not loose them.
maintainer-clean:
	quilt refresh
	quilt push -a || true
	rm -f .pc patches
maintainer-unclean:
	ln -s "../pc-ratpoison-$(RATPOISON_VERSION)" .pc
	ln -s debian/patches patches
	quilt push -a
maintainer-ready:
	test ! -d "../ratpoison-$(RATPOISON_VERSION)"
	test ! -d "../pc-ratpoison-$(RATPOISON_VERSION)"
	rm -rf "ratpoison-$(RATPOISON_UVERSION)"
	tar -xzf "../ratpoison_$(RATPOISON_VERSION).orig.tar.gz"
	mv "ratpoison-$(RATPOISON_UVERSION)" "../ratpoison-$(RATPOISON_VERSION)"
	cp -a debian "../ratpoison-$(RATPOISON_VERSION)/"
	rm -rf "../ratpoison-$(RATPOISON_VERSION)/debian/CVS"
	rm -rf "../ratpoison-$(RATPOISON_VERSION)/debian/patches/CVS"
	mkdir "../pc-ratpoison-$(RATPOISON_VERSION)"
	ln -s "../pc-ratpoison-$(RATPOISON_VERSION)" "../ratpoison-$(RATPOISON_VERSION)/.pc"
	ln -s debian/patches "../ratpoison-$(RATPOISON_VERSION)/patches"
	cd "../ratpoison-$(RATPOISON_VERSION)" && quilt upgrade && quilt push -a
maintainer-cvs:
	make dist
	mv "ratpoison-$(RATPOISON_UVERSION).tar.gz" "../ratpoison_$(RATPOISON_CVSVERSION).orig.tar.gz"
	./debian/rules maintainer-ready RATPOISON_VERSION="$(RATPOISON_CVSVERSION)"
	cd "../ratpoison-$(RATPOISON_CVSVERSION)" && ./debian/rules maintainer-clean
	cd "../ratpoison-$(RATPOISON_CVSVERSION)" && dch -v "$(RATPOISON_CVSVERSION)-0" -D "LOCAL"


binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install get-orig-source make-orig-source-working