File: rules

package info (click to toggle)
alsa-driver 1.0.23%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,448 kB
  • ctags: 77,491
  • sloc: ansic: 473,525; sh: 3,307; makefile: 2,661; python: 1,527; perl: 1,316; awk: 66
file content (230 lines) | stat: -rwxr-xr-x 9,857 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
#!/usr/bin/make -f

# alsa-driver's debian/rules.
# Substanially rewritten by Steve Kowalik <stevenk@debian.org>
# Substanially rewritten by Thomas Hood <jdthood@yahoo.co.uk>

export DH_VERBOSE=1

SHELL := /bin/bash
# Bwahaha, let's play "Fool dpatch"
# PACKAGE := ALSA
# No, no. Switched to quilt ;)

SRC_DIR := debian/alsa-source/usr/src/modules/alsa-driver
INSTALL_UAG := -o root -g audio

#include /usr/share/quilt/quilt.make

clean:
	dh_testdir
	dh_testroot
	debconf-updatepo
	-$(RM) build-stamp
	-$(RM) include/isapnp.h
	-$(RM) -r debian/patched
	-$(RM) debian/files
	-$(RM) debian/OSS-module-list_cleaned
	-$(RM) debian/ALSA-module-list_cleaned
	-$(RM) debian/ALSA-card-list_cleaned
	-$(RM) debian/ALSA-card-list_cleaned_nobrackets
	-$(RM) debian/ALSA-card-list_cleaned_nodescriptions
	-$(RM) debian/ALSA-card-list_needingpostinstall
	-$(RM) debian/ALSA-card-list_modem
	-$(RM) debian/ALSA-card-list_tv
	dh_prep

configure: configure-stamp
configure-stamp:
	dh_testdir
	autoconf
	touch configure-stamp

build: configure build-stamp
build-stamp:
	touch build-stamp

binary: binary-indep binary-arch

