| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
.PHONY: dist-clean all uninstall have_download install |
| 15 |
|
| 16 |
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts |
| 17 |
|
| 18 |
CMD_PREFIX?=@ |
| 19 |
SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds |
| 20 |
SOUNDS_CACHE_DIR?= |
| 21 |
MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh |
| 22 |
CORE_SOUNDS_VERSION:=1.6.1 |
| 23 |
EXTRA_SOUNDS_VERSION:=1.5.2 |
| 24 |
MOH_VERSION:=2.03 |
| 25 |
SOUNDS_URL:=https://downloads.asterisk.org/pub/telephony/sounds/releases |
| 26 |
MCS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS)) |
| 27 |
MCS:=$(subst -EN_AU-,-en_AU-,$(MCS)) |
| 28 |
MCS:=$(subst -EN_GB-,-en_GB-,$(MCS)) |
| 29 |
MCS:=$(subst -EN_NZ-,-en_NZ-,$(MCS)) |
| 30 |
MCS:=$(subst -FR-,-fr-,$(MCS)) |
| 31 |
MCS:=$(subst -ES-,-es-,$(MCS)) |
| 32 |
MCS:=$(subst -RU-,-ru-,$(MCS)) |
| 33 |
MCS:=$(subst -IT-,-it-,$(MCS)) |
| 34 |
MCS:=$(subst -JA-,-ja-,$(MCS)) |
| 35 |
MCS:=$(subst -SV-,-sv-,$(MCS)) |
| 36 |
MCS:=$(subst -WAV,-wav,$(MCS)) |
| 37 |
MCS:=$(subst -ULAW,-ulaw,$(MCS)) |
| 38 |
MCS:=$(subst -ALAW,-alaw,$(MCS)) |
| 39 |
MCS:=$(subst -GSM,-gsm,$(MCS)) |
| 40 |
MCS:=$(subst -G729,-g729,$(MCS)) |
| 41 |
MCS:=$(subst -G722,-g722,$(MCS)) |
| 42 |
MCS:=$(subst -SLN16,-sln16,$(MCS)) |
| 43 |
MCS:=$(subst -SIREN7,-siren7,$(MCS)) |
| 44 |
MCS:=$(subst -SIREN14,-siren14,$(MCS)) |
| 45 |
CORE_SOUNDS:=$(MCS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz) |
| 46 |
CORE_SOUND_TAGS:=$(MCS:CORE-SOUNDS-%=.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION)) |
| 47 |
MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS)) |
| 48 |
MES:=$(subst -EN_GB-,-en_GB-,$(MES)) |
| 49 |
MES:=$(subst -FR-,-fr-,$(MES)) |
| 50 |
MES:=$(subst -WAV,-wav,$(MES)) |
| 51 |
MES:=$(subst -ULAW,-ulaw,$(MES)) |
| 52 |
MES:=$(subst -ALAW,-alaw,$(MES)) |
| 53 |
MES:=$(subst -GSM,-gsm,$(MES)) |
| 54 |
MES:=$(subst -G729,-g729,$(MES)) |
| 55 |
MES:=$(subst -G722,-g722,$(MES)) |
| 56 |
MES:=$(subst -SLN16,-sln16,$(MES)) |
| 57 |
MES:=$(subst -SIREN7,-siren7,$(MES)) |
| 58 |
MES:=$(subst -SIREN14,-siren14,$(MES)) |
| 59 |
EXTRA_SOUNDS:=$(MES:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz) |
| 60 |
EXTRA_SOUND_TAGS:=$(MES:EXTRA-SOUNDS-%=.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION)) |
| 61 |
MM:=$(subst -OPSOUND-,-opsound-,$(MENUSELECT_MOH)) |
| 62 |
MM:=$(subst -WAV,-wav,$(MM)) |
| 63 |
MM:=$(subst -ULAW,-ulaw,$(MM)) |
| 64 |
MM:=$(subst -ALAW,-alaw,$(MM)) |
| 65 |
MM:=$(subst -GSM,-gsm,$(MM)) |
| 66 |
MM:=$(subst -G729,-g729,$(MM)) |
| 67 |
MM:=$(subst -G722,-g722,$(MM)) |
| 68 |
MM:=$(subst -SLN16,-sln16,$(MM)) |
| 69 |
MM:=$(subst -SIREN7,-siren7,$(MM)) |
| 70 |
MM:=$(subst -SIREN14,-siren14,$(MM)) |
| 71 |
MOH:=$(MM:MOH-%=asterisk-moh-%-$(MOH_VERSION).tar.gz) |
| 72 |
MOH_TAGS:=$(MM:MOH-%=.asterisk-moh-%-$(MOH_VERSION)) |
| 73 |
|
| 74 |
ifneq ($(findstring wget,$(DOWNLOAD)),) |
| 75 |
DOWNLOAD+=--continue $(WGET_EXTRA_ARGS) |
| 76 |
endif |
| 77 |
|
| 78 |
|
| 79 |
define sound_format_lang_rule |
| 80 |
.PHONY: .asterisk-$(2)$(if $(3),-$(3),)-% |
| 81 |
|
| 82 |
.asterisk-$(2)$(if $(3),-$(3),)-%: asterisk-$(2)$(if $(3),-$(3),)-%.tar.gz |
| 83 |
$(CMD_PREFIX) \ |
| 84 |
if test ! -f "$(1)$(if $(3),/$(3),)/$$@"; then \ |
| 85 |
PACKAGE=$$(subst .asterisk,asterisk,$$@).tar.gz; \ |
| 86 |
( \ |
| 87 |
mkdir -p "$(1)$(if $(3),/$(3),)"; \ |
| 88 |
cd "$(1)$(if $(3),/$(3),)"; \ |
| 89 |
rm -f $$(subst -$(4),,$$@)-*; \ |
| 90 |
cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof - \ |
| 91 |
) && touch "$(1)$(if $(3),/$(3),)/$$@"; \ |
| 92 |
fi |
| 93 |
|
| 94 |
asterisk-$(2)$(if $(3),-$(3),)-%.tar.gz: have_download |
| 95 |
ifneq ($(SOUNDS_CACHE_DIR),) |
| 96 |
$(CMD_PREFIX) \ |
| 97 |
if test ! -f "$(1)$(if $(3),/$(3),)/.$$(subst .tar.gz,,$$@)"; then \ |
| 98 |
if test ! -d "$$(SOUNDS_CACHE_DIR)/"; then \ |
| 99 |
mkdir -p "$$(SOUNDS_CACHE_DIR)/"; \ |
| 100 |
fi; \ |
| 101 |
if test ! -f "$$(SOUNDS_CACHE_DIR)/$$@"; then \ |
| 102 |
(cd "$$(SOUNDS_CACHE_DIR)"; $$(DOWNLOAD) $$(SOUNDS_URL)/$$@); \ |
| 103 |
fi; \ |
| 104 |
if test ! -f "$$(SOUNDS_CACHE_DIR)/[email protected]"; then \ |
| 105 |
(cd "$$(SOUNDS_CACHE_DIR)"; $$(DOWNLOAD) $$(SOUNDS_URL)/[email protected]); \ |
| 106 |
fi; \ |
| 107 |
$$(LN) -sf "$$(SOUNDS_CACHE_DIR)/$$@" .; \ |
| 108 |
$$(LN) -sf "$$(SOUNDS_CACHE_DIR)/[email protected]" .; \ |
| 109 |
$$(SHA1SUM) -c --status [email protected] || \ |
| 110 |
( \ |
| 111 |
rm -f "$$(SOUNDS_CACHE_DIR)/$$@" "$$(SOUNDS_CACHE_DIR)/[email protected]" $$@ [email protected]; \ |
| 112 |
echo "Bad checksum: $$@" 1>&2; \ |
| 113 |
exit 1; \ |
| 114 |
) || exit 1; \ |
| 115 |
fi |
| 116 |
else |
| 117 |
$(CMD_PREFIX) \ |
| 118 |
if test ! -f $$@ && test ! -f "$(1)$(if $(3),/$(3),)/.$$(subst .tar.gz,,$$@)"; then \ |
| 119 |
$$(DOWNLOAD) $$(SOUNDS_URL)/$$@; \ |
| 120 |
fi |
| 121 |
endif |
| 122 |
endef |
| 123 |
|
| 124 |
all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH) |
| 125 |
|
| 126 |
have_download: |
| 127 |
@if test "$(DOWNLOAD)" = ":" ; then \ |
| 128 |
echo "**************************************************"; \ |
| 129 |
echo "*** ***"; \ |
| 130 |
echo "*** You must have either wget, curl, or fetch ***"; \ |
| 131 |
echo "*** to be able to automatically download and ***"; \ |
| 132 |
echo "*** install the requested sound packages. ***"; \ |
| 133 |
echo "*** ***"; \ |
| 134 |
echo "*** Please install one of these, or remove any ***"; \ |
| 135 |
echo "*** extra sound package selections in ***"; \ |
| 136 |
echo "*** menuselect before installing Asterisk. ***"; \ |
| 137 |
echo "*** ***"; \ |
| 138 |
echo "**************************************************"; \ |
| 139 |
exit 1; \ |
| 140 |
fi |
| 141 |
|
| 142 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,en,$(CORE_SOUNDS_VERSION))) |
| 143 |
|
| 144 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,en_AU,$(CORE_SOUNDS_VERSION))) |
| 145 |
|
| 146 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,en_GB,$(CORE_SOUNDS_VERSION))) |
| 147 |
|
| 148 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,en_NZ,$(CORE_SOUNDS_VERSION))) |
| 149 |
|
| 150 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,es,$(CORE_SOUNDS_VERSION))) |
| 151 |
|
| 152 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,fr,$(CORE_SOUNDS_VERSION))) |
| 153 |
|
| 154 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,it,$(CORE_SOUNDS_VERSION))) |
| 155 |
|
| 156 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,ru,$(CORE_SOUNDS_VERSION))) |
| 157 |
|
| 158 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,ja,$(CORE_SOUNDS_VERSION))) |
| 159 |
|
| 160 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,sv,$(CORE_SOUNDS_VERSION))) |
| 161 |
|
| 162 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,en,$(EXTRA_SOUNDS_VERSION))) |
| 163 |
|
| 164 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,en_GB,$(EXTRA_SOUNDS_VERSION))) |
| 165 |
|
| 166 |
$(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,fr,$(EXTRA_SOUNDS_VERSION))) |
| 167 |
|
| 168 |
$(eval $(call sound_format_lang_rule,$(MOH_DIR),moh,,$(MOH_VERSION))) |
| 169 |
|
| 170 |
dist-clean: |
| 171 |
rm -f *.tar.gz |
| 172 |
|
| 173 |
install: $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS) |
| 174 |
|
| 175 |
uninstall: |
| 176 |
rm -rf "$(SOUNDS_DIR)" |
| 177 |
rm -rf "$(MOH_DIR)" |
| 178 |
|
| 179 |
core_sounds_version: |
| 180 |
@echo $(CORE_SOUNDS_VERSION) |
| 181 |
|
| 182 |
extra_sounds_version: |
| 183 |
@echo $(EXTRA_SOUNDS_VERSION) |
| 184 |
|
| 185 |
moh_version: |
| 186 |
@echo $(MOH_VERSION) |