Merged revisions 333203 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/10

................
  r333203 | qwell | 2011-08-25 10:29:56 -0500 (Thu, 25 Aug 2011) | 15 lines
  
  Merged revisions 333201 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r333201 | qwell | 2011-08-25 10:27:06 -0500 (Thu, 25 Aug 2011) | 8 lines
    
    Fix installation into directories containing spaces.
    
    This also vastly simplifies the logic in sounds/Makefile
    
    (Closes issue ASTERISK-18290)
    Reported by: Paul Belanger
    Review: https://reviewboard.asterisk.org/r/1379/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker
2011-08-25 15:30:46 +00:00
parent 590391c038
commit 00a8f14fb1
6 changed files with 486 additions and 806 deletions

View File

@@ -555,6 +555,7 @@ installdirs:
$(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/keys" $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/keys"
$(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/phoneprov" $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/phoneprov"
$(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/static-http" $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/static-http"
$(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/sounds"
$(INSTALL) -d "$(DESTDIR)$(ASTMANDIR)/man8" $(INSTALL) -d "$(DESTDIR)$(ASTMANDIR)/man8"
$(INSTALL) -d "$(DESTDIR)$(AGI_DIR)" $(INSTALL) -d "$(DESTDIR)$(AGI_DIR)"
$(INSTALL) -d "$(DESTDIR)$(ASTDBDIR)" $(INSTALL) -d "$(DESTDIR)$(ASTDBDIR)"
@@ -617,17 +618,7 @@ ifneq ($(findstring ~,$(DESTDIR)),)
@exit 1 @exit 1
endif endif
preinstall_spaces: install: badshell bininstall datafiles
ifneq ($(MAKE_PREINSTALL),)
$(MAKE_PREINSTALL)
endif
postinstall_spaces:
ifneq ($(MAKE_POSTINSTALL),)
$(MAKE_POSTINSTALL)
endif
install: preinstall_spaces badshell bininstall datafiles postinstall_spaces
@if [ -x /usr/sbin/asterisk-post-install ]; then \ @if [ -x /usr/sbin/asterisk-post-install ]; then \
/usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \ /usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \
fi fi
@@ -664,32 +655,32 @@ adsi:
$(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)" $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
@for x in configs/*.adsi; do \ @for x in configs/*.adsi; do \
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \ dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
if [ -f $${dst} ] ; then \ if [ -f "$${dst}" ] ; then \
echo "Overwriting $$x" ; \ echo "Overwriting $$x" ; \
else \ else \
echo "Installing $$x" ; \ echo "Installing $$x" ; \
fi ; \ fi ; \
$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \ $(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
done done
samples: adsi samples: adsi
@echo Installing other config files... @echo Installing other config files...
@for x in configs/*.sample; do \ @for x in configs/*.sample; do \
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \ dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \
if [ -f $${dst} ]; then \ if [ -f "$${dst}" ]; then \
if [ "$(OVERWRITE)" = "y" ]; then \ if [ "$(OVERWRITE)" = "y" ]; then \
if cmp -s $${dst} $$x ; then \ if cmp -s "$${dst}" "$$x" ; then \
echo "Config file $$x is unchanged"; \ echo "Config file $$x is unchanged"; \
continue; \ continue; \
fi ; \ fi ; \
mv -f $${dst} $${dst}.old ; \ mv -f "$${dst}" "$${dst}.old" ; \
else \ else \
echo "Skipping config file $$x"; \ echo "Skipping config file $$x"; \
continue; \ continue; \
fi ;\ fi ;\
fi ; \ fi ; \
echo "Installing file $$x"; \ echo "Installing file $$x"; \
$(INSTALL) -m 644 $$x $${dst} ;\ $(INSTALL) -m 644 "$$x" "$${dst}" ;\
done done
if [ "$(OVERWRITE)" = "y" ]; then \ if [ "$(OVERWRITE)" = "y" ]; then \
echo "Updating asterisk.conf" ; \ echo "Updating asterisk.conf" ; \

View File

@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
PPATH=$1 PPATH="$1"
## Make sure we were called from Makefile ## Make sure we were called from Makefile
if [ "x$ASTERISKVERSIONNUM" = "x" ]; then if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
@@ -9,7 +9,7 @@ fi
## Create a pkgconfig spec file for 3rd party modules (pkg-config asterisk --cflags) ## Create a pkgconfig spec file for 3rd party modules (pkg-config asterisk --cflags)
if [ ! -d $PPATH ]; then if [ ! -d "$PPATH" ]; then
exit exit
fi fi
@@ -29,7 +29,7 @@ LOCAL_CFLAGS=`echo $CFLAGS | ${EXTREGEX} 's/\s*-pipe\s*//g' | ${EXTREGEX} 's/-[W
${EXTREGEX} 's/-DAST(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR)=\S* //g'` ${EXTREGEX} 's/-DAST(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR)=\S* //g'`
cat <<EOF > $PPATH/asterisk.pc cat <<EOF > "$PPATH/asterisk.pc"
install_prefix=$INSTALL_PREFIX install_prefix=$INSTALL_PREFIX
version_number=$ASTERISKVERSIONNUM version_number=$ASTERISKVERSIONNUM
etcdir=$ASTETCDIR etcdir=$ASTETCDIR

1043
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -133,78 +133,6 @@ if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
fi fi
fi fi
# $HOME is preferred as our substitute path, unless $HOME contains a space
for i in ${HOME} /tmp; do
if test "${i}" = ""; then continue; fi
if test "${i}" = "/"; then continue; fi
__ac_path_has_spaces=`echo $HOME | grep ' '`
if test "$ac_path_has_spaces" = ""; then :; else continue; fi
__ac_substitute_path=${i}
break
done
AC_PROG_LN_S
__sub_ordinal=1
MAKE_PREINSTALL=""
MAKE_POSTINSTALL=""
# It may initially seem a trifle bit excessive to evaluate all of these paths.
# However, consider that many of these may invoke another variable, such as
# ${prefix}, by default, which is not resolved until compile time. If that
# variable contains a space, then each of the dependent variables will also
# contain a space and thus will need the special treatment.
for stdpath in prefix exec_prefix datarootdir datadir includedir infodir libdir libexecdir localstatedir mandir sbindir sharedstatedir sysconfdir astetcdir astsbindir astlibdir astheaderdir astmandir astvarlibdir astspooldir astlogdir astvarrundir astdatadir astdbdir astkeydir; do
eval "__ac_path_sub=\${$stdpath}"
#echo "__ac_path_sub=$__ac_path_sub"
__ac_path_has_var=`sh -c "echo '$__ac_path_sub' | grep '{'"`
if test "$__ac_path_has_var" = ""; then :; else
__ac_path_sub=`echo $__ac_path_sub | sed 's/{/{MAKE_/'`
fi
__ac_path_has_spaces=`sh -c "echo '$__ac_path_sub' | grep ' '"`
if test "$__ac_path_has_spaces" = ""; then
eval "MAKE_$stdpath=\$__ac_path_sub"
else
# Substitute path for a path without a space
eval "MAKE_$stdpath=\"$__ac_substitute_path/.asterisk_install_path_${__sub_ordinal}\""
MAKE_POSTINSTALL="${MAKE_POSTINSTALL} rm -f \"$__ac_substitute_path/.asterisk_install_path_${__sub_ordinal}\";"
MAKE_PREINSTALL="${MAKE_PREINSTALL} rm -f \"$__ac_substitute_path/.asterisk_install_path_${__sub_ordinal}\";"
MAKE_PREINSTALL="${MAKE_PREINSTALL} ${LN_S} -f \"\$(DESTDIR)$__ac_path_sub\" \"$__ac_substitute_path/.asterisk_install_path_${__sub_ordinal}\";"
__sub_ordinal=$((${__sub_ordinal}+1))
fi
done
AC_SUBST(MAKE_PREINSTALL)
AC_SUBST(MAKE_POSTINSTALL)
AC_SUBST(MAKE_prefix)
AC_SUBST(MAKE_exec_prefix)
AC_SUBST(MAKE_datarootdir)
AC_SUBST(MAKE_datadir)
AC_SUBST(MAKE_includedir)
AC_SUBST(MAKE_infodir)
AC_SUBST(MAKE_libdir)
AC_SUBST(MAKE_libexecdir)
AC_SUBST(MAKE_localstatedir)
AC_SUBST(MAKE_mandir)
AC_SUBST(MAKE_sbindir)
AC_SUBST(MAKE_sharedstatedir)
AC_SUBST(MAKE_sysconfdir)
AC_SUBST(MAKE_astetcdir)
AC_SUBST(MAKE_astsbindir)
AC_SUBST(MAKE_astlibdir)
AC_SUBST(MAKE_astheaderdir)
AC_SUBST(MAKE_astmandir)
AC_SUBST(MAKE_astvarlibdir)
AC_SUBST(MAKE_astspooldir)
AC_SUBST(MAKE_astlogdir)
AC_SUBST(MAKE_astvarrundir)
AC_SUBST(MAKE_astdatadir)
AC_SUBST(MAKE_astdbdir)
AC_SUBST(MAKE_astkeydir)
test "x$MAKE_prefix" = xNONE && MAKE_prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$MAKE_exec_prefix" = xNONE && MAKE_exec_prefix='${prefix}'
BUILD_PLATFORM=${build} BUILD_PLATFORM=${build}
BUILD_CPU=${build_cpu} BUILD_CPU=${build_cpu}
BUILD_VENDOR=${build_vendor} BUILD_VENDOR=${build_vendor}
@@ -299,6 +227,7 @@ AC_PROG_CXXCPP
AST_PROG_LD # note, does not work on FreeBSD AST_PROG_LD # note, does not work on FreeBSD
AC_PROG_AWK AC_PROG_AWK
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB AC_PROG_RANLIB
AST_CHECK_GNU_MAKE AST_CHECK_GNU_MAKE
AC_PROG_EGREP AC_PROG_EGREP

View File

@@ -34,8 +34,6 @@ XMLSTARLET=@XMLSTARLET@
MD5=@MD5@ MD5=@MD5@
SHA1SUM=@SHA1SUM@ SHA1SUM=@SHA1SUM@
OPENSSL=@OPENSSL@ OPENSSL=@OPENSSL@
MAKE_PREINSTALL=@MAKE_PREINSTALL@
MAKE_POSTINSTALL=@MAKE_POSTINSTALL@
BUILD_PLATFORM=@BUILD_PLATFORM@ BUILD_PLATFORM=@BUILD_PLATFORM@
BUILD_CPU=@BUILD_CPU@ BUILD_CPU=@BUILD_CPU@
@@ -93,35 +91,6 @@ ASTSPOOLDIR = @astspooldir@
ASTLOGDIR = @astlogdir@ ASTLOGDIR = @astlogdir@
ASTVARRUNDIR = @astvarrundir@ ASTVARRUNDIR = @astvarrundir@
MAKE_prefix = @MAKE_prefix@
MAKE_exec_prefix = @MAKE_exec_prefix@
MAKE_datarootdir = @MAKE_datarootdir@
MAKE_datadir = @MAKE_datadir@
MAKE_includedir = @MAKE_includedir@
MAKE_infodir = @MAKE_infodir@
MAKE_libdir = @MAKE_libdir@
MAKE_libexecdir = @MAKE_libexecdir@
MAKE_localstatedir = @MAKE_localstatedir@
MAKE_mandir = @MAKE_mandir@
MAKE_sbindir = @MAKE_sbindir@
MAKE_sharedstatedir = @MAKE_sharedstatedir@
MAKE_sysconfdir = @MAKE_sysconfdir@
MAKE_ASTSBINDIR = @MAKE_astsbindir@
MAKE_ASTETCDIR = @MAKE_astetcdir@
MAKE_ASTHEADERDIR = @MAKE_astheaderdir@
MAKE_ASTLIBDIR = @MAKE_astlibdir@
MAKE_ASTMANDIR = @MAKE_astmandir@
MAKE_astvarlibdir = @MAKE_astvarlibdir@
MAKE_ASTVARLIBDIR = @MAKE_astvarlibdir@
MAKE_ASTDATADIR = @MAKE_astdatadir@
MAKE_ASTDBDIR = @MAKE_astdbdir@
MAKE_ASTKEYDIR = @MAKE_astkeydir@
MAKE_ASTSPOOLDIR = @MAKE_astspooldir@
MAKE_ASTLOGDIR = @MAKE_astlogdir@
MAKE_ASTVARRUNDIR = @MAKE_astvarrundir@
AST_DEVMODE=@AST_DEVMODE@ AST_DEVMODE=@AST_DEVMODE@
NOISY_BUILD=@NOISY_BUILD@ NOISY_BUILD=@NOISY_BUILD@

View File

@@ -16,9 +16,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts
CMD_PREFIX?=@ CMD_PREFIX?=@
SOUNDS_DIR:=$(MAKE_ASTDATADIR)/sounds SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
SOUNDS_CACHE_DIR?= SOUNDS_CACHE_DIR?=
MOH_DIR:=$(MAKE_ASTDATADIR)/moh MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
CORE_SOUNDS_VERSION:=1.4.21 CORE_SOUNDS_VERSION:=1.4.21
EXTRA_SOUNDS_VERSION:=1.4.11 EXTRA_SOUNDS_VERSION:=1.4.11
MOH_VERSION:=2.03 MOH_VERSION:=2.03
@@ -38,7 +38,7 @@ MCS:=$(subst -SLN16,-sln16,$(MCS))
MCS:=$(subst -SIREN7,-siren7,$(MCS)) MCS:=$(subst -SIREN7,-siren7,$(MCS))
MCS:=$(subst -SIREN14,-siren14,$(MCS)) MCS:=$(subst -SIREN14,-siren14,$(MCS))
CORE_SOUNDS:=$(MCS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz) 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)) CORE_SOUND_TAGS:=$(MCS:CORE-SOUNDS-%=.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS)) MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
MES:=$(subst -FR-,-fr-,$(MES)) MES:=$(subst -FR-,-fr-,$(MES))
MES:=$(subst -ES-,-es-,$(MES)) MES:=$(subst -ES-,-es-,$(MES))
@@ -52,7 +52,7 @@ MES:=$(subst -SLN16,-sln16,$(MES))
MES:=$(subst -SIREN7,-siren7,$(MES)) MES:=$(subst -SIREN7,-siren7,$(MES))
MES:=$(subst -SIREN14,-siren14,$(MES)) MES:=$(subst -SIREN14,-siren14,$(MES))
EXTRA_SOUNDS:=$(MES:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz) 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)) EXTRA_SOUND_TAGS:=$(MES:EXTRA-SOUNDS-%=.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
MM:=$(subst -OPSOUND-,-opsound-,$(MENUSELECT_MOH)) MM:=$(subst -OPSOUND-,-opsound-,$(MENUSELECT_MOH))
MM:=$(subst -WAV,-wav,$(MM)) MM:=$(subst -WAV,-wav,$(MM))
MM:=$(subst -ULAW,-ulaw,$(MM)) MM:=$(subst -ULAW,-ulaw,$(MM))
@@ -64,76 +64,59 @@ MM:=$(subst -SLN16,-sln16,$(MM))
MM:=$(subst -SIREN7,-siren7,$(MM)) MM:=$(subst -SIREN7,-siren7,$(MM))
MM:=$(subst -SIREN14,-siren14,$(MM)) MM:=$(subst -SIREN14,-siren14,$(MM))
MOH:=$(MM:MOH-%=asterisk-moh-%-$(MOH_VERSION).tar.gz) MOH:=$(MM:MOH-%=asterisk-moh-%-$(MOH_VERSION).tar.gz)
MOH_TAGS:=$(MM:MOH-%=$(MOH_DIR)/.asterisk-moh-%-$(MOH_VERSION)) MOH_TAGS:=$(MM:MOH-%=.asterisk-moh-%-$(MOH_VERSION))
# If "fetch" is used, --continue is not a valid option. # If "fetch" is used, --continue is not a valid option.
ifneq ($(findstring wget,$(DOWNLOAD)),) ifneq ($(findstring wget,$(DOWNLOAD)),)
DOWNLOAD+=--continue $(WGET_EXTRA_ARGS) DOWNLOAD+=--continue $(WGET_EXTRA_ARGS)
endif endif
ifneq ($(SOUNDS_CACHE_DIR),)
define sound_format_lang_rule define sound_format_lang_rule
$(1)/.asterisk-$(2)$(if $(3),-$(3),)-%: have_download .PHONY: .asterisk-$(2)$(if $(3),-$(3),)-%
$(CMD_PREFIX)PACKAGE=$$(subst $(1)/.asterisk,asterisk,$$@).tar.gz; \
if test ! -f $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE}; then \
(cd $$(SOUNDS_CACHE_DIR); $$(DOWNLOAD) $$(SOUNDS_URL)/$$$${PACKAGE}); \
fi; \
if test ! -f $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE}.sha1; then \
(cd $$(SOUNDS_CACHE_DIR); $$(DOWNLOAD) $$(SOUNDS_URL)/$$$${PACKAGE}.sha1); \
fi; \
$(LN) -sf $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE} .; \
$(LN) -sf $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE}.sha1 .; \
$$(SHA1SUM) -c --status $$$${PACKAGE}.sha1 || \
( \
rm -f $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE} $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE}.sha1 $$$${PACKAGE} $$$${PACKAGE}.sha1; \
echo "Bad checksum: $$$${PACKAGE}" 1>&2; \
exit 1; \
) || exit 1; \
rm -f $$(subst -$(4),,$$@)-*; \
(cd $(1)$(if $(3),/$(3),); cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof -) && touch $$@
endef
define sound_download_rule .asterisk-$(2)$(if $(3),-$(3),)-%: asterisk-$(2)$(if $(3),-$(3),)-%.tar.gz
asterisk-$(1)-%.tar.gz: have_download
$(CMD_PREFIX) \ $(CMD_PREFIX) \
if test ! -f $$(SOUNDS_CACHE_DIR)/$$@; then \ if test ! -f "$(1)$(if $(3),/$(3),)/$$@"; then \
(cd $$(SOUNDS_CACHE_DIR); $$(DOWNLOAD) $$(SOUNDS_URL)/$$@); \ PACKAGE=$$(subst .asterisk,asterisk,$$@).tar.gz; \
fi; \
if test ! -f $$(SOUNDS_CACHE_DIR)/$$@.sha1; then \
(cd $$(SOUNDS_CACHE_DIR); $$(DOWNLOAD) $$(SOUNDS_URL)/$$@.sha1); \
fi; \
$(LN) -sf $$(SOUNDS_CACHE_DIR)/$$@ .; \
$(LN) -sf $$(SOUNDS_CACHE_DIR)/$$@.sha1 .; \
$$(SHA1SUM) -c --status $$@.sha1 || \
( \ ( \
rm -f $$(SOUNDS_CACHE_DIR)/$$@ $$(SOUNDS_CACHE_DIR)/$$@.sha1 $$@ $$@.sha1; \ mkdir -p "$(1)$(if $(3),/$(3),)"; \
echo "Bad checksum: $$@" 1>&2; \ cd "$(1)$(if $(3),/$(3),)"; \
exit 1; \ rm -f $$(subst -$(4),,$$@)-*; \
) || exit 1 cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof - \
endef ) && touch "$(1)$(if $(3),/$(3),)/$$@"; \
fi
asterisk-$(2)$(if $(3),-$(3),)-%.tar.gz: have_download
ifneq ($(SOUNDS_CACHE_DIR),)
$(CMD_PREFIX) \
if test ! -f "$(1)$(if $(3),/$(3),)/.$$(subst .tar.gz,,$$@)"; then \
if test ! -d "$$(SOUNDS_CACHE_DIR)/"; then \
mkdir -p "$$(SOUNDS_CACHE_DIR)/"; \
fi; \
if test ! -f "$$(SOUNDS_CACHE_DIR)/$$@"; then \
(cd "$$(SOUNDS_CACHE_DIR)"; $$(DOWNLOAD) $$(SOUNDS_URL)/$$@); \
fi; \
if test ! -f "$$(SOUNDS_CACHE_DIR)/$$@.sha1"; then \
(cd "$$(SOUNDS_CACHE_DIR)"; $$(DOWNLOAD) $$(SOUNDS_URL)/$$@.sha1); \
fi; \
$$(LN) -sf "$$(SOUNDS_CACHE_DIR)/$$@" .; \
$$(LN) -sf "$$(SOUNDS_CACHE_DIR)/$$@.sha1" .; \
$$(SHA1SUM) -c --status $$@.sha1 || \
( \
rm -f "$$(SOUNDS_CACHE_DIR)/$$@" "$$(SOUNDS_CACHE_DIR)/$$@.sha1" $$@ $$@.sha1; \
echo "Bad checksum: $$@" 1>&2; \
exit 1; \
) || exit 1; \
fi
else else
$(CMD_PREFIX) \
define sound_format_lang_rule if test ! -f $$@ && test ! -f "$(1)$(if $(3),/$(3),)/.$$(subst .tar.gz,,$$@)"; then \
$(1)/.asterisk-$(2)$(if $(3),-$(3),)-%: have_download
$(CMD_PREFIX)PACKAGE=$$(subst $(1)/.asterisk,asterisk,$$@).tar.gz; \
if test ! -f $$$${PACKAGE}; then \
$$(DOWNLOAD) $$(SOUNDS_URL)/$$$${PACKAGE} || exit 1; \
fi; \
rm -f $$(subst -$(4),,$$@)-*; \
(cd $(1)$(if $(3),/$(3),); cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof -) && 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 \
$$(DOWNLOAD) $$(SOUNDS_URL)/$$@; \ $$(DOWNLOAD) $$(SOUNDS_URL)/$$@; \
fi fi
endef
endif endif
endef # sound_format_lang_rule
all: $(SOUNDS_CACHE_DIR) $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH) all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
have_download: have_download:
@if test "$(DOWNLOAD)" = ":" ; then \ @if test "$(DOWNLOAD)" = ":" ; then \
@@ -169,23 +152,14 @@ $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,fr,$(EXTRA_SOUND
$(eval $(call sound_format_lang_rule,$(MOH_DIR),moh,,$(MOH_VERSION))) $(eval $(call sound_format_lang_rule,$(MOH_DIR),moh,,$(MOH_VERSION)))
$(eval $(call sound_download_rule,core-sounds))
$(eval $(call sound_download_rule,extra-sounds))
$(eval $(call sound_download_rule,moh))
dist-clean: dist-clean:
rm -f *.tar.gz rm -f *.tar.gz
$(SOUNDS_DIR)/en $(MOH_DIR) $(SOUNDS_DIR)/en_AU $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(SOUNDS_DIR)/ru $(SOUNDS_CACHE_DIR): install: $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
mkdir -p $@
install: $(SOUNDS_CACHE_DIR) $(SOUNDS_DIR)/en $(SOUNDS_DIR)/en_AU $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
uninstall: uninstall:
rm -rf $(SOUNDS_DIR) rm -rf "$(SOUNDS_DIR)"
rm -rf $(MOH_DIR) rm -rf "$(MOH_DIR)"
core_sounds_version: core_sounds_version:
@echo $(CORE_SOUNDS_VERSION) @echo $(CORE_SOUNDS_VERSION)