2005-05-10 04:16:53 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
#
|
2005-07-09 23:47:27 +00:00
|
|
|
# Required variables. See README for a description of all the variables.
|
2005-05-27 01:12:29 +00:00
|
|
|
#
|
2005-05-27 04:52:42 +00:00
|
|
|
abiname := 1
|
2005-05-10 04:16:53 +00:00
|
|
|
#
|
|
|
|
# Generally nothing needs to be modified below this line
|
|
|
|
#
|
2005-05-27 04:52:42 +00:00
|
|
|
SHELL := sh -e
|
|
|
|
karch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
|
2005-07-12 11:02:40 +00:00
|
|
|
srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
|
|
|
|
version := $(word 1,$(subst -, ,$(srcver)))
|
|
|
|
ltver := $(word 2,$(subst -, ,$(srcver)))
|
2005-07-10 00:01:56 +00:00
|
|
|
major_v := $(word 1,$(subst ., ,$(version)))
|
|
|
|
minor_v := $(word 2,$(subst ., ,$(version)))
|
2005-07-09 23:36:15 +00:00
|
|
|
major := $(major_v).$(minor_v)
|
2005-05-28 20:15:14 +00:00
|
|
|
release := $(version)-$(ltver)
|
2005-05-31 00:52:12 +00:00
|
|
|
uver := $(subst .,_,$(version))
|
2005-05-27 04:52:42 +00:00
|
|
|
#
|
|
|
|
# Construct depends and provides for the linux-tree
|
|
|
|
#
|
|
|
|
lt_depends += $(shell seq -f 'linux-source-$(version) (= $(version)-%g)' \
|
2005-05-28 20:15:14 +00:00
|
|
|
-s ' | ' 1 $(ltver))
|
|
|
|
lt_provides := $(shell seq -f 'linux-tree-$(version)-%g' -s ', ' 1 $(ltver))
|
2005-05-14 05:55:07 +00:00
|
|
|
#
|
2005-05-19 00:16:36 +00:00
|
|
|
# If we are not passed a subarchs variable, we obtain the complete
|
|
|
|
# subarch list as a list of subdirectories in arch/$(karch). We
|
|
|
|
# also export the flavours variables, which allows to control which
|
|
|
|
# flavours are built.
|
2005-05-18 03:40:09 +00:00
|
|
|
#
|
|
|
|
ifndef subarchs
|
2005-05-26 01:53:38 +00:00
|
|
|
subarchs := $(shell find debian/arch/$(karch) \
|
2005-06-18 01:43:02 +00:00
|
|
|
-mindepth 1 -maxdepth 1 -type d \
|
2005-05-29 20:46:14 +00:00
|
|
|
! -name '.svn' -printf '%f\n')
|
2005-05-18 03:40:09 +00:00
|
|
|
endif
|
2005-05-19 00:16:36 +00:00
|
|
|
ifeq (,$(subarchs))
|
2005-05-18 03:40:09 +00:00
|
|
|
subarchs := none
|
|
|
|
endif
|
2005-05-29 00:15:03 +00:00
|
|
|
#
|
|
|
|
# The following definition gets the list of relevant files in the top-level
|
|
|
|
# directory. At this point we cannot verify that we are in top-level dir
|
|
|
|
# (we probably are), so it should be referenced only in the targets which
|
|
|
|
# run dh_testdir in the beginning.
|
|
|
|
#
|
|
|
|
source_files = $(filter-out debian linux-source-$(version), $(shell echo *))
|
2005-05-11 02:05:18 +00:00
|
|
|
|
2005-05-31 00:52:12 +00:00
|
|
|
export version abiname ltver kbuildver flavours major uver
|
2005-05-19 00:16:36 +00:00
|
|
|
|
2005-05-28 20:15:14 +00:00
|
|
|
patch: debian/patch-stamp
|
|
|
|
debian/patch-stamp: debian/bin/apply
|
2005-05-28 23:07:32 +00:00
|
|
|
dh_testdir
|
2005-07-18 22:03:11 +00:00
|
|
|
chmod +x debian/bin/apply
|
2005-05-31 02:16:28 +00:00
|
|
|
override_version=$(release) home=debian/patches-debian debian/bin/apply
|
2005-05-28 23:07:32 +00:00
|
|
|
# make-kpkg does this when building kernel-source.
|
|
|
|
mv scripts/package/Makefile scripts/package/Makefile.dist
|
|
|
|
mv scripts/package/builddeb scripts/package/builddeb.dist
|
|
|
|
echo "# Dummy Makefile" > scripts/package/Makefile
|
|
|
|
echo "all:" >> scripts/package/Makefile
|
2005-05-28 20:15:14 +00:00
|
|
|
touch debian/patch-stamp
|
|
|
|
|
|
|
|
unpatch:
|
2005-05-28 23:07:32 +00:00
|
|
|
dh_testdir
|
2005-05-31 02:16:28 +00:00
|
|
|
if [ -e debian/patch-stamp ]; then \
|
|
|
|
override_version=$(release) home=debian/patches-debian \
|
|
|
|
debian/bin/apply $(version); \
|
|
|
|
cd scripts/package; \
|
|
|
|
mv Makefile.dist Makefile; \
|
|
|
|
mv builddeb.dist builddeb; \
|
2005-05-28 20:15:14 +00:00
|
|
|
fi
|
2005-05-28 23:07:32 +00:00
|
|
|
rm -f debian/patch-stamp
|
|
|
|
#
|
2005-05-28 23:55:38 +00:00
|
|
|
# linux-source package
|
2005-05-28 23:07:32 +00:00
|
|
|
#
|
|
|
|
spkg := linux-source-$(version)
|
|
|
|
sdir := debian/$(spkg)/usr/src
|
|
|
|
source: debian/source-stamp
|
|
|
|
debian/source-stamp: debian/patch-stamp
|
|
|
|
dh_testdir
|
|
|
|
dh_testroot
|
2005-05-28 23:55:38 +00:00
|
|
|
dh_installdirs -p$(spkg) /usr/src
|
2005-05-28 23:07:32 +00:00
|
|
|
# Link the files and create a tarball in correct location
|
|
|
|
mkdir $(spkg)
|
2005-05-29 00:15:03 +00:00
|
|
|
cp -al $(source_files) $(spkg)
|
2005-05-28 23:07:32 +00:00
|
|
|
tar -cjf $(sdir)/$(spkg).tar.bz2 $(spkg)
|
|
|
|
rm -rf $(spkg)
|
2005-05-28 23:55:38 +00:00
|
|
|
dh_installdocs -p$(spkg) README
|
2005-05-28 23:07:32 +00:00
|
|
|
dh_installchangelogs -p$(spkg)
|
|
|
|
dh_compress -p$(spkg)
|
2005-05-28 23:55:38 +00:00
|
|
|
dh_fixperms -p$(spkg)
|
2005-05-28 23:07:32 +00:00
|
|
|
dh_installdeb -p$(spkg)
|
|
|
|
dh_gencontrol -p$(spkg)
|
2005-05-31 00:52:12 +00:00
|
|
|
dh_md5sums -p$(spkg)
|
2005-05-28 23:07:32 +00:00
|
|
|
dh_builddeb -p$(spkg)
|
2005-05-28 23:55:38 +00:00
|
|
|
touch debian/source-stamp
|
|
|
|
#
|
|
|
|
# linux-tree package
|
|
|
|
#
|
|
|
|
tpkg := linux-tree-$(version)
|
|
|
|
tree: debian/tree-stamp
|
|
|
|
debian/tree-stamp:
|
|
|
|
dh_testdir
|
|
|
|
dh_testroot
|
|
|
|
dh_installdirs -p$(tpkg)
|
|
|
|
dh_installdocs -p$(tpkg)
|
|
|
|
dh_installchangelogs -p$(tpkg)
|
|
|
|
dh_compress -p$(tpkg)
|
|
|
|
dh_fixperms -p$(tpkg)
|
|
|
|
dh_installdeb -p$(tpkg)
|
|
|
|
dh_gencontrol -p$(tpkg)
|
2005-05-31 03:11:25 +00:00
|
|
|
dh_md5sums -p$(tpkg)
|
2005-05-28 23:55:38 +00:00
|
|
|
dh_builddeb -p$(tpkg)
|
|
|
|
touch debian/tree-stamp
|
2005-05-29 17:49:40 +00:00
|
|
|
#
|
|
|
|
# linux-patch-debian
|
|
|
|
#
|
|
|
|
ppkg := linux-patch-debian-$(version)
|
2005-06-26 21:09:54 +00:00
|
|
|
pbase := /usr/src/kernel-patches/all/$(version)
|
2005-05-29 17:49:40 +00:00
|
|
|
pfull := debian/$(ppkg)$(pbase)
|
|
|
|
pdirs := $(pbase) $(pbase)/apply $(pbase)/debian $(pbase)/unpatch
|
2005-05-31 00:52:12 +00:00
|
|
|
ptchs := $(notdir $(wildcard debian/patches-arch/*))
|
|
|
|
kptch := debian/$(ppkg).kpatches.arch
|
|
|
|
pcdir := debian/patches-arch
|
2005-05-29 17:49:40 +00:00
|
|
|
patch-debian: debian/patch-debian-stamp
|
|
|
|
debian/patch-debian-stamp: debian/bin/apply debian/bin/unpatch
|
|
|
|
dh_testdir
|
|
|
|
dh_testroot
|
|
|
|
dh_installdirs -p$(ppkg) $(pdirs)
|
2005-05-31 00:52:12 +00:00
|
|
|
dh_install -p$(ppkg) debian/patches-debian/* $(pbase)/debian
|
|
|
|
# Install the debian patches
|
2005-05-29 17:49:40 +00:00
|
|
|
sed 's/@version@/$(release)/g' debian/bin/apply > $(pfull)/apply/debian
|
|
|
|
sed 's/@upstream@/$(version)/g' debian/bin/unpatch > $(pfull)/unpatch/debian
|
|
|
|
chmod a+x $(pfull)/apply/debian $(pfull)/unpatch/debian
|
|
|
|
chmod -x $(pfull)/debian/*.patch
|
|
|
|
bzip2 -9 $(pfull)/debian/*.patch
|
2005-05-31 00:52:12 +00:00
|
|
|
# Now the arch/subarch-specific patches
|
|
|
|
for i in $(ptchs); do \
|
|
|
|
rm -f $(kptch); \
|
|
|
|
arch=$${i%%.*}; \
|
|
|
|
echo "Patch-name: $${arch}" >> $(kptch); \
|
|
|
|
echo "Patch-id: $${arch}_$(uver)" >> $(kptch); \
|
|
|
|
echo "Path-strip-level: 1" >> $(kptch); \
|
|
|
|
echo >> $(kptch); \
|
|
|
|
echo "Patch-file: $(pcdir)/$${i}" >> $(kptch); \
|
|
|
|
echo "Architecture: $${arch}" >> $(kptch); \
|
|
|
|
echo "Kernel-version: $(version)" >> $(kptch); \
|
|
|
|
dh_installkpatches -p$(ppkg); \
|
|
|
|
done
|
2005-05-29 17:49:40 +00:00
|
|
|
dh_fixperms -p$(ppkg)
|
|
|
|
dh_installdocs -p$(ppkg)
|
|
|
|
dh_installchangelogs -p$(ppkg)
|
|
|
|
dh_compress -p$(ppkg)
|
|
|
|
dh_installdeb -p$(ppkg)
|
|
|
|
dh_gencontrol -p$(ppkg)
|
2005-05-31 00:52:12 +00:00
|
|
|
dh_md5sums -p$(ppkg)
|
2005-05-29 17:49:40 +00:00
|
|
|
dh_builddeb -p$(ppkg)
|
|
|
|
touch debian/patch-debian-stamp
|
2005-05-31 02:16:28 +00:00
|
|
|
#
|
|
|
|
# linux-doc package
|
|
|
|
#
|
|
|
|
dbdir := debian/build-doc
|
|
|
|
dbddir := $(dbdir)/debian
|
|
|
|
doc: debian/doc-stamp
|
|
|
|
debian/doc-stamp: debian/patch-stamp
|
|
|
|
dh_testdir
|
|
|
|
dh_testroot
|
|
|
|
# Create a build tree
|
|
|
|
mkdir -p $(dbdir)
|
|
|
|
cp -al $(source_files) $(dbdir)
|
|
|
|
mkdir -p $(dbddir)
|
|
|
|
cp debian/changelog $(dbddir)
|
|
|
|
cp debian/control $(dbddir)
|
|
|
|
cp debian/copyright $(dbddir)
|
|
|
|
touch $(dbddir)/official
|
|
|
|
cd $(dbdir) && make-kpkg --stem linux kernel-doc
|
|
|
|
cat $(dbddir)/files >> debian/files
|
|
|
|
mv debian/*.deb ..
|
|
|
|
touch debian/doc-stamp
|
2005-05-27 04:52:42 +00:00
|
|
|
|
2005-05-29 04:46:18 +00:00
|
|
|
unpack: debian/unpack-stamp
|
|
|
|
debian/unpack-stamp: debian/patch-stamp
|
2005-05-19 00:16:36 +00:00
|
|
|
dh_testdir
|
2005-06-22 05:13:52 +00:00
|
|
|
cd debian; \
|
2005-05-29 04:46:18 +00:00
|
|
|
for i in $(subarchs); do \
|
|
|
|
$(MAKE) subarch=$${i} unpack; \
|
2005-05-11 02:05:18 +00:00
|
|
|
done
|
2005-05-26 01:53:38 +00:00
|
|
|
ln -s $$(command -v touch) debian/bin/touch.orig
|
2005-05-29 04:46:18 +00:00
|
|
|
touch debian/unpack-stamp
|
2005-05-19 00:16:36 +00:00
|
|
|
|
2005-05-29 04:46:18 +00:00
|
|
|
build: debian/build-stamp
|
|
|
|
debian/build-stamp: debian/unpack-stamp
|
2005-05-12 05:58:57 +00:00
|
|
|
dh_testdir
|
2005-06-22 05:13:52 +00:00
|
|
|
cd debian; \
|
2005-05-29 04:46:18 +00:00
|
|
|
for i in $(subarchs); do \
|
|
|
|
$(MAKE) subarch=$${i} build; \
|
2005-05-12 05:58:57 +00:00
|
|
|
done
|
2005-05-29 04:46:18 +00:00
|
|
|
touch debian/build-stamp
|
2005-05-10 04:16:53 +00:00
|
|
|
|
2005-07-16 03:14:13 +00:00
|
|
|
orig: ../orig/linux-$(major)-$(version)
|
|
|
|
rsync --delete --exclude debian --exclude .svn -av ../orig/linux-$(major)-$(version)/ .
|
|
|
|
|
|
|
|
../orig/linux-$(major)-$(version):
|
|
|
|
if [ -f "../linux-$(major)_$(version).orig.tar.gz" ]; then \
|
|
|
|
mkdir -p ../orig; \
|
|
|
|
tar -C ../orig -xzf ../linux-$(major)_$(version).orig.tar.gz; \
|
|
|
|
else \
|
|
|
|
echo "Can't find orig tarball." >&2; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2005-05-28 23:07:32 +00:00
|
|
|
clean: unpatch
|
2005-05-15 05:30:44 +00:00
|
|
|
dh_testdir
|
2005-05-28 23:07:32 +00:00
|
|
|
rm -f version.Debian
|
|
|
|
rm -rf linux-source-$(version)
|
2005-05-26 01:53:38 +00:00
|
|
|
cd debian; \
|
2005-05-31 00:52:12 +00:00
|
|
|
rm -f *-stamp-* *-stamp config.* *.kpatches.arch; \
|
2005-05-26 01:53:38 +00:00
|
|
|
rm -f header-install-* post-install-* bin/touch.orig; \
|
2005-05-31 23:38:14 +00:00
|
|
|
rm -rf linux-source-* build-* install-*
|
2005-05-11 02:05:18 +00:00
|
|
|
dh_clean
|
2005-05-19 00:16:36 +00:00
|
|
|
|
2005-05-31 02:16:28 +00:00
|
|
|
binary-indep: source tree patch-debian doc
|
2005-05-14 05:55:07 +00:00
|
|
|
binary-arch: build
|
|
|
|
dh_testdir
|
2005-06-22 05:13:52 +00:00
|
|
|
cd debian; \
|
2005-05-29 04:46:18 +00:00
|
|
|
for i in $(subarchs); do \
|
|
|
|
$(MAKE) subarch=$${i} binary; \
|
2005-05-14 05:55:07 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
binary: binary-indep binary-arch
|
|
|
|
|
2005-05-11 02:05:18 +00:00
|
|
|
#
|
2005-05-27 04:52:42 +00:00
|
|
|
# Makes the master debian/control file by substituting
|
|
|
|
# variable values into the template.
|
2005-05-11 02:05:18 +00:00
|
|
|
#
|
2005-07-11 03:53:31 +00:00
|
|
|
# I truly apologize for what I've created.. -dil
|
|
|
|
#
|
2005-07-11 03:35:09 +00:00
|
|
|
archs := $(shell find debian/arch/ -mindepth 1 -maxdepth 1 -type d ! -name '.svn' -printf '%f\n')
|
2005-07-12 08:29:52 +00:00
|
|
|
debian/control: $(wildcard debian/templates/control.*.in)
|
2005-07-11 03:35:09 +00:00
|
|
|
rm -f control.tmp 2>/dev/null
|
2005-07-14 08:29:26 +00:00
|
|
|
list_flavours() { \
|
|
|
|
find debian/arch/$$1/ -name 'config.*' \
|
|
|
|
! -name '*.svn*' -printf '%f\n' | \
|
|
|
|
sed 's/^config\.//'; \
|
|
|
|
}; \
|
|
|
|
get_all_headers_pkgs() { \
|
|
|
|
result=""; \
|
|
|
|
for flavour in `list_flavours $$1`; do \
|
|
|
|
if [ -z "$$result" ]; then \
|
|
|
|
comma=""; \
|
|
|
|
else \
|
|
|
|
comma=", "; \
|
|
|
|
fi; \
|
|
|
|
result="$${result}$${comma}linux-headers-$$2$(version)-$(abiname)-$$flavour"; \
|
|
|
|
done; \
|
|
|
|
echo $$result; \
|
|
|
|
}; \
|
|
|
|
all_headers_pkgs=`get_all_headers_pkgs`; \
|
2005-07-11 03:35:09 +00:00
|
|
|
substitute() { \
|
2005-07-11 04:40:06 +00:00
|
|
|
sa_tmp="debian/arch/$$2/*/config.$$3"; \
|
|
|
|
sa=""; \
|
2005-07-11 04:45:42 +00:00
|
|
|
[ -f $$sa_tmp ] && sa=$$(basename $$(dirname $$sa_tmp))-; \
|
2005-07-14 08:29:26 +00:00
|
|
|
all_headers_pkgs=`get_all_headers_pkgs $$2 $$sa`; \
|
2005-07-20 20:48:50 +00:00
|
|
|
class="$$3-class"; \
|
2005-07-21 16:21:45 +00:00
|
|
|
longclass=""; \
|
2005-07-20 20:05:29 +00:00
|
|
|
desc=""; \
|
|
|
|
[ -f "debian/arch/$$2/$$sa/desc.$$3" ] && . "debian/arch/$$2/$$sa/desc.$$3"; \
|
2005-07-21 16:21:45 +00:00
|
|
|
[ -z "$$longclass" ] && longclass="$$class"; \
|
2005-07-11 03:35:09 +00:00
|
|
|
cat debian/templates/control.$$1 | \
|
2005-07-14 08:29:26 +00:00
|
|
|
sed -e 's/@version@/$(version)/g' \
|
2005-07-11 03:35:09 +00:00
|
|
|
-e 's/@major@/$(major)/g' \
|
|
|
|
-e "s/@arch@/$$2/g" \
|
2005-07-11 04:40:06 +00:00
|
|
|
-e "s/@subarch@/$$sa/g" \
|
2005-07-11 03:35:09 +00:00
|
|
|
-e "s/@flavour@/$$3/g" \
|
2005-07-20 20:32:19 +00:00
|
|
|
-e "s#@class@#$$class#g" \
|
2005-07-21 16:21:45 +00:00
|
|
|
-e "s#@longclass@#$$longclass#g" \
|
2005-07-11 03:35:09 +00:00
|
|
|
-e 's/@ltver@/$(ltver)/g' \
|
|
|
|
-e 's/@srcver@/$(srcver)/g' \
|
|
|
|
-e 's/@lt_depends@/$(lt_depends)/g' \
|
|
|
|
-e 's/@lt_provides@/$(lt_provides)/g' \
|
2005-07-14 08:29:26 +00:00
|
|
|
-e 's/@abiname@/$(abiname)/g' \
|
|
|
|
-e "s/@allheaders@/$$all_headers_pkgs/g" | \
|
2005-07-11 03:35:09 +00:00
|
|
|
sed '/^[[:space:]]*$$/d' | \
|
|
|
|
sed 's/^Package:/\n&/g'; \
|
2005-07-20 21:13:54 +00:00
|
|
|
[ -z "$$4" ] || printf "$$desc\n"; \
|
2005-07-11 03:35:09 +00:00
|
|
|
}; \
|
|
|
|
substitute source.in "" "" >> control.tmp; \
|
|
|
|
substitute main.in "" "" >> control.tmp; \
|
|
|
|
substitute headers.in "" "" >> control.tmp; \
|
|
|
|
for a in $(archs); do \
|
|
|
|
for f in $$(list_flavours $$a); do \
|
|
|
|
substitute headers.flavour.in $$a $$f >> control.tmp; \
|
2005-07-20 21:13:54 +00:00
|
|
|
substitute image.in $$a $$f "1" >> control.tmp; \
|
2005-07-11 03:35:09 +00:00
|
|
|
done; \
|
|
|
|
done
|
|
|
|
mv control.tmp debian/control
|
2005-05-27 04:52:42 +00:00
|
|
|
|
2005-05-29 04:46:18 +00:00
|
|
|
.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree
|