aboutsummaryrefslogtreecommitdiffstats
path: root/audio/freeswitch-sounds/Makefile
blob: 4a32b5ae99873583e31b59d8981d23e504dc95a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Ports collection makefile for: freeswitch-sounds
# Date created: May 11, 2010
# Whom: Eric F Crist <ecrist@secure-computing.net>
#
# $FreeBSD$
#

PORTNAME=   freeswitch-sounds
PORTVERSION=    1.0.13
PORTREVISION=   1
CATEGORIES= audio
MASTER_SITES=   http://files.freeswitch.org/
DIST_SUBDIR=    freeswitch-sounds

MAINTAINER= ecrist@secure-computing.net
COMMENT=    FreeSwitch Sounds (All Bitrates)

PLIST=      ${WRKDIR}/plist
NO_WRKSUBDIR=   yes

BASE_PORTNAME=  freeswitch

OPTIONS=    8K           "Compile sounds for 8K" on \
        16K          "Compile sounds for 16K" on \
        32K          "Compile sounds for 32K" on \
        48K          "Compile sounds for 48K" on \
        ENGLISH      "Compile English Language Sounds" on \
        RUSSIAN      "Compile Russian Language Sounds" off

.include <bsd.port.options.mk>
.if defined(WITH_ENGLISH)
DISTFILES+= ${PORTNAME}-en-us-callie-48000-${PORTVERSION}${EXTRACT_SUFX}
.endif
.if defined(WITH_RUSSIAN)
DISTFILES+= ${PORTNAME}-ru-RU-elena-48000-1.0.12${EXTRACT_SUFX}
.endif
.if ! defined(WITH_ENGLISH) && ! defined(WITH_RUSSIAN)
BROKEN= you must build with either English, Russian, or both
.endif
.if ! defined(WITH_8K) && ! defined(WITH_16K) && ! defined(WITH_32K) && \
    ! defined(WITH_48K)
BROKEN= you must build with at least one of 8K, 16K, 32K, or 48K sounds
.endif

.if defined(WITH_8K)
BUILD_DEPENDS+= sox:${PORTSDIR}/audio/sox
BITRATES+=  8000
.endif
.if defined(WITH_16K)
BUILD_DEPENDS+= sox:${PORTSDIR}/audio/sox
BITRATES+=  16000
.endif
.if defined(WITH_32K)
BUILD_DEPENDS+= sox:${PORTSDIR}/audio/sox
BITRATES+=  32000
.endif
.if defined(WITH_48K)
BITRATES+=  48000
.endif

