Might as well go crazy here too and make the autoservice list read/write.
[asterisk/asterisk.git] / sounds / Makefile
index 794a7dc..df8aedc 100644 (file)
 # the GNU General Public License
 #
 
-.PHONY: dist-clean all uninstall
+.PHONY: dist-clean all uninstall have_download install
 
--include $(ASTTOPDIR)/menuselect.makeopts
+-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts
 
 SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
 MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
-CORE_SOUNDS_VERSION:=1.4.2
-EXTRA_SOUNDS_VERSION:=1.4.1
+CORE_SOUNDS_VERSION:=1.4.5
+EXTRA_SOUNDS_VERSION:=1.4.4
 SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
 MCS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
 MCS:=$(subst -FR-,-fr-,$(MCS))
@@ -28,6 +28,7 @@ MCS:=$(subst -ULAW,-ulaw,$(MCS))
 MCS:=$(subst -ALAW,-alaw,$(MCS))
 MCS:=$(subst -GSM,-gsm,$(MCS))
 MCS:=$(subst -G729,-g729,$(MCS))
+MCS:=$(subst -G722,-g722,$(MCS))
 CORE_SOUNDS:=$(MCS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
 CORE_SOUND_TAGS:=$(MCS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
 MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
@@ -38,6 +39,7 @@ MES:=$(subst -ULAW,-ulaw,$(MES))
 MES:=$(subst -ALAW,-alaw,$(MES))
 MES:=$(subst -GSM,-gsm,$(MES))
 MES:=$(subst -G729,-g729,$(MES))
+MES:=$(subst -G722,-g722,$(MES))
 EXTRA_SOUNDS:=$(MES:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
 EXTRA_SOUND_TAGS:=$(MES:EXTRA-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
 MM:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
@@ -46,83 +48,103 @@ MM:=$(subst -ULAW,-ulaw,$(MM))
 MM:=$(subst -ALAW,-alaw,$(MM))
 MM:=$(subst -GSM,-gsm,$(MM))
 MM:=$(subst -G729,-g729,$(MM))
+MM:=$(subst -G722,-g722,$(MM))
 MOH:=$(MM:MOH-%=asterisk-moh-%.tar.gz)
 MOH_TAGS:=$(MM:MOH-%=$(MOH_DIR)/.asterisk-moh-%)
+# If "fetch" is used, --continue is not a valid option.
+ifeq ($(WGET),wget)
 WGET_ARGS:=--continue
+endif
 
 all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
 
-$(SOUNDS_DIR)/.asterisk-core-sounds-en-%:
+have_download:
+       @if test "$(DOWNLOAD)" = ":" ; then \
+               echo "**************************************************"; \
+               echo "***                                            ***"; \
+               echo "*** You must have either wget or fetch to be   ***"; \
+               echo "*** able to automatically download and install ***"; \
+               echo "*** the requested sound packages.              ***"; \
+               echo "***                                            ***"; \
+               echo "*** Please install one of these, or remove any ***"; \
+               echo "*** extra sound package selections in          ***"; \
+               echo "*** menuselecct before installing Asterisk.    ***"; \
+               echo "***                                            ***"; \
+               echo "**************************************************"; \
+               exit 1; \
+       fi
+
+$(SOUNDS_DIR)/.asterisk-core-sounds-en-%: have_download
        @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
        rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
-       cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR) - && \
+       (cd $(SOUNDS_DIR)/en; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-$(SOUNDS_DIR)/.asterisk-core-sounds-es-%:
+$(SOUNDS_DIR)/.asterisk-core-sounds-es-%: have_download
        @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
        rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
-       cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/es - && \
+       (cd $(SOUNDS_DIR)/es; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-$(SOUNDS_DIR)/.asterisk-core-sounds-fr-%:
+$(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: have_download
        @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
        rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
-       cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/fr - && \
+       (cd $(SOUNDS_DIR)/fr; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-$(SOUNDS_DIR)/.asterisk-extra-sounds-en-%:
+$(SOUNDS_DIR)/.asterisk-extra-sounds-en-%: have_download
        @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
        rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
-       cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR) - && \
+       (cd $(SOUNDS_DIR)/en; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-$(SOUNDS_DIR)/.asterisk-extra-sounds-es-%:
+$(SOUNDS_DIR)/.asterisk-extra-sounds-es-%: have_download
        @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
        rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
-       cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/es - && \
+       (cd $(SOUNDS_DIR)/es; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-$(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%:
+$(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%: have_download
        @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
        rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
-       cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/fr - && \
+       (cd $(SOUNDS_DIR)/fr; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-$(MOH_DIR)/.asterisk-moh-%:
+$(MOH_DIR)/.asterisk-moh-%: have_download
        @PACKAGE=$(subst $(MOH_DIR)/.asterisk,asterisk,$@).tar.gz; \
-       if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
+       if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
        if test ! -f $${PACKAGE}; then exit 1; fi; \
-       cat $${PACKAGE} | gzip -d | tar xCf $(MOH_DIR) - && \
+       (cd $(MOH_DIR); cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xf -) && \
        touch $@
 
-asterisk-core-%.tar.gz:
-       @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
+asterisk-core-%.tar.gz: have_download
+       @$(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@
 
-asterisk-extra-%.tar.gz:
-       @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
+asterisk-extra-%.tar.gz: have_download
+       @$(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@
 
-asterisk-moh-%.tar.gz:
-       @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
+asterisk-moh-%.tar.gz: have_download
+       @$(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@
 
 dist-clean:
        rm -f *.tar.gz
 
-$(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
+$(SOUNDS_DIR)/en $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
        mkdir -p $@
 
-install: $(SOUNDS_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
+install: $(SOUNDS_DIR)/en $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
 
 uninstall:
        rm -rf $(SOUNDS_DIR)