| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
export CRDA_PATH = /lib/crda |
| 4 |
export FIRMWARE_PATH = /usr/lib/firmware |
| 5 |
export REGDB_AUTHOR = $(shell dpkg-parsechangelog -SMaintainer | sed 's:.*<\(.*\)>:\1:') |
| 6 |
export V = 1 |
| 7 |
# prevent the build system from calling lsb_release |
| 8 |
export LSB_ID = Debian/Ubuntu |
| 9 |
|
| 10 |
define copy_source |
| 11 |
test -d .pc |
| 12 |
set +e; QUILT_PC=.pc quilt unapplied --quiltrc - >/dev/null && echo 'Patch series not fully applied'; test $$? -eq 1 |
| 13 |
mkdir -p '$(1)' |
| 14 |
cp -a $(filter-out debian .pc .git %.bin %.db %.p7s sha1sum.txt, $(wildcard * .[^.]*)) '$(1)' |
| 15 |
endef |
| 16 |
|
| 17 |
%: |
| 18 |
dh ${@} |
| 19 |
|
| 20 |
debian/stamps/configure: |
| 21 |
rm -rf debian/build |
| 22 |
$(call copy_source,debian/build) |
| 23 |
cp debian/regulatory.db.p7s debian/build/ |
| 24 |
mkdir -p debian/stamps |
| 25 |
touch $@ |
| 26 |
|
| 27 |
override_dh_auto_configure: debian/stamps/configure |
| 28 |
|
| 29 |
override_dh_auto_build: |
| 30 |
$(MAKE) -C debian/build regulatory.db |
| 31 |
# Create regulatory.bin so the upstream install rule works |
| 32 |
touch debian/build/regulatory.bin |
| 33 |
rm -f debian/build/.custom |
| 34 |
# Verify that our binary matches upstream unless db.txt is patched |
| 35 |
ifeq ($(shell QUILT_PC=.pc quilt patches --quiltrc - db.txt | wc -l),0) |
| 36 |
diff regulatory.db debian/build/regulatory.db |
| 37 |
endif |
| 38 |
|
| 39 |
override_dh_auto_install: install-wireless-regdb install-wireless-regdb-udeb |
| 40 |
|
| 41 |
install-wireless-regdb: DIR = debian/wireless-regdb |
| 42 |
install-wireless-regdb: |
| 43 |
$(MAKE) -C debian/build DESTDIR=$(CURDIR)/$(DIR) install |
| 44 |
for file in regulatory.db regulatory.db.p7s; do \ |
| 45 |
install -m644 $$file $(DIR)$(FIRMWARE_PATH)/$$file-upstream \ |
| 46 |
&& mv $(DIR)$(FIRMWARE_PATH)/$$file $(DIR)$(FIRMWARE_PATH)/$$file-debian \ |
| 47 |
|| exit; \ |
| 48 |
done |
| 49 |
rm -r $(DIR)/lib/crda |
| 50 |
rmdir --ignore-fail-on-non-empty -p $(DIR)/lib |
| 51 |
# regulatory.db.5 just includes regulatory.bin.5, so we need to |
| 52 |
# install the latter as regulatory.db.5 |
| 53 |
mv $(DIR)/usr/share/man/man5/regulatory.bin.5.gz \ |
| 54 |
$(DIR)/usr/share/man/man5/regulatory.db.5.gz |
| 55 |
|
| 56 |
install-wireless-regdb-udeb: DIR = debian/wireless-regdb-udeb |
| 57 |
install-wireless-regdb-udeb: |
| 58 |
$(MAKE) -C debian/build DESTDIR=$(CURDIR)/$(DIR) install |
| 59 |
rm -r $(DIR)/lib/crda $(DIR)/usr/share/man |
| 60 |
rmdir --ignore-fail-on-non-empty -p $(DIR)/lib $(DIR)/usr/share |
| 61 |
|
| 62 |
override_dh_auto_clean: |
| 63 |
rm -rf debian/build debian/stamps |
| 64 |
|
| 65 |
sign: |
| 66 |
rm -rf debian/build |
| 67 |
$(call copy_source,debian/build) |
| 68 |
cp debian/certs/$(REGDB_AUTHOR).x509.pem debian/build/ |
| 69 |
$(MAKE) -C debian/build regulatory.db.p7s |
| 70 |
cp debian/build/regulatory.db.p7s debian/ |