do-build:
    @${ECHO_MSG} "Building for bitrates: ${BITRATES}"
    if [ "${WITH_ENGLISH}" != "" -a ! -e "${WRKDIR}/ENGLISH.done" ]; then \
        for rate in ${BITRATES}; do \
            ${ECHO_MSG} "WORKING on $${rate}!"; \
            if [ "$${rate}" -eq "48000" ]; then \
                ${CP} -R ${WRKSRC}/en/us/callie/ ${WRKDIR}/tmp/en/us/callie/; \
            else \
                for dir in `ls ${WRKSRC}/en/us/callie/`; do \
                    ${MKDIR} ${WRKDIR}/tmp/en/us/callie/$${dir}/$${rate}/; \
                    echo "@rmdir share/${BASE_PORTNAME}/sounds/en/us/callie/$${dir}/$${rate}/" >> ${PLIST}; \
                    for filename in `ls ${WRKSRC}/en/us/callie/$${dir}/48000`; do \
                        echo "share/${BASE_PORTNAME}/sounds/en/us/callie/$${dir}/$${rate}/$${filename}" >> ${PLIST}; \
                        if [ ! -e "${WRKDIR}/tmp/en/us/callie/$${dir}/$${rate}/$${filename}" ]; then \
                            ${ECHO_MSG} "${LOCALBASE}/bin/sox -v 0.2 ${WRKSRC}/en/us/callie/$${dir}/48000/$${filename} -r $${rate} -c 1 ${WRKDIR}/tmp/en/us/callie/$${dir}/$${rate}/$${filename}"; \
                            ${LOCALBASE}/bin/sox -v 0.2 "${WRKSRC}/en/us/callie/$${dir}/48000/$${filename}" -r $${rate} -c 1 "${WRKDIR}/tmp/en/us/callie/$${dir}/$${rate}/$${filename}"; \
                        fi \
                    done; \
                done; \
            fi \
        done; \
        ${TOUCH} ${WRKDIR}/ENGLISH.done; \
    fi
    if [ "${WITH_RUSSIAN}" != "" -a ! -e "${WRKDIR}/RUSSIAN.done" ]; then \
        for rate in ${BITRATES}; do \
            ${ECHO_MSG} "WORKING on $${rate}!"; \
            if [ "$${rate}" -eq "48000" ]; then \
                ${CP} -R ${WRKSRC}/ru/RU/elena/ ${WRKDIR}/tmp/ru/RU/elena/; \
            else \
                for dir in `ls ${WRKSRC}/ru/RU/elena/`; do \
                    ${MKDIR} ${WRKDIR}/tmp/ru/RU/elena/$${dir}/$${rate}/; \
                    echo "@rmdir share/${BASE_PORTNAME}/sounds/ru/RU/elena/$${dir}/$${rate}/" >> ${PLIST}; \
                    for filename in `ls ${WRKSRC}/ru/RU/elena/$${dir}/48000`; do \
                        echo "share/${BASE_PORTNAME}/sounds/ru/RU/elena/$${dir}/$${rate}/$${filename}" >> ${PLIST}; \
                        if [ ! -e "${WRKDIR}/tmp/ru/RU/elena/$${dir}/$${rate}/$${filename}" ]; then \
                            ${ECHO_MSG} "${LOCALBASE}/bin/sox -v 0.2 ${WRKSRC}/ru/RU/elena/$${dir}/48000/$${filename} -r $${rate} -c 1 ${WRKDIR}/tmp/ru/RU/elena/$${dir}/$${rate}/$${filename}"; \
                            ${LOCALBASE}/bin/sox -v 0.2 "${WRKSRC}/ru/RU/elena/$${dir}/48000/$${filename}" -r $${rate} -c 1 "${WRKDIR}/tmp/ru/RU/elena/$${dir}/$${rate}/$${filename}"; \
                        fi \
                    done; \
                done; \
            fi \
        done; \
        ${TOUCH} ${WRKDIR}/RUSSIAN.done; \
    fi

pre-install:
    @${RM} -rf ${PLIST}
    @cd ${WRKDIR}/tmp && ${FIND} * ! -type d | ${SORT} >> ${PLIST}; \
    ${ECHO} .freeswitch-sounds >> ${PLIST}; \
    ${SED} -i "" -e "s:^:share/${BASE_PORTNAME}/sounds/:" ${PLIST}; \
    ${FIND} * -type d ! -empty | ${SORT} -r | ${SED} -e "s:^:@dirrm share/${BASE_PORTNAME}/sounds/:" | ${GREP} / >> ${PLIST}; \
    ${ECHO} "@dirrmtry share/${BASE_PORTNAME}/sounds" >> ${PLIST}; \
    ${ECHO} "@dirrmtry share/${BASE_PORTNAME}" >> ${PLIST};
    ${CHMOD} -R 0755 ${WRKDIR}/tmp/

do-install:
    @${ECHO_MSG} "Installing files..."
    ${MKDIR} ${PREFIX}/share/${BASE_PORTNAME}/sounds
    ${TOUCH} ${PREFIX}/share/${BASE_PORTNAME}/sounds/.freeswitch-sounds
    (cd ${WRKDIR}/tmp/ &&${COPYTREE_SHARE} \* ${PREFIX}/share/${BASE_PORTNAME}/sounds/)

.include <bsd.port.mk>