#!/usr/bin/make -f export CRDA_PATH = /lib/crda export REGDB_AUTHOR = $(shell dpkg-parsechangelog -SMaintainer | sed 's:.*<\(.*\)>:\1:') export V = 1 # prevent the build system from calling lsb_release export LSB_ID = Debian/Ubuntu define copy_source test -d .pc set +e; QUILT_PC=.pc quilt unapplied --quiltrc - >/dev/null && echo 'Patch series not fully applied'; test $$? -eq 1 mkdir -p '$(1)' cp -a $(filter-out debian .pc .git %.bin %.db %.p7s sha1sum.txt, $(wildcard * .[^.]*)) '$(1)' endef %: dh ${@} debian/stamps/configure: rm -rf debian/build $(call copy_source,debian/build) cp debian/regulatory.bin.sig debian/regulatory.db.p7s debian/build/ mkdir -p debian/stamps touch $@ override_dh_auto_configure: debian/stamps/configure override_dh_auto_build: $(MAKE) -C debian/build regulatory.bin regulatory.db # crda will install public keys rm -f debian/build/.custom # Verify that our binaries match upstream unless db.txt is patched ifeq ($(shell QUILT_PC=.pc quilt patches --quiltrc - db.txt | wc -l),0) diff regulatory.db debian/build/regulatory.db size="$$(dd if=regulatory.bin status=none bs=4 skip=2 count=1 | od -td4 --endian=big -An | sed 's/^\s*//')" \ && dd if=regulatory.bin status=none iflag=skip_bytes,count_bytes skip=12 count=$$size of=debian/build/regulatory.bin.unsigned-upstream \ && dd if=debian/build/regulatory.bin status=none iflag=skip_bytes,count_bytes skip=12 count=$$size of=debian/build/regulatory.bin.unsigned \ && diff debian/build/regulatory.bin.unsigned-upstream debian/build/regulatory.bin.unsigned endif override_dh_auto_install: install-wireless-regdb install-wireless-regdb-udeb install-wireless-regdb: DIR = debian/wireless-regdb install-wireless-regdb: $(MAKE) -C debian/build DESTDIR=$(CURDIR)/$(DIR) install for file in regulatory.db regulatory.db.p7s; do \ install -m644 $$file $(DIR)/lib/firmware/$$file-upstream \ && mv $(DIR)/lib/firmware/$$file $(DIR)/lib/firmware/$$file-debian \ || exit; \ done # crda will install public keys rm -r $(DIR)/lib/crda/pubkeys install-wireless-regdb-udeb: DIR = debian/wireless-regdb-udeb install-wireless-regdb-udeb: $(MAKE) -C debian/build DESTDIR=$(CURDIR)/$(DIR) install rm -r $(DIR)/lib/crda $(DIR)/usr/share/man rmdir --ignore-fail-on-non-empty -p $(DIR)/usr/share override_dh_auto_clean: rm -rf debian/build debian/stamps sign: rm -rf debian/build $(call copy_source,debian/build) cp debian/certs/$(REGDB_AUTHOR).x509.pem debian/build/ $(MAKE) -C debian/build regulatory.bin.sig regulatory.db.p7s cp debian/build/regulatory.bin.sig debian/build/regulatory.db.p7s debian/