Ticket #18289: Portfile.2

File Portfile.2, 3.5 KB (added by mikkel@…, 16 years ago)

net/murmur Portfile

Line 
1# $Id: $
2
3PortSystem 1.0
4name                 murmur
5version              1.1.7
6categories           net audio
7maintainers          nomaintainer
8description          server for mumble - low latency voice chat for gaming
9long_description \
10    Server component of Mumble - an open source, low-latency, high quality \
11    voice chat software primarily intended for use while gaming.
12
13homepage             http://mumble.sourceforge.net/
14platforms            macosx
15
16master_sites         sourceforge:mumble
17checksums            md5 5a382d5c065bb264abfe240ca6f03ddc
18distname             mumble-${version}
19
20livecheck.check     regex
21livecheck.url       ${homepage}
22livecheck.regex     ">Latest version: (.*?)<"
23
24depends_lib \
25        port:qt4-mac \
26        port:openssl
27
28depends_build \
29        port:boost
30
31configure.cmd        qmake-mac
32configure.pre_args   CONFIG-=app_bundle CONFIG+=\"
33configure.post_args  \"
34configure.args       release no-universal no-client no-ice
35
36variant universal {
37        configure.args-delete no-universal
38}
39
40variant ice {
41        configure.args-delete no-ice
42        depends_lib-append port:ice-cpp
43}
44
45startupitem.create      yes
46startupitem.type        launchd
47startupitem.name        Murmur
48startupitem.start       "${prefix}/sbin/murmurd -ini ${prefix}/etc/murmur/murmur.ini"
49startupitem.stop        "kill -TERM `cat ${prefix}/var/run/murmur/murmur.pid`"
50startupitem.pidfile     auto "${prefix}/var/run/murmur/murmur.pid"
51
52build {
53        system "cd ${worksrcpath} && make"
54}
55
56destroot {
57        addgroup murmur
58        adduser murmur gid=[existsgroup murmur] realname=Murmur\ -\ Mumble\ Voice\ Chat
59
60        set dp      ${destroot}/${prefix}
61        set w       ${worksrcpath}
62
63        set logdir  ${dp}/var/log/murmur/
64        set dbdir   ${dp}/var/lib/murmur/
65        set piddir  ${dp}/var/run/murmur/
66
67        xinstall -m 740 -o murmur -g murmur -d \
68                ${logdir} \
69                ${dbdir} \
70                ${piddir}
71
72        destroot.keepdirs-append \
73                ${logdir} \
74                ${dbdir} \
75                ${piddir}
76
77        file mkdir ${dp}/etc/murmur/
78        file mkdir ${dp}/sbin/
79        file mkdir ${dp}/etc/dbus-1/system.d/
80
81        file copy ${w}/release/murmurd ${dp}/sbin/murmurd
82
83        set conf ${dp}/etc/murmur/murmur.ini
84        file copy ${w}/scripts/murmur.ini.system ${conf}
85        system "sed -i '' -e 's,database=.*,database=${prefix}/var/lib/murmur/murmur.sqlite,' ${conf}"
86        system "sed -i '' -e 's,pidfile=.*,pidfile=${prefix}/var/run/murmur/murmur.pid,' ${conf}"
87        system "sed -i '' -e 's,logfile=.*','logfile=${prefix}/var/log/murmur/murmur.log,' ${conf}"
88
89        if {![variant_isset ice]} {
90                # This change is made only to avoid confusion. Murmur ignores
91                # the ice= config option when built without Ice support.
92                system "sed -i -e 's,ice=,\#ice=,' ${destroot}/${prefix}/etc/murmur/murmur.ini"
93        }
94
95        set dbusservice ${dp}/etc/dbus-1/system.d/murmur.conf
96        file copy ${w}/scripts/murmur.conf ${dbusservice}
97        system "sed -i '' -e 's,user=.*\",user=\"murmur\",' ${dbusservice}"
98}
99
100pre-install {
101        set plist ${destroot}/${prefix}/etc/LaunchDaemons/org.macports.Murmur/org.macports.Murmur.plist
102        system "sed -i '' -e 's,</dict>,<key>UserName</key><string>murmur</string></dict>,' ${plist}"
103}
104
105post-install {
106        ui_msg ""
107        ui_msg "***************************************************************"
108        ui_msg "* To set up a password for the SuperUser user on your Murmur"
109        ui_msg "* server, execute:"
110        ui_msg "*"
111        ui_msg "*   ${prefix}/sbin/murmurd -ini ${prefix}/etc/murmur/murmur.ini -supw \[password\]"
112        ui_msg "*"
113        ui_msg "* In case you want to interface with a different database than"
114        ui_msg "* sqlite, then take a look at the +psql and +mysql5 variants of"
115        ui_msg "* qt4-mac."
116        ui_msg "*"
117        ui_msg "***************************************************************"
118        ui_msg ""
119}