| 1 |
#!/usr/bin/make -f
|
| 2 |
#
|
| 3 |
# Required variables
|
| 4 |
#
|
| 5 |
version := 2.6.12
|
| 6 |
abiname := 1
|
| 7 |
ltver := 1
|
| 8 |
#
|
| 9 |
# Generally nothing needs to be modified below this line
|
| 10 |
#
|
| 11 |
SHELL := sh -e
|
| 12 |
karch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
|
| 13 |
major := $(basename $(version))
|
| 14 |
srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
|
| 15 |
release := $(version)-$(ltver)
|
| 16 |
uver := $(subst .,_,$(version))
|
| 17 |
#
|
| 18 |
# Construct depends and provides for the linux-tree
|
| 19 |
#
|
| 20 |
lt_depends += $(shell seq -f 'linux-source-$(version) (= $(version)-%g)' \
|
| 21 |
-s ' | ' 1 $(ltver))
|
| 22 |
lt_provides := $(shell seq -f 'linux-tree-$(version)-%g' -s ', ' 1 $(ltver))
|
| 23 |
#
|
| 24 |
# If we are not passed a subarchs variable, we obtain the complete
|
| 25 |
# subarch list as a list of subdirectories in arch/$(karch). We
|
| 26 |
# also export the flavours variables, which allows to control which
|
| 27 |
# flavours are built.
|
| 28 |
#
|
| 29 |
ifndef subarchs
|
| 30 |
subarchs := $(shell find debian/arch/$(karch) \
|
| 31 |
-mindepth 1 -maxdepth 1 -type d \
|
| 32 |
! -name '.svn' -printf '%f\n')
|
| 33 |
endif
|
| 34 |
ifeq (,$(subarchs))
|
| 35 |
subarchs := none
|
| 36 |
endif
|
| 37 |
#
|
| 38 |
# The following definition gets the list of relevant files in the top-level
|
| 39 |
# directory. At this point we cannot verify that we are in top-level dir
|
| 40 |
# (we probably are), so it should be referenced only in the targets which
|
| 41 |
# run dh_testdir in the beginning.
|
| 42 |
#
|
| 43 |
source_files = $(filter-out debian linux-source-$(version), $(shell echo *))
|
| 44 |
|
| 45 |
export version abiname ltver kbuildver flavours major uver
|
| 46 |
|
| 47 |
patch: debian/patch-stamp
|
| 48 |
debian/patch-stamp: debian/bin/apply
|
| 49 |
dh_testdir
|
| 50 |
override_version=$(release) home=debian/patches-debian debian/bin/apply
|
| 51 |
# make-kpkg does this when building kernel-source.
|
| 52 |
mv scripts/package/Makefile scripts/package/Makefile.dist
|
| 53 |
mv scripts/package/builddeb scripts/package/builddeb.dist
|
| 54 |
echo "# Dummy Makefile" > scripts/package/Makefile
|
| 55 |
echo "all:" >> scripts/package/Makefile
|
| 56 |
touch debian/patch-stamp
|
| 57 |
|
| 58 |
unpatch:
|
| 59 |
dh_testdir
|
| 60 |
if [ -e debian/patch-stamp ]; then \
|
| 61 |
override_version=$(release) home=debian/patches-debian \
|
| 62 |
debian/bin/apply $(version); \
|
| 63 |
cd scripts/package; \
|
| 64 |
mv Makefile.dist Makefile; \
|
| 65 |
mv builddeb.dist builddeb; \
|
| 66 |
fi
|
| 67 |
rm -f debian/patch-stamp
|
| 68 |
#
|
| 69 |
# linux-source package
|
| 70 |
#
|
| 71 |
spkg := linux-source-$(version)
|
| 72 |
sdir := debian/$(spkg)/usr/src
|
| 73 |
source: debian/source-stamp
|
| 74 |
debian/source-stamp: debian/patch-stamp
|
| 75 |
dh_testdir
|
| 76 |
dh_testroot
|
| 77 |
dh_installdirs -p$(spkg) /usr/src
|
| 78 |
# Link the files and create a tarball in correct location
|
| 79 |
mkdir $(spkg)
|
| 80 |
cp -al $(source_files) $(spkg)
|
| 81 |
tar -cjf $(sdir)/$(spkg).tar.bz2 $(spkg)
|
| 82 |
rm -rf $(spkg)
|
| 83 |
dh_installdocs -p$(spkg) README
|
| 84 |
dh_installchangelogs -p$(spkg)
|
| 85 |
dh_compress -p$(spkg)
|
| 86 |
dh_fixperms -p$(spkg)
|
| 87 |
dh_installdeb -p$(spkg)
|
| 88 |
dh_gencontrol -p$(spkg)
|
| 89 |
dh_md5sums -p$(spkg)
|
| 90 |
dh_builddeb -p$(spkg)
|
| 91 |
touch debian/source-stamp
|
| 92 |
#
|
| 93 |
# linux-tree package
|
| 94 |
#
|
| 95 |
tpkg := linux-tree-$(version)
|
| 96 |
tree: debian/tree-stamp
|
| 97 |
debian/tree-stamp:
|
| 98 |
dh_testdir
|
| 99 |
dh_testroot
|
| 100 |
dh_installdirs -p$(tpkg)
|
| 101 |
dh_installdocs -p$(tpkg)
|
| 102 |
dh_installchangelogs -p$(tpkg)
|
| 103 |
dh_compress -p$(tpkg)
|
| 104 |
dh_fixperms -p$(tpkg)
|
| 105 |
dh_installdeb -p$(tpkg)
|
| 106 |
dh_gencontrol -p$(tpkg)
|
| 107 |
dh_md5sums -p$(tpkg)
|
| 108 |
dh_builddeb -p$(tpkg)
|
| 109 |
touch debian/tree-stamp
|
| 110 |
#
|
| 111 |
# linux-patch-debian
|
| 112 |
#
|
| 113 |
ppkg := linux-patch-debian-$(version)
|
| 114 |
pbase := /usr/src/linux-patches/all/$(version)
|
| 115 |
pfull := debian/$(ppkg)$(pbase)
|
| 116 |
pdirs := $(pbase) $(pbase)/apply $(pbase)/debian $(pbase)/unpatch
|
| 117 |
ptchs := $(notdir $(wildcard debian/patches-arch/*))
|
| 118 |
kptch := debian/$(ppkg).kpatches.arch
|
| 119 |
pcdir := debian/patches-arch
|
| 120 |
patch-debian: debian/patch-debian-stamp
|
| 121 |
debian/patch-debian-stamp: debian/bin/apply debian/bin/unpatch
|
| 122 |
dh_testdir
|
| 123 |
dh_testroot
|
| 124 |
dh_installdirs -p$(ppkg) $(pdirs)
|
| 125 |
dh_install -p$(ppkg) debian/patches-debian/* $(pbase)/debian
|
| 126 |
# Install the debian patches
|
| 127 |
sed 's/@version@/$(release)/g' debian/bin/apply > $(pfull)/apply/debian
|
| 128 |
sed 's/@upstream@/$(version)/g' debian/bin/unpatch > $(pfull)/unpatch/debian
|
| 129 |
chmod a+x $(pfull)/apply/debian $(pfull)/unpatch/debian
|
| 130 |
chmod -x $(pfull)/debian/*.patch
|
| 131 |
bzip2 -9 $(pfull)/debian/*.patch
|
| 132 |
# Now the arch/subarch-specific patches
|
| 133 |
for i in $(ptchs); do \
|
| 134 |
rm -f $(kptch); \
|
| 135 |
arch=$${i%%.*}; \
|
| 136 |
echo "Patch-name: $${arch}" >> $(kptch); \
|
| 137 |
echo "Patch-id: $${arch}_$(uver)" >> $(kptch); \
|
| 138 |
echo "Path-strip-level: 1" >> $(kptch); \
|
| 139 |
echo >> $(kptch); \
|
| 140 |
echo "Patch-file: $(pcdir)/$${i}" >> $(kptch); \
|
| 141 |
echo "Architecture: $${arch}" >> $(kptch); \
|
| 142 |
echo "Kernel-version: $(version)" >> $(kptch); \
|
| 143 |
dh_installkpatches -p$(ppkg); \
|
| 144 |
done
|
| 145 |
dh_fixperms -p$(ppkg)
|
| 146 |
dh_installdocs -p$(ppkg)
|
| 147 |
dh_installchangelogs -p$(ppkg)
|
| 148 |
dh_compress -p$(ppkg)
|
| 149 |
dh_installdeb -p$(ppkg)
|
| 150 |
dh_gencontrol -p$(ppkg)
|
| 151 |
dh_md5sums -p$(ppkg)
|
| 152 |
dh_builddeb -p$(ppkg)
|
| 153 |
touch debian/patch-debian-stamp
|
| 154 |
#
|
| 155 |
# linux-doc package
|
| 156 |
#
|
| 157 |
dbdir := debian/build-doc
|
| 158 |
dbddir := $(dbdir)/debian
|
| 159 |
doc: debian/doc-stamp
|
| 160 |
debian/doc-stamp: debian/patch-stamp
|
| 161 |
dh_testdir
|
| 162 |
dh_testroot
|
| 163 |
# Create a build tree
|
| 164 |
mkdir -p $(dbdir)
|
| 165 |
cp -al $(source_files) $(dbdir)
|
| 166 |
mkdir -p $(dbddir)
|
| 167 |
cp debian/changelog $(dbddir)
|
| 168 |
cp debian/control $(dbddir)
|
| 169 |
cp debian/copyright $(dbddir)
|
| 170 |
touch $(dbddir)/official
|
| 171 |
cd $(dbdir) && make-kpkg --stem linux kernel-doc
|
| 172 |
cat $(dbddir)/files >> debian/files
|
| 173 |
mv debian/*.deb ..
|
| 174 |
touch debian/doc-stamp
|
| 175 |
|
| 176 |
unpack: debian/unpack-stamp
|
| 177 |
debian/unpack-stamp: debian/patch-stamp
|
| 178 |
dh_testdir
|
| 179 |
for i in $(subarchs); do \
|
| 180 |
cd debian; \
|
| 181 |
$(MAKE) subarch=$${i} unpack; \
|
| 182 |
done
|
| 183 |
ln -s $$(command -v touch) debian/bin/touch.orig
|
| 184 |
touch debian/unpack-stamp
|
| 185 |
|
| 186 |
build: debian/build-stamp
|
| 187 |
debian/build-stamp: debian/unpack-stamp
|
| 188 |
dh_testdir
|
| 189 |
for i in $(subarchs); do \
|
| 190 |
cd debian; \
|
| 191 |
$(MAKE) subarch=$${i} build; \
|
| 192 |
done
|
| 193 |
touch debian/build-stamp
|
| 194 |
|
| 195 |
clean: unpatch
|
| 196 |
dh_testdir
|
| 197 |
rm -f version.Debian
|
| 198 |
rm -rf linux-source-$(version)
|
| 199 |
cd debian; \
|
| 200 |
rm -f *-stamp-* *-stamp config.* *.kpatches.arch; \
|
| 201 |
rm -f header-install-* post-install-* bin/touch.orig; \
|
| 202 |
rm -rf linux-source-* build-* install-*
|
| 203 |
dh_clean
|
| 204 |
|
| 205 |
binary-indep: source tree patch-debian doc
|
| 206 |
binary-arch: build
|
| 207 |
dh_testdir
|
| 208 |
for i in $(subarchs); do \
|
| 209 |
cd debian; \
|
| 210 |
$(MAKE) subarch=$${i} binary; \
|
| 211 |
done
|
| 212 |
|
| 213 |
binary: binary-indep binary-arch
|
| 214 |
|
| 215 |
#
|
| 216 |
# Makes the master debian/control file by substituting
|
| 217 |
# variable values into the template.
|
| 218 |
#
|
| 219 |
debian/control: debian/templates/control.main.in
|
| 220 |
cat debian/templates/control.source.in \
|
| 221 |
debian/templates/control.main.in \
|
| 222 |
debian/arch/*/control.in | \
|
| 223 |
sed -e 's/@version@/$(version)/g' \
|
| 224 |
-e 's/@major@/$(major)/g' \
|
| 225 |
-e 's/@ltver@/$(ltver)/g' \
|
| 226 |
-e 's/@srcver@/$(srcver)/g' \
|
| 227 |
-e 's/@lt_depends@/$(lt_depends)/g' \
|
| 228 |
-e 's/@lt_provides@/$(lt_provides)/g' \
|
| 229 |
-e 's/@abiname@/$(abiname)/g' | \
|
| 230 |
sed '/^[[:space:]]*$$/d' | \
|
| 231 |
sed 's/^Package:/\n&/g' > debian/control
|
| 232 |
|
| 233 |
.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree
|