binary-indep: DH_OPTIONS=-i
binary-indep: build-stamp build-source
	dh_testdir
	dh_testroot
	dh_installdirs
	### Start: Workaround bug #518242. Let udev do the job
	#install $(INSTALL_UAG) -m755 debian/alsa-base.modprobe-post-install \
	#	debian/alsa-base/lib/alsa/modprobe-post-install
	### END: Workaround bug #518242. Let udev do the job
	install $(INSTALL_UAG) -m755 debian/alsa-base.apm \
		debian/alsa-base/etc/apm/scripts.d/alsa
	install $(INSTALL_UAG) -m755 snddevices \
		debian/alsa-base/usr/share/alsa-base/snddevices
	install $(INSTALL_UAG) -m755 debian/alsa-base.init \
		debian/alsa-base/usr/sbin/alsa
	install $(INSTALL_UAG) -m644 debian/alsa-base.defaultfile \
		debian/alsa-base/usr/share/alsa-base/alsa.default
	install $(INSTALL_UAG) -m644 debian/alsa-source.conf \
		debian/alsa-source/usr/share/alsa-source/alsa-source.conf
	install $(INSTALL_UAG) -m755 debian/program-wrapper \
		debian/alsa-base/usr/share/alsa-base
	### Generate lists
	cat debian/OSS-module-list \
		| sed -e 's/^[[:space:]]*//' -e 's/#.*//' -e '/^$$/d' \
		> debian/OSS-module-list_cleaned
	cat debian/ALSA-module-list \
		| sed -e 's/^[[:space:]]*//' -e 's/#.*//' -e '/^$$/d' \
		> debian/ALSA-module-list_cleaned
	cat debian/ALSA-card-list \
		| sed -e 's/^[[:space:]]*//' -e 's/#.*//' -e 's/,//' -e '/^$$/d' \
		> debian/ALSA-card-list_cleaned
	cat debian/ALSA-card-list_cleaned \
		| sed -e 's/ \[[^]]*\]//' \
		> debian/ALSA-card-list_cleaned_nobrackets
	cat debian/ALSA-card-list_cleaned \
		| sed -e 's/ .*$$//' \
		> debian/ALSA-card-list_cleaned_nodescriptions
	cat debian/ALSA-card-list_cleaned \
		| sed -e '/MODEM/d' \
		      -e '/TV/d' \
		      -e '/UNREAL/d' \
		      -e '/NOPOSTINSTALL/d' \
		> debian/ALSA-card-list_needingpostinstall
	cat debian/ALSA-card-list_cleaned \
		| grep -e 'MODEM' \
		> debian/ALSA-card-list_modem
	cat debian/ALSA-card-list_cleaned \
		| grep -e 'TV' \
		> debian/ALSA-card-list_tv
	### Generate alsa-source.templates
	cp -p debian/alsa-source.templates debian/alsa-source.templates_BAK
	cat debian/alsa-source.templates_BAK \
		| sed "s%_CARDS_WITH_DESCRIPTIONS_%$$(echo $$(sed -e '$$!s/$$/, /' debian/ALSA-card-list_cleaned_nobrackets))%" \
		| sed "s%_CARDS_WITHOUT_DESCRIPTIONS_%$$(echo $$(sed -e '$$!s/$$/, /' debian/ALSA-card-list_cleaned_nodescriptions))%" \
		> debian/alsa-source.templates
	### Install blacklists and related
	install $(INSTALL_UAG) -m644 debian/OSS-module-list_cleaned \
		debian/linux-sound-base/usr/share/linux-sound-base/OSS-module-list
	install $(INSTALL_UAG) -m644 debian/OSS-module-list_cleaned \
		debian/linux-sound-base/lib/linux-sound-base/noOSS.udev.blacklist
	install $(INSTALL_UAG) -m644 debian/ALSA-module-list_cleaned \
		debian/linux-sound-base/usr/share/linux-sound-base/ALSA-module-list
	install $(INSTALL_UAG) -m644 debian/ALSA-module-list_cleaned \
		debian/linux-sound-base/lib/linux-sound-base/noALSA.udev.blacklist
	cat debian/OSS-module-list_cleaned \
		| sed -e 's/[[:space:]].*//' -e 's/^/blacklist /' \
		> debian/linux-sound-base/lib/linux-sound-base/noOSS.modprobe.conf
	cat debian/ALSA-module-list_cleaned \
		| sed -e 's/[[:space:]].*//' -e 's/^/blacklist /' \
		> debian/linux-sound-base/lib/linux-sound-base/noALSA.modprobe.conf
	echo '# Uncomment these entries in order to blacklist unwanted modem drivers' \
		> debian/alsa-base/etc/modprobe.d/alsa-base-blacklist.conf
	cat debian/ALSA-card-list_modem \
		| sed -e 's/[[:space:]].*//' -e 's/^/# blacklist snd-/' \
		>> debian/alsa-base/etc/modprobe.d/alsa-base-blacklist.conf
	echo '# Comment this entry in order to load snd-pcsp driver' \
		>> debian/alsa-base/etc/modprobe.d/alsa-base-blacklist.conf
	echo 'blacklist snd-pcsp' \
		>> debian/alsa-base/etc/modprobe.d/alsa-base-blacklist.conf
	echo '# Comment this entry in order to load pcspkr driver' \
		>> debian/alsa-base/etc/modprobe.d/alsa-base-blacklist.conf
	#echo 'blacklist pcspkr' \
	#	>> debian/alsa-base/etc/modprobe.d/alsa-base-blacklist.conf
	### Install module options
	install $(INSTALL_UAG) -m644 debian/alsa-base.modprobe \
		debian/alsa-base/etc/modprobe.d/alsa-base.conf
	### Start: Workaround bug #518242. Let udev do the job
	#echo "# Cause a script to be run after card driver module initialization" \
	#	>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	#cat debian/ALSA-card-list_needingpostinstall \
	#	| sed -e 's/[[:space:]].*//' -e 's%\(.*\)%install snd-\1 /sbin/modprobe --ignore-install snd-\1 $$CMDLINE_OPTS \&\& /lib/alsa/modprobe-post-install snd-\1%' \
	#	>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	### End: Workaround bug #518242. Let udev do the job
	### The default index of these drivers is -2 as of ALSA 1.0.9
	echo "# Prevent abnormal drivers from grabbing index 0" \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	cat debian/ALSA-card-list_tv \
		| sed -e 's/[[:space:]].*//' -e 's%\(.*\)%options \1 index=-2%' \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	cat debian/ALSA-card-list_modem \
		| sed -e 's/[[:space:]].*//' -e 's%\(.*\)%options snd-\1 index=-2%' \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	### This is for kernels >= 2.6.26
	echo "# Keep snd-pcsp from beeing loaded as first soundcard" \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	echo "options snd-pcsp index=-2" \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	echo "# Keep snd-usb-audio from beeing loaded as first soundcard" \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	echo "options snd-usb-audio index=-2" \
		>> debian/alsa-base/etc/modprobe.d/alsa-base.conf
	### Install debconf templates
	dh_installdebconf
	cp -p debian/alsa-source.templates_BAK debian/alsa-source.templates && rm -f debian/alsa-source.templates_BAK
	dh_lintian
	install -p -m 0644 -o root -g root debian/alsa-base.bug.presubj \
		debian/alsa-base/usr/share/bug/alsa-base/presubj
	install -p -m 0644 -o root -g root debian/alsa-source.bug.presubj \
		debian/alsa-source/usr/share/bug/alsa-source/presubj
	install -p -m 0644 -o root -g root debian/alsa-base.bug.control \
		debian/alsa-base/usr/share/bug/alsa-base/control
	install -p -m 0644 -o root -g root debian/alsa-source.bug.control \
		debian/alsa-source/usr/share/bug/alsa-source/control
	install -p -m 0755 -o root -g root debian/alsa-base.bug.script \
		debian/alsa-base/usr/share/bug/alsa-base/script
	install -p -m 0755 -o root -g root debian/alsa-source.bug.script \
		debian/alsa-source/usr/share/bug/alsa-source/script
	dh_installdocs
	dh_installman
	dh_installchangelogs -i
	dh_installchangelogs -palsa-source -palsa-base debian/changelog.ALSA
	dh_installdocs -p alsa-base debian/changelog-old.Debian
	cp debian/PATCHES.Debian \
		debian/alsa-source/usr/share/doc/alsa-source/
	mkdir debian/alsa-base/usr/share/doc/alsa-base/driver
	mv debian/alsa-base/usr/share/doc/alsa-base/Documentation/*.txt \
		debian/alsa-base/usr/share/doc/alsa-base/driver
	mv debian/alsa-base/usr/share/doc/alsa-base/Documentation/*.html \
		debian/alsa-base/usr/share/doc/alsa-base/driver
	rm -rf debian/alsa-base/usr/share/doc/alsa-base/Documentation
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Nothing to do 
binary-arch:

build-source:
	mkdir -p $(SRC_DIR)/debian/bug
	find . \( -path './debian' -o -name 'CVS' -o -name '.cvsignore'  -o -name '*-stamp' \) -prune -o -print | cpio -admp $(SRC_DIR)
	#Can't use upstream's makefiles because we don't run configure
	#-$(MAKE) -C $(SRC_DIR) clean
	chown -R root:src debian/alsa-source/usr/src
	# alsa-source/debian/*
	install -m755 debian/alsa-source.rules $(SRC_DIR)/debian/rules
	install -m644 debian/alsa-source.control $(SRC_DIR)/debian/control
	install -m644 debian/copyright $(SRC_DIR)/debian/copyright
	install -m644 debian/changelog $(SRC_DIR)/debian/changelog
	install -m644 debian/changelog.ALSA $(SRC_DIR)/debian/changelog.ALSA
	echo 5 > $(SRC_DIR)/debian/compat
	# And fix perms on the directory ...
	find debian/alsa-source -type d -exec chmod 775 {} \;
	find debian/alsa-source/usr/src/modules -type d -exec chmod 2775 {} \;
	# As much as I hate automatically generated stuff, automatically generate
	# files.
	major_ver="$(shell head -n 1 debian/changelog | cut -d\( -f2 | cut -d\) -f1 | cut -d. -f1-2)"; \
	for i in preinst postinst prerm postrm ; do \
		if [ -f debian/alsa-modules.$$i ] ; then \
			cat debian/alsa-modules.$$i | sed -e "s/_MAJORVERSION_/$$major_ver/g" > $(SRC_DIR)/debian/$$i; \
		fi \
	done
	install -m644 debian/alsa-modules.bug.control $(SRC_DIR)/debian/bug/control
	# Build the tarball, debian/* mess over.
	cd debian/alsa-source/usr/src && tar cf alsa-driver.tar modules
	$(RM) -r debian/alsa-source/usr/src/modules
	bzip2 -9 debian/alsa-source/usr/src/alsa-driver.tar

.PHONY: binary binary-arch binary-indep build-source clean