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 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | name rabbitmq-server |
---|
7 | version 3.5.4 |
---|
8 | categories net |
---|
9 | platforms darwin |
---|
10 | maintainers gmail.com:hayder.net |
---|
11 | license MPL-1.1 MIT Apache-2 |
---|
12 | supported_archs noarch |
---|
13 | |
---|
14 | description The RabbitMQ AMQP Server |
---|
15 | long_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 | |
---|
20 | homepage http://www.rabbitmq.com/ |
---|
21 | master_sites http://www.rabbitmq.com/releases/rabbitmq-server/v${version}/ |
---|
22 | |
---|
23 | distfiles ${name}-${version}${extract.suffix} \ |
---|
24 | ${name}-generic-unix-${version}${extract.suffix} |
---|
25 | |
---|
26 | checksums \ |
---|
27 | ${name}-${version}${extract.suffix} \ |
---|
28 | rmd160 4e1cf0ca1889673c56872a6dfaf9e688899d1eda \ |
---|
29 | sha256 f79814d5fd5574734f599ef570ddace02ce4e47a1441cd052c568cde4d6ca3a4 \ |
---|
30 | ${name}-generic-unix-${version}${extract.suffix} \ |
---|
31 | rmd160 f178b3cb8d4ab9299f8ecabe338d2d2f79e82fb3 \ |
---|
32 | sha256 24b6a4c0d5fec0ed63b756cdf96964d1729be88d5ec7934d4b4723ecdf9d3e2b |
---|
33 | |
---|
34 | |
---|
35 | depends_lib port:erlang |
---|
36 | depends_build port:libxslt \ |
---|
37 | port:git |
---|
38 | |
---|
39 | platform darwin 8 { |
---|
40 | depends_build-append port:py26-simplejson |
---|
41 | build.args PYTHON=${prefix}/bin/python2.6 |
---|
42 | } |
---|
43 | |
---|
44 | platform 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 | |
---|
50 | if {${os.major} > 9 && ${os.platform} eq "darwin"} { |
---|
51 | # python3.X doesn't work |
---|
52 | build.args PYTHON=python2.7 |
---|
53 | } |
---|
54 | |
---|
55 | set serveruser rabbitmq |
---|
56 | set servergroup rabbitmq |
---|
57 | set serverhome ${prefix}/var/lib/rabbitmq |
---|
58 | set logdir ${prefix}/var/log/rabbitmq |
---|
59 | set confdir ${prefix}/etc/rabbitmq |
---|
60 | set mnesiadbdir ${prefix}/var/lib/rabbitmq/mnesia |
---|
61 | set plistloc ${prefix}/etc/LaunchDaemons/org.macports.rabbitmq-server |
---|
62 | set sbindir ${destroot}${prefix}/lib/rabbitmq/bin |
---|
63 | set wrappersbin ${destroot}${prefix}/sbin |
---|
64 | set realsbin ${destroot}${prefix}/lib/rabbitmq/lib/rabbitmq_server-${version}/sbin |
---|
65 | set mansrc ${workpath}/rabbitmq_server-${version}/share/man |
---|
66 | set mandest ${destroot}${prefix}/share/man |
---|
67 | |
---|
68 | use_configure no |
---|
69 | |
---|
70 | use_parallel_build no |
---|
71 | |
---|
72 | build.env-append HOME=${workpath} |
---|
73 | |
---|
74 | build.env-append VERSION=${version} |
---|
75 | |
---|
76 | destroot.env-append VERSION=${version} |
---|
77 | |
---|
78 | destroot.target install_bin |
---|
79 | |
---|
80 | destroot.destdir \ |
---|
81 | TARGET_DIR=${destroot}${prefix}/lib/rabbitmq/lib/rabbitmq_server-${version} \ |
---|
82 | SBIN_DIR=${sbindir} \ |
---|
83 | MAN_DIR=${destroot}${prefix}/share/man |
---|
84 | |
---|
85 | destroot.keepdirs \ |
---|
86 | ${destroot}${confdir} \ |
---|
87 | ${destroot}${logdir} \ |
---|
88 | ${destroot}${mnesiadbdir} |
---|
89 | |
---|
90 | add_users ${serveruser} group=${servergroup} realname=RabbitMQ\ Server home=${serverhome} |
---|
91 | |
---|
92 | post-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 | |
---|
130 | startupitem.create yes |
---|
131 | startupitem.init "PATH=${prefix}/bin:${prefix}/sbin:\$PATH; export PATH" |
---|
132 | startupitem.start "rabbitmq-server 2>&1" |
---|
133 | startupitem.stop "rabbitmqctl stop 2>&1" |
---|
134 | startupitem.logfile ${prefix}/var/log/rabbitmq/startupitem.log |
---|
135 | |
---|
136 | livecheck.type regex |
---|
137 | livecheck.url http://www.rabbitmq.com/releases/rabbitmq-server/current/ |
---|
138 | livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}" |
---|