/[kernel]/trunk/kernel/source/linux-2.6-2.6.12/debian/rules
ViewVC logotype

Contents of /trunk/kernel/source/linux-2.6-2.6.12/debian/rules

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3531 - (show annotations) (download)
Sat Jul 16 03:14:13 2005 UTC (7 years, 10 months ago) by joshk
File size: 9187 byte(s)
add the orig target back for development convenience
add 2.6.12.3 patch
1 #!/usr/bin/make -f
2 #
3 # Required variables. See README for a description of all the variables.
4 #
5 abiname := 1
6 #
7 # Generally nothing needs to be modified below this line
8 #
9 SHELL := sh -e
10 karch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
11 srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
12 version := $(word 1,$(subst -, ,$(srcver)))
13 ltver := $(word 2,$(subst -, ,$(srcver)))
14 major_v := $(word 1,$(subst ., ,$(version)))
15 minor_v := $(word 2,$(subst ., ,$(version)))
16 major := $(major_v).$(minor_v)
17 release := $(version)-$(ltver)
18 uver := $(subst .,_,$(version))
19 #
20 # Construct depends and provides for the linux-tree
21 #
22 lt_depends += $(shell seq -f 'linux-source-$(version) (= $(version)-%g)' \
23 -s ' | ' 1 $(ltver))
24 lt_provides := $(shell seq -f 'linux-tree-$(version)-%g' -s ', ' 1 $(ltver))
25 #
26 # If we are not passed a subarchs variable, we obtain the complete
27 # subarch list as a list of subdirectories in arch/$(karch). We
28 # also export the flavours variables, which allows to control which
29 # flavours are built.
30 #
31 ifndef subarchs
32 subarchs := $(shell find debian/arch/$(karch) \
33 -mindepth 1 -maxdepth 1 -type d \
34 ! -name '.svn' -printf '%f\n')
35 endif
36 ifeq (,$(subarchs))
37 subarchs := none
38 endif
39 #
40 # The following definition gets the list of relevant files in the top-level
41 # directory. At this point we cannot verify that we are in top-level dir
42 # (we probably are), so it should be referenced only in the targets which
43 # run dh_testdir in the beginning.
44 #
45 source_files = $(filter-out debian linux-source-$(version), $(shell echo *))
46
47 export version abiname ltver kbuildver flavours major uver
48
49 patch: debian/patch-stamp
50 debian/patch-stamp: debian/bin/apply
51 dh_testdir
52 override_version=$(release) home=debian/patches-debian debian/bin/apply
53 # make-kpkg does this when building kernel-source.
54 mv scripts/package/Makefile scripts/package/Makefile.dist
55 mv scripts/package/builddeb scripts/package/builddeb.dist
56 echo "# Dummy Makefile" > scripts/package/Makefile
57 echo "all:" >> scripts/package/Makefile
58 touch debian/patch-stamp
59
60 unpatch:
61 dh_testdir
62 if [ -e debian/patch-stamp ]; then \
63 override_version=$(release) home=debian/patches-debian \
64 debian/bin/apply $(version); \
65 cd scripts/package; \
66 mv Makefile.dist Makefile; \
67 mv builddeb.dist builddeb; \
68 fi
69 rm -f debian/patch-stamp
70 #
71 # linux-source package
72 #
73 spkg := linux-source-$(version)
74 sdir := debian/$(spkg)/usr/src
75 source: debian/source-stamp
76 debian/source-stamp: debian/patch-stamp
77 dh_testdir
78 dh_testroot
79 dh_installdirs -p$(spkg) /usr/src
80 # Link the files and create a tarball in correct location
81 mkdir $(spkg)
82 cp -al $(source_files) $(spkg)
83 tar -cjf $(sdir)/$(spkg).tar.bz2 $(spkg)
84 rm -rf $(spkg)
85 dh_installdocs -p$(spkg) README
86 dh_installchangelogs -p$(spkg)
87 dh_compress -p$(spkg)
88 dh_fixperms -p$(spkg)
89 dh_installdeb -p$(spkg)
90 dh_gencontrol -p$(spkg)
91 dh_md5sums -p$(spkg)
92 dh_builddeb -p$(spkg)
93 touch debian/source-stamp
94 #
95 # linux-tree package
96 #
97 tpkg := linux-tree-$(version)
98 tree: debian/tree-stamp
99 debian/tree-stamp:
100 dh_testdir
101 dh_testroot
102 dh_installdirs -p$(tpkg)
103 dh_installdocs -p$(tpkg)
104 dh_installchangelogs -p$(tpkg)
105 dh_compress -p$(tpkg)
106 dh_fixperms -p$(tpkg)
107 dh_installdeb -p$(tpkg)
108 dh_gencontrol -p$(tpkg)
109 dh_md5sums -p$(tpkg)
110 dh_builddeb -p$(tpkg)
111 touch debian/tree-stamp
112 #
113 # linux-patch-debian
114 #
115 ppkg := linux-patch-debian-$(version)
116 pbase := /usr/src/kernel-patches/all/$(version)
117 pfull := debian/$(ppkg)$(pbase)
118 pdirs := $(pbase) $(pbase)/apply $(pbase)/debian $(pbase)/unpatch
119 ptchs := $(notdir $(wildcard debian/patches-arch/*))
120 kptch := debian/$(ppkg).kpatches.arch
121 pcdir := debian/patches-arch
122 patch-debian: debian/patch-debian-stamp
123 debian/patch-debian-stamp: debian/bin/apply debian/bin/unpatch
124 dh_testdir
125 dh_testroot
126 dh_installdirs -p$(ppkg) $(pdirs)
127 dh_install -p$(ppkg) debian/patches-debian/* $(pbase)/debian
128 # Install the debian patches
129 sed 's/@version@/$(release)/g' debian/bin/apply > $(pfull)/apply/debian
130 sed 's/@upstream@/$(version)/g' debian/bin/unpatch > $(pfull)/unpatch/debian
131 chmod a+x $(pfull)/apply/debian $(pfull)/unpatch/debian
132 chmod -x $(pfull)/debian/*.patch
133 bzip2 -9 $(pfull)/debian/*.patch
134 # Now the arch/subarch-specific patches
135 for i in $(ptchs); do \
136 rm -f $(kptch); \
137 arch=$${i%%.*}; \
138 echo "Patch-name: $${arch}" >> $(kptch); \
139 echo "Patch-id: $${arch}_$(uver)" >> $(kptch); \
140 echo "Path-strip-level: 1" >> $(kptch); \
141 echo >> $(kptch); \
142 echo "Patch-file: $(pcdir)/$${i}" >> $(kptch); \
143 echo "Architecture: $${arch}" >> $(kptch); \
144 echo "Kernel-version: $(version)" >> $(kptch); \
145 dh_installkpatches -p$(ppkg); \
146 done
147 dh_fixperms -p$(ppkg)
148 dh_installdocs -p$(ppkg)
149 dh_installchangelogs -p$(ppkg)
150 dh_compress -p$(ppkg)
151 dh_installdeb -p$(ppkg)
152 dh_gencontrol -p$(ppkg)
153 dh_md5sums -p$(ppkg)
154 dh_builddeb -p$(ppkg)
155 touch debian/patch-debian-stamp
156 #
157 # linux-doc package
158 #
159 dbdir := debian/build-doc
160 dbddir := $(dbdir)/debian
161 doc: debian/doc-stamp
162 debian/doc-stamp: debian/patch-stamp
163 dh_testdir
164 dh_testroot
165 # Create a build tree
166 mkdir -p $(dbdir)
167 cp -al $(source_files) $(dbdir)
168 mkdir -p $(dbddir)
169 cp debian/changelog $(dbddir)
170 cp debian/control $(dbddir)
171 cp debian/copyright $(dbddir)
172 touch $(dbddir)/official
173 cd $(dbdir) && make-kpkg --stem linux kernel-doc
174 cat $(dbddir)/files >> debian/files
175 mv debian/*.deb ..
176 touch debian/doc-stamp
177
178 unpack: debian/unpack-stamp
179 debian/unpack-stamp: debian/patch-stamp
180 dh_testdir
181 cd debian; \
182 for i in $(subarchs); do \
183 $(MAKE) subarch=$${i} unpack; \
184 done
185 ln -s $$(command -v touch) debian/bin/touch.orig
186 touch debian/unpack-stamp
187
188 build: debian/build-stamp
189 debian/build-stamp: debian/unpack-stamp
190 dh_testdir
191 cd debian; \
192 for i in $(subarchs); do \
193 $(MAKE) subarch=$${i} build; \
194 done
195 touch debian/build-stamp
196
197 orig: ../orig/linux-$(major)-$(version)
198 rsync --delete --exclude debian --exclude .svn -av ../orig/linux-$(major)-$(version)/ .
199
200 ../orig/linux-$(major)-$(version):
201 if [ -f "../linux-$(major)_$(version).orig.tar.gz" ]; then \
202 mkdir -p ../orig; \
203 tar -C ../orig -xzf ../linux-$(major)_$(version).orig.tar.gz; \
204 else \
205 echo "Can't find orig tarball." >&2; \
206 exit 1; \
207 fi
208
209 clean: unpatch
210 dh_testdir
211 rm -f version.Debian
212 rm -rf linux-source-$(version)
213 cd debian; \
214 rm -f *-stamp-* *-stamp config.* *.kpatches.arch; \
215 rm -f header-install-* post-install-* bin/touch.orig; \
216 rm -rf linux-source-* build-* install-*
217 dh_clean
218
219 binary-indep: source tree patch-debian doc
220 binary-arch: build
221 dh_testdir
222 cd debian; \
223 for i in $(subarchs); do \
224 $(MAKE) subarch=$${i} binary; \
225 done
226
227 binary: binary-indep binary-arch
228
229 #
230 # Makes the master debian/control file by substituting
231 # variable values into the template.
232 #
233 # I truly apologize for what I've created.. -dil
234 #
235 archs := $(shell find debian/arch/ -mindepth 1 -maxdepth 1 -type d ! -name '.svn' -printf '%f\n')
236 debian/control: $(wildcard debian/templates/control.*.in)
237 rm -f control.tmp 2>/dev/null
238 list_flavours() { \
239 find debian/arch/$$1/ -name 'config.*' \
240 ! -name '*.svn*' -printf '%f\n' | \
241 sed 's/^config\.//'; \
242 }; \
243 get_all_headers_pkgs() { \
244 result=""; \
245 for flavour in `list_flavours $$1`; do \
246 if [ -z "$$result" ]; then \
247 comma=""; \
248 else \
249 comma=", "; \
250 fi; \
251 result="$${result}$${comma}linux-headers-$$2$(version)-$(abiname)-$$flavour"; \
252 done; \
253 echo $$result; \
254 }; \
255 all_headers_pkgs=`get_all_headers_pkgs`; \
256 substitute() { \
257 sa_tmp="debian/arch/$$2/*/config.$$3"; \
258 sa=""; \
259 [ -f $$sa_tmp ] && sa=$$(basename $$(dirname $$sa_tmp))-; \
260 all_headers_pkgs=`get_all_headers_pkgs $$2 $$sa`; \
261 if expr "$$3" : '.*-smp$$' > /dev/null; then \
262 smp="multi"; \
263 shortsmp="SMP"; \
264 else \
265 smp="uni" ;\
266 shortsmp="UP"; \
267 fi; \
268 flavour=`echo $$3| sed 's/-smp//'`; \
269 cat debian/templates/control.$$1 | \
270 sed -e 's/@version@/$(version)/g' \
271 -e 's/@major@/$(major)/g' \
272 -e "s/@arch@/$$2/g" \
273 -e "s/@subarch@/$$sa/g" \
274 -e "s/@flavour@/$$3/g" \
275 -e "s/@smpflavour@/$${smp}processor $${flavour}/g" \
276 -e "s/@shortsmpflavour@/$${shortsmp} $${flavour}/g" \
277 -e 's/@ltver@/$(ltver)/g' \
278 -e 's/@srcver@/$(srcver)/g' \
279 -e 's/@lt_depends@/$(lt_depends)/g' \
280 -e 's/@lt_provides@/$(lt_provides)/g' \
281 -e 's/@abiname@/$(abiname)/g' \
282 -e "s/@allheaders@/$$all_headers_pkgs/g" | \
283 sed '/^[[:space:]]*$$/d' | \
284 sed 's/^Package:/\n&/g'; \
285 }; \
286 substitute source.in "" "" >> control.tmp; \
287 substitute main.in "" "" >> control.tmp; \
288 substitute headers.in "" "" >> control.tmp; \
289 for a in $(archs); do \
290 substitute headers.arch.in $$a "" >> control.tmp; \
291 for f in $$(list_flavours $$a); do \
292 substitute headers.flavour.in $$a $$f >> control.tmp; \
293 substitute image.in $$a $$f >> control.tmp; \
294 done; \
295 done
296 mv control.tmp debian/control
297
298 .PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5