diff --git a/Makefile.am b/Makefile.am index 4c65a8df82..f209dc739c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,10 +10,21 @@ AM_LDFLAGS = $(SWITCH_AM_LDFLAGS) BASE = $(switch_srcdir) OSARCH=`uname -s` +DEFAULT_SOUNDS=en-us-callie-8000 + .DEFAULT: @target=`echo $@ | sed -e 's|^.*-||'`; \ - if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; - @cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ + target_prefix=`echo $@ | sed -e 's|-.*$$||'`; \ + sound_perfix=`echo $@ | sed -e 's|-.*||'`; \ + full_sound_dir=`echo $@ | sed -e 's|^sounds-||' | sed -e 's|-install$$||'`; \ + test -z "$$full_sound_dir" || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \ + soundfile=`echo freeswitch-sounds-$$full_sound_dir-$(PACKAGE_VERSION).tar.gz`; \ + if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \ + if test "$$target_prefix" = "sounds"; then \ + if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \ + else \ + cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\ + fi libfreeswitch_la_SOURCES = \ src/switch_apr.c \ diff --git a/build/getsounds.sh.in b/build/getsounds.sh.in new file mode 100755 index 0000000000..e2384da4e5 --- /dev/null +++ b/build/getsounds.sh.in @@ -0,0 +1,36 @@ +#!/bin/sh + +TAR=@TAR@ +ZCAT=@ZCAT@ +WGET=@WGET@ +CURL=@CURL@ + +DIR=`pwd` + +if [ -f $WGET ] ; then + DOWNLOAD_CMD=$WGET +else + if [ -f $CURL ] ; then + DOWNLOAD_CMD="$CURL -O" + fi +fi + +base=http://files.freeswitch.org/ +tarfile=$1 +install=$2 + +if [ ! -f $tarfile ] ; then + $DOWNLOAD_CMD $base$tarfile + if [ ! -f $tarfile ] ; then + echo cannot find $tarfile + exit 1 + fi +fi + +if [ ! -z $install ] ; then + test -d $install || mkdir $install + cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR x +fi + +exit 0 + diff --git a/configure.in b/configure.in index 44493d3a6b..31cc9ef43f 100644 --- a/configure.in +++ b/configure.in @@ -382,6 +382,8 @@ AC_PATH_PROGS(WGET, wget) AC_PATH_PROGS(CURL, curl) GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh" AC_SUBST(GETLIB) +GETSOUNDS="${SHELL} $switch_srcdir/build/getsounds.sh" +AC_SUBST(GETSOUNDS) LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include']) @@ -414,6 +416,7 @@ AC_CONFIG_FILES([Makefile src/mod/event_handlers/mod_radius_cdr/Makefile src/mod/languages/mod_java/Makefile src/include/switch_am_config.h + build/getsounds.sh build/getlib.sh build/modmake.rules])