source: trunk/dports/net/asterisk/Portfile @ 137441

Last change on this file since 137441 was 137441, checked in by jmr@…, 4 years ago

asterisk: create and run as an asterisk user instead of running as root (#27492)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 137441 2015-06-11 18:44:41Z jmr@macports.org $
3
4PortSystem          1.0
5
6name                asterisk
7version             1.6.2.20
8revision            1
9categories          net
10platforms           darwin
11universal_variant   no
12license             GPL-2
13maintainers         nomaintainer
14
15description         An Open Source PBX and telephony toolkit
16long_description    Asterisk is an open source PBX and telephony \
17                    toolkit. It provides the ability to develop \
18                    telephony applications on top of Internet \
19                    telephony (Voice over IP) as well as traditional \
20                    telephony connectivity (PSTN).
21homepage            http://www.asterisk.org
22
23depends_lib         port:bison \
24                    port:curl \
25                    port:iksemel \
26                    port:libogg \
27                    port:libvorbis \
28                    port:lua \
29                    port:ncurses \
30                    port:openldap \
31                    port:openssl \
32                    port:popt \
33                    port:portaudio \
34                    port:spandsp-devel \
35                    port:speex \
36                    port:sqlite3 \
37                    port:wget \
38                    port:zlib
39
40master_sites        http://downloads.digium.com/pub/asterisk/releases/
41checksums           rmd160  8584d0f2e274517ce84576dfa7e936b9befb9fe2 \
42                    sha256  4f3ef1de4644195e0d91816d6741c46ddb5d9ad28b07e631f594674ac9006a27
43
44add_users           asterisk group=asterisk realname=Asterisk\ PBX
45
46startupitem.create      yes
47startupitem.netchange   yes
48if {[getuid] == 0} {
49    startupitem.executable  ${prefix}/sbin/asterisk -d -U asterisk -G asterisk
50} else {
51    startupitem.executable  ${prefix}/sbin/asterisk -d
52}
53
54patchfiles          makeopts.in.diff \
55                    menuselect_Makefile.diff
56
57configure.optflags  -O3
58configure.args      --without-h323 \
59                    --without-netsnmp
60
61variant home_sound_cache description {Use/Build sound file cache from .asterisk_sounds_cache in your home directory} {
62    configure.args-append --with-sounds-cache=~/.asterisk_sounds_cache
63}
64
65build.env           ASTCFLAGS=-I${prefix}/include \
66                    ASTLDFLAGS=-L${prefix}/lib \
67                    NOISY_BUILD=1 \
68                    OPTIMIZE=${configure.optflags}
69
70destroot.keepdirs   ${destroot}${prefix}/var/log/asterisk \
71                    ${destroot}${prefix}/var/run/asterisk \
72                    ${destroot}${prefix}/var/spool/asterisk \
73                    ${destroot}${prefix}/var/spool/asterisk/dictate \
74                    ${destroot}${prefix}/var/spool/asterisk/meetme \
75                    ${destroot}${prefix}/var/spool/asterisk/monitor \
76                    ${destroot}${prefix}/var/spool/asterisk/outgoing \
77                    ${destroot}${prefix}/var/spool/asterisk/system \
78                    ${destroot}${prefix}/var/spool/asterisk/tmp \
79                    ${destroot}${prefix}/var/spool/asterisk/voicemail
80post-destroot {
81    system "rsync -a ${worksrcpath}/configs/*.sample ${destroot}${prefix}/etc/asterisk"
82    xinstall -m 644 ${filespath}/asterisk.conf.sample.in ${destroot}${prefix}/etc/asterisk/asterisk.conf.sample
83    reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${prefix}/etc/asterisk/asterisk.conf.sample
84    xinstall -d ${destroot}${prefix}/var/log/asterisk \
85                ${destroot}${prefix}/var/run/asterisk \
86                ${destroot}${prefix}/var/spool/asterisk/outgoing
87    if {[getuid] == 0} {
88        system "chown -R asterisk:asterisk ${destroot}${prefix}/var/log/asterisk ${destroot}${prefix}/var/run/asterisk ${destroot}${prefix}/var/spool/asterisk"
89    }
90}
Note: See TracBrowser for help on using the repository browser.