#!/usr/bin/make -f BASE_URL=http://downloads.asterisk.org/pub/telephony/sounds/releases/ PACKAGE=$(shell sed -e '2,$$d' -e 's/ .*//' debian/changelog) VERSION=$(shell sed -e '2,$$d' -e 's/^[^(]*(\([^-]*\)-.*)*)*/\1/' debian/changelog) LANGS=en es fr it ru FORMATS=gsm g722 wav TMPDIR=tmp # or . if you prefer TARGET_DIR=../tarballs #TARGET_DIR=.. PKGNAME=$(PACKAGE)-$(VERSION) PKGDIR=$(TMPDIR)/$(PKGNAME) TARBALL_NAMES=$(foreach lang,$(LANGS),$(foreach fmt,$(FORMATS),$(lang)-$(fmt))) TARBALLS_EXTRA=$(TARBALL_NAMES:%=$(TARGET_DIR)/$(PACKAGE)_$(VERSION).orig-%.tar.gz) TARBALLS_EXTRA_SHA1=$(TARBALLS_EXTRA:%=%.sha1) $(TARGET_DIR)/$(PACKAGE)_$(VERSION).orig-%.tar.gz.sha1: wget -q -O $@ -c $(BASE_URL)/$(PACKAGE)-$*-$(VERSION).tar.gz.sha1 $(TARGET_DIR)/$(PACKAGE)_$(VERSION).orig-%.tar.gz: \ $(TARGET_DIR)/$(PACKAGE)_$(VERSION).orig-%.tar.gz.sha1 set -e; cd $(@D); \ wget -q -c $(BASE_URL)/$(PACKAGE)-$*-$(VERSION).tar.gz ln -fs $(PACKAGE)-$*-$(VERSION).tar.gz $@ %: dh $@ override_dh_install: dh_install # excluding this way is simpler: find $(CURDIR)/debian/asterisk-core-sounds-*/usr/share/asterisk \ \( -name '[CL]*' -o -name '*.txt' \) -exec rm -f \{\} \; override_dh_installchangelogs: dh_installchangelogs -pasterisk-core-sounds-en en-gsm/CHANGES-asterisk-core-en-$(VERSION) dh_installchangelogs -pasterisk-core-sounds-es es-gsm/CHANGES-asterisk-core-es-$(VERSION) dh_installchangelogs -pasterisk-core-sounds-fr fr-gsm/CHANGES-asterisk-core-fr-$(VERSION) dh_installchangelogs -pasterisk-core-sounds-it it-gsm/CHANGES-asterisk-core-it-$(VERSION) dh_installchangelogs -pasterisk-core-sounds-ru ru-gsm/CHANGES-asterisk-core-ru-$(VERSION) dh_installchangelogs update-control: # Regenerate ./debian/mkcontrol "$(LANGS)" "$(FORMATS)" >debian/control.new @if ! cmp --silent debian/control debian/control.new; then \ mv debian/control.new debian/control; \ echo "debian/control has changed"; \ fi print-version: @echo languages: $(LANGS) @echo formats: $(FORMATS) @echo package: $(PACKAGE) @echo version: $(VERSION) @echo names: $(TARBALLS_EXTRA) get-orig-source: $(TARBALLS_EXTRA) $(TARBALLS_EXTRA_SHA1) set -e; for tarball in $(TARBALLS_EXTRA); do \ filename="$${tarball##*/}"; \ (cd $(TARGET_DIR); sha1sum --quiet -c $$filename.sha1) \ done rm -rf $(PKGDIR) mkdir -p $(PKGDIR) # Empty tarball tar czf $(TARGET_DIR)/$(PACKAGE)_$(VERSION).orig.tar.gz \ -C $(TMPDIR) $(PACKAGE)-$(VERSION) rm -rf $(TMPDIR)