Ticket #49276: Portfile

File Portfile, 5.3 KB (added by hayder.net@…, 9 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 139752 2015-08-26 10:14:27Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                rabbitmq-server
7version             3.5.6
8categories          net
9platforms           darwin
10maintainers         gmail.com:hayder.net
11license             MPL-1.1 MIT Apache-2
12supported_archs     noarch
13
14description         The RabbitMQ AMQP Server
15long_description    \
16    RabbitMQ is an implementation of AMQP, the emerging standard for \
17    high performance enterprise messaging. The RabbitMQ server is a \
18    robust and scalable implementation of an AMQP broker.
19
20homepage            http://www.rabbitmq.com/
21master_sites        http://www.rabbitmq.com/releases/rabbitmq-server/v${version}/
22
23distfiles           ${name}-${version}${extract.suffix} \
24                    ${name}-generic-unix-${version}${extract.suffix}
25
26checksums \
27        ${name}-${version}${extract.suffix} \
28                    rmd160  2fb2531f1c5aeb04f760d1e79394aa7eee9beae9 \
29                    sha256  24be1433234112db391e0c5ef32bfb2ca111e51b2e57998cc0f3d97ba361671f \
30        ${name}-generic-unix-${version}${extract.suffix} \
31                    rmd160  4e8dad6a6bbec0b8da547cbd952e9d06ccaf782f \
32                    sha256  19d69c72bbb8c963ad3a0b8a12ed9c60bacbddb0038dde61e4cf04ad0c429039
33
34
35depends_lib         port:erlang
36depends_build       port:libxslt \
37                    port:git
38
39platform darwin 8 {
40    depends_build-append port:py26-simplejson
41    build.args      PYTHON=${prefix}/bin/python2.6
42}
43
44platform darwin 9 {
45    depends_build-append port:py26-simplejson
46    build.args      PYTHON=${prefix}/bin/python2.6
47}
48# no need for simplejson on Snow Leopard or higher
49
50if {${os.major} > 9 && ${os.platform} eq "darwin"} {
51    # python3.X doesn't work
52    build.args      PYTHON=python2.7
53}
54
55set serveruser      rabbitmq
56set servergroup     rabbitmq
57set serverhome      ${prefix}/var/lib/rabbitmq
58set logdir          ${prefix}/var/log/rabbitmq
59set confdir         ${prefix}/etc/rabbitmq
60set mnesiadbdir     ${prefix}/var/lib/rabbitmq/mnesia
61set plistloc        ${prefix}/etc/LaunchDaemons/org.macports.rabbitmq-server
62set sbindir         ${destroot}${prefix}/lib/rabbitmq/bin
63set wrappersbin     ${destroot}${prefix}/sbin
64set realsbin        ${destroot}${prefix}/lib/rabbitmq/lib/rabbitmq_server-${version}/sbin
65set mansrc          ${workpath}/rabbitmq_server-${version}/share/man
66set mandest         ${destroot}${prefix}/share/man
67
68use_configure       no
69
70use_parallel_build  no
71
72build.env-append    HOME=${workpath}
73
74build.env-append    VERSION=${version}
75
76destroot.env-append VERSION=${version}
77
78destroot.target     install_bin
79
80destroot.destdir \
81    TARGET_DIR=${destroot}${prefix}/lib/rabbitmq/lib/rabbitmq_server-${version} \
82    SBIN_DIR=${sbindir} \
83    MAN_DIR=${destroot}${prefix}/share/man
84
85destroot.keepdirs \
86    ${destroot}${confdir} \
87    ${destroot}${logdir} \
88    ${destroot}${mnesiadbdir}
89
90add_users ${serveruser} group=${servergroup} realname=RabbitMQ\ Server home=${serverhome}
91
92post-destroot { 
93    # This is a hack: We need to patch the startupitem, so generate it manually
94    # here, then define the function to empty to avoid overwriting it later
95    package require portstartupitem 1.0
96    portstartupitem::startupitem_create
97    proc portstartupitem::startupitem_create {args} {}
98    system -W "${destroot}${plistloc}" "patch <${filespath}/patch-org.macports.rabbitmq-server.plist.diff"
99
100
101    xinstall -d -m 775 ${destroot}${confdir}
102    xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${logdir}
103    xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${serverhome}
104    xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${mnesiadbdir}
105
106    reinplace -E "s:^SYS_PREFIX=\${RABBITMQ_HOME}$:SYS_PREFIX=${prefix}:" \
107        ${realsbin}/rabbitmq-defaults
108    reinplace -E "s:^SYS_PREFIX=$:SYS_PREFIX=${prefix}:" \
109        ${realsbin}/rabbitmq-defaults
110
111    xinstall -m 755 ${filespath}/rabbitmq-script-wrapper \
112                ${wrappersbin}/rabbitmq-server
113    reinplace -E "s:@MACPORTS_PREFIX@:${prefix}:g" \
114                ${wrappersbin}/rabbitmq-server
115    reinplace -E "s:/usr/lib/rabbitmq/bin/:${prefix}/lib/rabbitmq/bin/:g" \
116                ${wrappersbin}/rabbitmq-server
117    reinplace -E "s:/var/lib/rabbitmq:${prefix}/var/lib/rabbitmq:g" \
118                ${wrappersbin}/rabbitmq-server
119
120    file copy ${wrappersbin}/rabbitmq-server ${wrappersbin}/rabbitmqctl
121    file copy ${wrappersbin}/rabbitmq-server ${wrappersbin}/rabbitmq-plugins
122    file attributes ${destroot}${serverhome} -owner ${serveruser} -group ${servergroup}
123    file attributes ${destroot}${logdir} -owner ${serveruser} -group ${servergroup}
124
125    xinstall -m 644 -W ${mansrc}/man1 rabbitmq-server.1.gz rabbitmqctl.1.gz rabbitmq-plugins.1.gz \
126        ${mandest}/man1/
127    xinstall -m 644 -W ${mansrc}/man5 rabbitmq-env.conf.5.gz ${mandest}/man5/   
128}
129
130startupitem.create  yes
131startupitem.init    "PATH=${prefix}/bin:${prefix}/sbin:\$PATH; export PATH"
132startupitem.start   "rabbitmq-server 2>&1"
133startupitem.stop    "rabbitmqctl stop 2>&1"
134startupitem.logfile ${prefix}/var/log/rabbitmq/startupitem.log
135
136livecheck.type      regex
137livecheck.url       http://www.rabbitmq.com/releases/rabbitmq-server/current/
138livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"