[asterisk-commits] tilghman: branch 1.6.2 r267820 - in /branches/1.6.2: ./ autoconf/ sounds/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 3 20:41:31 CDT 2010


Author: tilghman
Date: Thu Jun  3 20:41:25 2010
New Revision: 267820

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=267820
Log:
Merged revisions 263724,267819 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r263724 | tilghman | 2010-05-17 18:49:15 -0500 (Mon, 17 May 2010) | 8 lines
  
  Cache sound tarfiles in a common directory, such that a clean reinstall does not force a re-download of the tarballs.
  
  (closes issue #15370)
   Reported by: pprindeville
   Patches: 
         asterisk-trunk-bugid15370.patch uploaded by pprindeville (license 347)
   Tested by: pprindeville, tilghman, seanbright
........
  r267819 | tilghman | 2010-06-03 20:36:46 -0500 (Thu, 03 Jun 2010) | 2 lines
  
  If there's a default, turn it on, even when the option isn't specified.
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/autoconf/ast_ext_lib.m4
    branches/1.6.2/configure
    branches/1.6.2/configure.ac
    branches/1.6.2/makeopts.in
    branches/1.6.2/sounds/Makefile

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/autoconf/ast_ext_lib.m4
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/autoconf/ast_ext_lib.m4?view=diff&rev=267820&r1=267819&r2=267820
==============================================================================
--- branches/1.6.2/autoconf/ast_ext_lib.m4 (original)
+++ branches/1.6.2/autoconf/ast_ext_lib.m4 Thu Jun  3 20:41:25 2010
@@ -34,6 +34,28 @@
     AC_SUBST([$1_INCLUDE])
     AC_SUBST([$1_DIR])
     AC_SUBST([PBX_$1])
+])
+
+# AST_OPTION_ONLY([option name], [option variable], [option description], [default value])
+AC_DEFUN([AST_OPTION_ONLY],
+[
+AC_ARG_WITH([$1], AC_HELP_STRING([--with-$1=PATH], [use $3 in PATH]),
+	[
+	case ${withval} in
+	n|no)
+		unset $2
+		;;
+	*)
+		if test "x${$2}" = "x"; then
+			m4_ifval($4, [$2="$4"], [:])
+		else
+			$2="${withval}"
+		fi
+		;;
+	esac
+	],
+	[m4_ifval($4, [$2="$4"])])
+AC_SUBST($2)
 ])
 
 # AST_EXT_LIB_SETUP_DEPENDENT([package symbol name], [package friendly name], [master package symbol name], [master package option name])

Modified: branches/1.6.2/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/configure.ac?view=diff&rev=267820&r1=267819&r2=267820
==============================================================================
--- branches/1.6.2/configure.ac (original)
+++ branches/1.6.2/configure.ac Thu Jun  3 20:41:25 2010
@@ -8,7 +8,7 @@
 
 AC_PREREQ(2.60)
 
-AC_INIT([asterisk], [trunk], [https://issues.asterisk.org])
+AC_INIT([asterisk], [1.6.2], [https://issues.asterisk.org])
 
 # Allow the --help=recursive option to function correctly
 AC_CONFIG_SUBDIRS([menuselect])
@@ -340,6 +340,7 @@
 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
 AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
+AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [${HOME}/.asterisk_sounds_cache])
 AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
 AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])

Modified: branches/1.6.2/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/makeopts.in?view=diff&rev=267820&r1=267819&r2=267820
==============================================================================
--- branches/1.6.2/makeopts.in (original)
+++ branches/1.6.2/makeopts.in Thu Jun  3 20:41:25 2010
@@ -23,6 +23,7 @@
 WGET=@WGET@
 FETCH=@FETCH@
 DOWNLOAD=@DOWNLOAD@
+SOUNDS_CACHE_DIR=@SOUNDS_CACHE_DIR@
 RUBBER=@RUBBER@
 CATDVI=@CATDVI@
 KPATHSEA=@KPATHSEA@

Modified: branches/1.6.2/sounds/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/sounds/Makefile?view=diff&rev=267820&r1=267819&r2=267820
==============================================================================
--- branches/1.6.2/sounds/Makefile (original)
+++ branches/1.6.2/sounds/Makefile Thu Jun  3 20:41:25 2010
@@ -15,7 +15,9 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts
 
+CMD_PREFIX?=@
 SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
+SOUNDS_CACHE_DIR?=
 MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
 CORE_SOUNDS_VERSION:=1.4.19
 EXTRA_SOUNDS_VERSION:=1.4.11
@@ -66,7 +68,64 @@
 WGET_ARGS:=--continue $(WGET_EXTRA_ARGS)
 endif
 
-all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
+EMPTY:=
+BS:=$(EMPTY)\$(EMPTY)
+
+ifneq ($(SOUNDS_CACHE_DIR),)
+
+define sound_format_lang_rule
+$$($(1))/.asterisk-$(2)$(if $(3),-$(3),)-%: have_download
+	$(CMD_PREFIX)PACKAGE=$$(subst $$($(1))/.asterisk,asterisk,$$@).tar.gz; $(BS)
+	if test ! -f $$$${PACKAGE}; then $(BS)
+	  if test ! -f $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE}; then $(BS)
+	    (cd $$(SOUNDS_CACHE_DIR); ($$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$$${PACKAGE} $$(SOUNDS_URL)/$$$${PACKAGE}.sha1 $(BS)
+	       && sha1sum -c --status $$$${PACKAGE}.sha1) || $(BS)
+	     (echo "Bad checksum: $$$${PACKAGE}" 1>&2; exit 1)); $(BS)
+	  fi; $(BS)
+	  cp -p $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE} .; $(BS)
+	fi; $(BS)
+$(if $($(4)_VERSION),\
+$(EMPTY)	rm -f $$(subst -$$($(4)_VERSION),,$$@)-* && $(BS)
+,)	(cd $$($(1))$(if $(3),/$(3),); cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof -) && $(BS)
+	touch $$@
+endef
+
+define sound_download_rule
+asterisk-$(1)-%.tar.gz: have_download
+	$(CMD_PREFIX)if test ! -f $$@ && test ! -f $$(SOUNDS_DIR)/.$$(subst .tar.gz,,$/$@); then $(BS)
+	  if test ! -f $$(SOUNDS_CACHE_DIR)/$$@; then $(BS)
+	    (cd $$(SOUNDS_CACHE_DIR); ($$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$@ $$(SOUNDS_URL)/$$@.sha1 $(BS)
+	       && sha1sum -c --status $$@.sha1) || $(BS)
+	     (echo "Bad checksum: $$@" 1>&2; exit 1)); $(BS)
+	  fi; $(BS)
+	  cp -p $$(SOUNDS_CACHE_DIR)/$$@ .; $(BS)
+	fi
+endef
+
+else
+
+define sound_format_lang_rule
+$$($(1))/.asterisk-$(2)$(if $(3),-$(3),)-%: have_download
+	$(CMD_PREFIX)PACKAGE=$$(subst $$($(1))/.asterisk,asterisk,$$@).tar.gz; $(BS)
+	if test ! -f $$$${PACKAGE}; then $(BS)
+	  ($$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$$${PACKAGE} || exit 1); $(BS)
+	fi; $(BS)
+$(if $($(4)_VERSION),\
+$(EMPTY)	rm -f $$(subst -$$($(4)_VERSION),,$$@)-* && $(BS)
+,)	(cd $$($(1))$(if $(3),/$(3),); cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof -) && $(BS)
+	touch $$@
+endef
+
+define sound_download_rule
+asterisk-$(1)-%.tar.gz: have_download
+	$(CMD_PREFIX)if test ! -f $$@ && test ! -f $$(SOUNDS_DIR)/.$$(subst .tar.gz,,$$@); then $(BS)
+	  $$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$@; $(BS)
+	fi
+endef
+
+endif
+
+all: $(SOUNDS_CACHE_DIR) $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
 
 have_download:
 	@if test "$(DOWNLOAD)" = ":" ; then \
