summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdebian/rules88
-rw-r--r--debian/rules.defs1
-rw-r--r--debian/rules.gen14
-rw-r--r--debian/rules.real45
4 files changed, 148 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..5af1995
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,88 @@
+#!/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
+ $(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)
+ $(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
diff --git a/debian/rules.defs b/debian/rules.defs
new file mode 100644
index 0000000..0117da7
--- /dev/null
+++ b/debian/rules.defs
@@ -0,0 +1 @@
+KERNELVERSION := 6.6.15
diff --git a/debian/rules.gen b/debian/rules.gen
new file mode 100644
index 0000000..47a63d0
--- /dev/null
+++ b/debian/rules.gen
@@ -0,0 +1,14 @@
+.NOTPARALLEL:
+.PHONY:
+packages_enabled := $(shell dh_listpackages)
+define if_package
+$(if $(filter $(1),$(packages_enabled)),$(2))
+endef
+binary-arch_%:
+ @true
+binary-indep:
+ $(MAKE) -f debian/rules.real binary-indep FILES='av7110/bootcode.bin:av7110/bootcode.bin carl9170-1.fw:carl9170-1.fw cis/3CCFEM556.cis:cis/3CCFEM556.cis cis/3CXEM556.cis:cis/3CXEM556.cis cis/COMpad2.cis:cis/COMpad2.cis cis/COMpad4.cis:cis/COMpad4.cis cis/DP83903.cis:cis/DP83903.cis cis/LA-PCM.cis:cis/LA-PCM.cis cis/MT5634ZLX.cis:cis/MT5634ZLX.cis cis/NE2K.cis:cis/NE2K.cis cis/PCMLM28.cis:cis/PCMLM28.cis cis/PE-200.cis:cis/PE-200.cis cis/PE520.cis:cis/PE520.cis cis/RS-COM-2P.cis:cis/RS-COM-2P.cis cis/SW_555_SER.cis:cis/SW_555_SER.cis cis/SW_7xx_SER.cis:cis/SW_7xx_SER.cis cis/SW_8xx_SER.cis:cis/SW_8xx_SER.cis cis/tamarack.cis:cis/tamarack.cis dsp56k/bootstrap.bin:dsp56k/bootstrap.bin isci/isci_firmware.bin:isci/isci_firmware.bin keyspan_pda/keyspan_pda.fw:keyspan_pda/keyspan_pda.fw keyspan_pda/xircom_pgs.fw:keyspan_pda/xircom_pgs.fw usbdux_firmware.bin:usbdux_firmware.bin usbduxfast_firmware.bin:usbduxfast_firmware.bin usbduxsigma_firmware.bin:usbduxsigma_firmware.bin' LINKS='' PACKAGE='linux-free'
+build_%:
+ @true
+setup_%:
+ @true
diff --git a/debian/rules.real b/debian/rules.real
new file mode 100644
index 0000000..3fa602f
--- /dev/null
+++ b/debian/rules.real
@@ -0,0 +1,45 @@
+SHELL := sh -e
+
+export DH_OPTIONS
+
+#
+# Targets
+#
+binary-indep: install
+
+install: PACKAGE_NAME = firmware-$(PACKAGE)
+install: DH_OPTIONS = -p$(PACKAGE_NAME)
+install:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ @for i in $(FILES); do \
+ s="$${i%:*}"; \
+ d=/lib/firmware/"$${i#*:}"; \
+ echo install -m644 -D "$$s" debian/$(PACKAGE_NAME)"$$d"; \
+ install -m644 -D "$$s" debian/$(PACKAGE_NAME)"$$d"; \
+ done
+ @for i in $(LINKS); do \
+ link=debian/$(PACKAGE_NAME)/lib/firmware/"$${i%:*}"; \
+ target="$${i#*:}"; \
+ install -d "$${link%/*}"; \
+ echo ln -s "$$target" "$$link"; \
+ ln -s "$$target" "$$link"; \
+ done
+ifneq ($(FILES),)
+ dh_installdirs /usr/share/metainfo
+ dh_install debian/$(PACKAGE_NAME).metainfo.xml /usr/share/metainfo
+endif
+ dh_bugfiles
+ dh_installchangelogs
+ dh_installdocs -XTODO
+ dh_installdebconf
+ dh_lintian
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ if command -v dh_movetousr >/dev/null; then dh_movetousr; fi
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb