File: rules

package info (click to toggle)
lirc 0.7.1pre2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,852 kB
  • ctags: 2,924
  • sloc: ansic: 31,205; sh: 12,021; makefile: 631
file content (250 lines) | stat: -rwxr-xr-x 8,256 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess. 

# dpatch support
include /usr/share/dpatch/dpatch.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

# shared library versions, option 1
version=0.0.0
major=0
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
#version=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
#major=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`

export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


autotools:
	@OLDDATESUB=`./config.sub -t | tr -d -` ;\
	OLDDATEGUESS=`./config.guess -t | tr -d -` ;\
	NEWDATESUB=`/usr/share/misc/config.sub -t | tr -d -` ;\
	NEWDATEGUESS=`/usr/share/misc/config.guess -t | tr -d -` ;\
	if [ $$OLDDATESUB -lt $$NEWDATESUB -o \
	     $$OLDDATEGUESS -lt $$NEWDATEGUESS ]; then \
	   dch -a -p "GNU config automated update: config.sub\
	     ($$OLDDATESUB to $$NEWDATESUB), config.guess\
	     ($$OLDDATEGUESS to $$NEWDATEGUESS)" ;\
	   cp -f /usr/share/misc/config.sub config.sub ;\
	   cp -f /usr/share/misc/config.guess config.guess ;\
	   echo WARNING: GNU config scripts updated from master copies 1>&2 ;\
	fi

build: build-stamp
build-stamp: patch
	dh_testdir
	./configure --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
		--prefix=/usr --mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--libdir=\$${prefix}/lib --sysconfdir=/etc/lirc/ \
		--with-driver=any \
		--with-moduledir="/lib/modules/$(shell uname -r)/misc" \
		--with-port=0x3f8 --with-irq=4 \
		--disable-manage-devices \
		--with-syslog=LOG_DAEMON \
		--enable-sandboxed \
		--srcdir=
	# Add here commands to compile the package.
	$(MAKE) CFLAGS="$(CFLAGS)"
	#$(MAKE) smode2 -C tools

	touch build-stamp

#clean: autotools unpatch
clean: autotools
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean
	rm -f tools/smode2 tools/smode2.o config.log config.status

	dh_clean

	@if [ -f debian/lirc.config.in ];then \
		rm -vf debian/lirc.config; \
	else \
		echo "#############################################"; \
		echo "###### lirc.config.in does not exist. #######"; \
		echo "###### refusing to delete lirc.config #######"; \
		echo "#############################################"; \
		exit 1; \
	fi

	# Fix the posible timestamp skews when dpkg-source applies the debian
	# patch
	#
	# It is currently not needed, and it probably doesn't work well with
	# dpatch.
	#find . -exec touch -r $(PWD)/configure {} \;

debian/lirc.config.md5sum:
	md5sum configure.in setup.sh > $@

debian/lirc.config: debian/lirc.config.in configure.in setup.sh \
			debian/lirc.config.md5sum
	@if ! md5sum -v -c debian/lirc.config.md5sum; then \
		echo "#####################################################"; \
		echo "# The files above have changed:                     #"; \
		echo "# Please check that the extraction will be correct  #"; \
		echo "# and remove debian/lirc.config.md5sum              #"; \
		echo "#####################################################"; \
		exit 1;\
	fi

	# Extract some hardware heuristic and setup shellscript from upstream
	sed -n -e'1,/#UPSTREAM SETUP#/p' debian/lirc.config.in > $@
	echo 'SetupDriver() {' >> $@
	cat setup-driver.sh >> $@
	echo '}' >> $@
	sed -n -e's/^ *\. setup-driver.sh/    SetupDriver/;1,/Main Program/p'  setup.sh >> $@
	sed -n -e'/#UPSTREAM SETUP#/,/#UPSTREAM HEURISTICS#/p' \
		debian/lirc.config.in >> $@
	sed -n \
		-e's/\(AC_DEFINE\) *(\(.*\))/\1 \2/' \
		-e'/^#START HARDWARE HEURISTIC/,/^#END HARDWARE HEURISTIC/p' \
		configure.in >> $@
	sed -n -e'/#UPSTREAM HEURISTICS#/,$$p' debian/lirc.config.in >> $@


install: build debian/lirc.config
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/lirc.
	$(MAKE) install prefix=`pwd`/debian/tmp/usr
	#Rename 'rc' into 'irsend' to prevent clash with 'rc' package.
	#mv debian/tmp/usr/share/man/man1/rc.1 \
	#	debian/tmp/usr/share/man/man1/irsend.1
	#mv debian/tmp/usr/bin/rc debian/tmp/usr/bin/irsend

	install --mode=755 contrib/irman2lirc debian/tmp/usr/bin/

	#Allow building evenif 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/
	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-modules-source.conf debian/tmp/etc/lirc/
	#rm debian/lirc/usr/lib/liblirc_client.la
	mkdir -p debian/tmp/usr/src/modules/lirc
	cp -dpR drivers debian/tmp/usr/src/modules/lirc/
	#rm -f debian/tmp/usr/src/lirc/drivers/Makefile*
	find debian/tmp/usr/src/modules/lirc -name "*.o" -o -name Makefile.in \
		-o -name Makefile.am | xargs rm
	for file in `find debian/tmp/usr/src/modules/lirc -name Makefile`; \
		do sed -e'/configure\.in/,/CONFIG_HEADERS/D' \
			-e'/^CC *=/d' -e '/^KERNEL_LOCATION *=/d' \
				$$file > $$file.tmp && \
			mv $$file.tmp $$file; \
		done
	#cp config.h debian/tmp/usr/src/modules/lirc/
	sed -n \
		-e'/define *DEV_LIRC\>/p' \
		-e'/define *LIRC_MAJOR\>/p' \
		config.h > debian/tmp/usr/src/modules/lirc/config.h
	cp -dpR debian/modules-source/* debian/tmp/usr/src/modules/lirc/
	chmod +x debian/tmp/usr/src/modules/lirc/debian/rules
	cp debian/changelog debian/copyright \
		debian/tmp/usr/src/modules/lirc/debian/
	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 -d debian/tmp/etc/devfs/conf.d/
	install -o root -g root -m 644 debian/devfs.conf \
			debian/tmp/etc/devfs/conf.d/lirc         
	install -d debian/tmp/etc/devfs/devices.d/
	install -o root -g root -m 644 debian/devfs.devices \
			debian/tmp/etc/devfs/devices.d/lirc


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

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -s ChangeLog
	#
	# build liblirc${major} package by moving files from lirc-dev
	#
	#rm -fr debian/lirc/usr/include

	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
	dh_installexamples -s
	dh_install -s --sourcedir=debian/tmp --list-missing
	cd debian/lirc-modules-source/usr/src/ && \
		tar czf lirc-modules.tar.gz modules && \
		rm -rf modules
	dh_installmenu -s
#	dh_installdebconf	
	dh_installdebconf -plirc
	dh_installdebconf -plirc-modules-source
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
	dh_installinit -s --update-rcd-params="defaults 19"
	dh_installcron -s
	dh_installinfo -s
	dh_installmodules -s
#	dh_undocumented -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_perl
#	dh_python
	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