@@ -84,78 +143,33 @@
 		exit 1; \
 	fi
 
-$(SOUNDS_DIR)/.asterisk-core-sounds-en-%: have_download
-	@PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	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),,$@)-* && \
-	(cd $(SOUNDS_DIR)/en; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,SOUNDS_DIR,core-sounds,en,CORE_SOUNDS))
 
-$(SOUNDS_DIR)/.asterisk-core-sounds-es-%: have_download
-	@PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	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),,$@)-* && \
-	(cd $(SOUNDS_DIR)/es; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,SOUNDS_DIR,core-sounds,es,CORE_SOUNDS))
 
-$(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: have_download
-	@PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	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),,$@)-* && \
-	(cd $(SOUNDS_DIR)/fr; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,SOUNDS_DIR,core-sounds,fr,CORE_SOUNDS))
 
-$(SOUNDS_DIR)/.asterisk-extra-sounds-en-%: have_download
-	@PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	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),,$@)-* && \
-	(cd $(SOUNDS_DIR)/en; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,SOUNDS_DIR,extra-sounds,en,EXTRA_SOUNDS))
 
-$(SOUNDS_DIR)/.asterisk-extra-sounds-es-%: have_download
-	@PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	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),,$@)-* && \
-	(cd $(SOUNDS_DIR)/es; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,SOUNDS_DIR,extra-sounds,es,EXTRA_SOUNDS))
 
-$(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%: have_download
-	@PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	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),,$@)-* && \
-	(cd $(SOUNDS_DIR)/fr; cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,SOUNDS_DIR,extra-sounds,fr,EXTRA_SOUNDS))
 
-$(MOH_DIR)/.asterisk-moh-%: have_download
-	@PACKAGE=$(subst $(MOH_DIR)/.asterisk,asterisk,$@).tar.gz; \
-	if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
-	if test ! -f $${PACKAGE}; then exit 1; fi; \
-	rm -f $(subst -$(MOH_VERSION),,$@)-* && \
-	(cd $(MOH_DIR); cat $(CURDIR)/$${PACKAGE} | gzip -d | tar xof -) && \
-	touch $@
+$(eval $(call sound_format_lang_rule,MOH_DIR,moh,,MOH))
 
-asterisk-core-%.tar.gz: have_download
-	@if test ! -f $@ && test ! -f $(SOUNDS_DIR)/.$(subst .tar.gz,,$@) ; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@;fi
+$(eval $(call sound_download_rule,core))
 
-asterisk-extra-%.tar.gz: have_download
-	@if test ! -f $@ && test ! -f $(SOUNDS_DIR)/.$(subst .tar.gz,,$@) ; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@;fi
+$(eval $(call sound_download_rule,extra))
 
-asterisk-moh-%.tar.gz: have_download
-	@if test ! -f $@ && test ! -f $(MOH_DIR)/.$(subst .tar.gz,,$@) ; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@;fi
+$(eval $(call sound_download_rule,moh))
 
 dist-clean:
 	rm -f *.tar.gz
 
-$(SOUNDS_DIR)/en $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
+$(SOUNDS_DIR)/en $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(SOUNDS_CACHE_DIR):
 	mkdir -p $@
 
-install: $(SOUNDS_DIR)/en $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
+install: ${SOUNDS_CACHE_DIR} $(SOUNDS_DIR)/en $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
 
 uninstall:
 	rm -rf $(SOUNDS_DIR)




More information about the asterisk-commits mailing list