~jon-raiford/mythbuntu/lirc

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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/usr/bin/make -f

include /usr/share/quilt/quilt.make

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

ifneq ($(findstring debug,$(DEB_BUILD_OPTIONS)),)
CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif

DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
UVERS := $(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*\)-.*/\1/p')

configure_flags := \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--libdir=\$${prefix}/lib \
		--sysconfdir=/etc/lirc/ \
		--with-driver=userspace \
		--with-syslog=LOG_DAEMON \
		--enable-sandboxed \
		--build=$(DEB_BUILD_GNU_TYPE)

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	configure_flags += --host=$(DEB_HOST_GNU_TYPE)
endif

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f debian/po/messages.mo
	rm -f configure-stamp build-stamp
	rm -f debian/modules-source/dkms.conf
	debconf-updatepo
	[ ! -f doc/lirc.hwdb.orig ] || mv -f doc/lirc.hwdb.orig doc/lirc.hwdb
	[ ! -f Makefile ] || $(MAKE) distclean
	@if [ ! "$(UVERS)" = "$(shell sed -n 's/^Version: \(.*\)/\1/p' debian/liblircclient0.pc)" ]; then \
		echo "ERROR: debian/liblircclient0.pc out of date."; \
		false; \
	fi
	dh_clean

configure: patch configure-stamp
configure-stamp:
	dh_testdir
	[ ! -f doc/lirc.hwdb.orig ] && mv -f doc/lirc.hwdb doc/lirc.hwdb.orig && sed 's/lirc_dev lirc_gpio/devinput/' doc/lirc.hwdb.orig > doc/lirc.hwdb
	-test -r config.sub && test -r /usr/share/misc/config.sub && \
		cp -f /usr/share/misc/config.sub config.sub
	-test -r config.guess && test -r /usr/share/misc/config.guess && \
		cp -f /usr/share/misc/config.guess config.guess
	./configure $(configure_flags)
	touch $@

build: configure build-stamp
build-stamp:
	dh_testdir
	$(MAKE)
	touch $@

install: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	install --mode=755 contrib/irman2lirc debian/tmp/usr/bin/

	# allow building even if vgalib is not available
	if [ -e tools/smode2 ]; then \
		install --mode=755 tools/smode2 debian/tmp/usr/bin/ ; \
	fi

	mkdir -p debian/tmp/etc/lirc/
	mkdir -p debian/tmp/usr/share/lirc/
	mkdir -p debian/tmp/usr/share/hal/fdi/preprobe/20thirdparty
	install --mode=644 debian/conf.placeholder \
		debian/tmp/etc/lirc/lircd.conf
	install --mode=644 debian/conf.placeholder \
		debian/tmp/etc/lirc/lircmd.conf
	install --mode=644 debian/hardware.conf debian/tmp/etc/lirc/
	install --mode=644 debian/lirc.fdi \
                debian/tmp/usr/share/hal/fdi/preprobe/20thirdparty/lirc.fdi
	mkdir -p debian/tmp/usr/src/lirc-${UVERS}
	cp -dpR drivers debian/tmp/usr/src/lirc-${UVERS}/
	find debian/tmp/usr/src/lirc-${UVERS} -name "*.o" -o -name Makefile.in \
		-o -name Makefile.am  -o -name "*.ko"| xargs rm

	for file in `find debian/tmp/usr/src/lirc-${UVERS} -name Makefile`; \
		do sed -e 's/^Makefile:.*/Makefile:/g' \
			-e'/^CC *=/d' -e '/^KERNEL_LOCATION *=/d' \
				$$file > $$file.tmp && \
			mv $$file.tmp $$file; \
		done
	sed -n \
		-e'/define *DEV_LIRC\>/p' \
		-e'/define *LIRC_MAJOR\>/p' \
		config.h > debian/tmp/usr/src/lirc-${UVERS}/config.h

	#Create dkms.conf
	sed s/LIRC_VERSION/${UVERS}/ debian/dkms.conf.in > debian/modules-source/dkms.conf

	cp -dpR debian/modules-source/* debian/tmp/usr/src/lirc-${UVERS}/
	mkdir -p debian/liblircclient-dev/usr/share/aclocal
	cp contrib/lirc.m4 debian/liblircclient-dev/usr/share/aclocal/

	# install logcheck files
	install -d debian/tmp/etc/logcheck/ignore.d.paranoid
	install -o root -g root -m 644 debian/logcheck.ignore \
			debian/tmp/etc/logcheck/ignore.d.paranoid/lirc
	install -d debian/tmp/etc/logcheck/ignore.d.server
	install -o root -g root -m 644 debian/logcheck.ignore \
			debian/tmp/etc/logcheck/ignore.d.server/lirc
	install -d debian/tmp/etc/logcheck/ignore.d.workstation
	install -o root -g root -m 644 debian/logcheck.ignore \
			debian/tmp/etc/logcheck/ignore.d.workstation/lirc

	# install pkg-config file
	install -d debian/tmp/usr/lib/pkgconfig
	install -o root -g root -m644 debian/liblircclient0.pc debian/tmp/usr/lib/pkgconfig/liblircclient0.pc

# Build architecture-independent files here.
binary-indep: build install
	dh_installdocs -i
	dh_installchangelogs -i ChangeLog
	dh_install -i --sourcedir=debian/tmp --list-missing
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -s ChangeLog
	dh_installdocs -s
	cp -dpR doc/html doc/images doc/irxevent.keys \
		debian/lirc/usr/share/doc/lirc/
	mkdir debian/lirc/usr/share/lirc
	cp -dpR remotes debian/lirc/usr/share/lirc/remotes
	cp -dpR debian/extras debian/lirc/usr/share/lirc/extras
	cp -dpR doc/lirc.hwdb debian/lirc/usr/share/lirc
	#sed 's/lirc_dev lirc_gpio/devinput/' doc/lirc.hwdb > debian/lirc/usr/share/lirc.hwdb
	dh_installexamples -s
	dh_install -s --sourcedir=debian/tmp --list-missing
	dh_installmenu -s
	dh_installdebconf -plirc
	dh_installinit -s --update-rcd-params="defaults 19"
	dh_installudev --priority=85
	dh_installcron -s
	dh_installinfo -s
	dh_installmodules -s
	dh_installman -s
	@for i in lirc-x lirc-svga; do \
	    rm -rf debian/$${i}/usr/share/doc/$${i} ;\
	done
	dh_link -s
	dh_strip -s
	dh_compress -s -X irxevent.keys
	dh_fixperms -s
	dh_makeshlibs -s
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

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