diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..5867d9f --- /dev/null +++ b/debian/rules @@ -0,0 +1,92 @@ +#!/usr/bin/make -f +SHELL := sh -e +SOURCE := $(shell dpkg-parsechangelog -SSource) +VERSION := $(shell dpkg-parsechangelog -SVersion) +VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,') +VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -rne 's,.*\+b([0-9]+)$$,\1,p') +VERSION_SOURCE := $(patsubst %+b$(VERSION_BINNMU),%,$(VERSION)) + +include debian/rules.defs + +GENCONTROL = debian/bin/gencontrol.py + +# Nothing to build +build-indep build-arch build: debian/control + +clean: debian/control + dh_testdir + rm -rf debian/build debian/lib/python/__pycache__ + dh_clean + +binary-indep: build-indep + dh_testdir + ./copy-firmware.sh -v debian/build/install + $(MAKE) -f debian/rules.gen binary-indep + +binary-arch: build-arch + +binary: binary-indep binary-arch + +CONTROL_FILES = debian/build/version-info $(wildcard debian/templates/*.in) +CONTROL_FILES += debian/bin/gencontrol.py debian/config/defines $(wildcard debian/config/*/defines) debian/modinfo.json + +# debian/bin/gencontrol.py uses debian/changelog as input, but the +# output only depends on the source name and version. To avoid +# frequent changes to debian/control.md5sum, include only those fields +# in the checksum. +debian/build/version-info: debian/changelog + mkdir -p $(@D) + printf >$@ 'Source: %s\nVersion: %s\n' $(SOURCE) $(VERSION_SOURCE) + +debian/control debian/rules.gen: $(GENCONTROL) $(CONTROL_FILES) +ifeq ($(wildcard debian/control.md5sum),) + $(MAKE) -f debian/rules debian/control-real +else + md5sum --check debian/control.md5sum --status || \ + $(MAKE) -f debian/rules debian/control-real +endif + +debian/control-real: $(GENCONTROL) $(CONTROL_FILES) +# We currently need to run copy-firmware.sh to get a complete list of +# symlinks to include in package descriptions. + ./copy-firmware.sh debian/build/install + $(GENCONTROL) /usr/src/linux-support-$(KERNELVERSION) + md5sum $^ > debian/control.md5sum + @echo + @echo This target is made to fail intentionally, to make sure + @echo that it is NEVER run during the automated build. Please + @echo ignore the following error, the debian/control file has + @echo been generated SUCCESSFULLY. + @echo + exit 1 + +DIR_ORIG = ../orig/$(SOURCE)-$(VERSION_UPSTREAM) +TAR_ORIG_NAME = $(SOURCE)_$(VERSION_UPSTREAM).orig.tar.xz +TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME))) + +orig: $(DIR_ORIG) + rsync --delete --exclude /debian --exclude /.git --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ . + QUILT_PATCHES='$(CURDIR)/debian/patches' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0 + +$(DIR_ORIG): +ifeq ($(TAR_ORIG),) + $(error Cannot find orig tarball $(TAR_ORIG_NAME)) +else + mkdir -p ../orig + tar -C ../orig -xaf $(TAR_ORIG) +endif + +maintainerclean: + -rm debian/control debian/control.md5sum debian/rules.gen + rm -f debian/*.bug-presubj + -rm debian/*.hook.* + rm -f debian/*.metainfo.xml + -rm debian/*.preinst + -rm debian/*.postinst + -rm debian/*.templates + +linux-support-name: + @echo linux-support-$(KERNELVERSION) + +.PHONY: clean build-indep build-arch build binary-indep binary-arch binary \ + linux-support-name |