Ticket #45004: Portfile

File Portfile, 4.5 KB (added by coditect (Nicholas Rawlings), 10 years ago)
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 114325 2013-12-05 09:20:31Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    cassandra
7version                 2.1.0
8categories              databases
9maintainers             nomaintainer
10homepage                http://cassandra.apache.org/
11platforms               darwin
12license                 Apache-2
13master_sites            apache
14master_sites.mirror_subdir  ${name}/${version}
15distname                apache-${name}-${version}-src
16
17description             A highly scalable, eventually consistent, \
18                        distributed, structured key-value store.
19
20long_description        \
21    The Apache Cassandra Project develops a highly scalable second-generation \
22    distributed database, bringing together Dynamo's fully distributed design \
23    and Bigtable's ColumnFamily-based data model. Cassandra was open sourced \
24    by Facebook in 2008, and is now developed by Apache committers and \
25    contributors from many companies.
26
27checksums               rmd160  12bdf5953e3c41a72be31f8db1bf67ccd19fdfc4 \
28                        sha256  f400f8087e12a23b401e42301251033c9c8146bbb682545eb9af7d920ec91716
29
30depends_build           bin:ant:apache-ant \
31                        port:apache-ivy
32
33depends_run             port:antlr3 \
34                        port:junit \
35                        port:jline \
36                        port:slf4j \
37                        port:commons-cli \
38                        port:commons-lang \
39                        port:commons-codec \
40                        port:jakarta-log4j \
41                        port:google-guava
42
43set java_basepath       ${prefix}/share/java
44set cassandra_destpath  ${java_basepath}/${name}-${version}
45
46set mp_libs {antlr junit jline slf4j-api slf4j-log4j12 commons-cli \
47    commons-lang commons-codec jakarta-log4j \
48    google-guava }
49
50set dbdir           ${prefix}/var/db/cassandra
51set logdir          ${prefix}/var/log/cassandra
52if {${os.platform} eq "darwin" && ${os.major} > 8} {
53    set cassandrauser       _cassandra
54} else {
55    set cassandrauser       cassandra
56}
57add_users ${cassandrauser} group=${cassandrauser} realname=Cassandra\ Server
58
59use_configure           no
60
61build.cmd               ant
62build.target            jar
63
64destroot {
65    # create directories
66    set cas_home ${destroot}${cassandra_destpath}
67    set doc_dir ${destroot}${prefix}/share/doc/${name}-${version}
68    xinstall -m 755 -d ${cas_home}/lib ${doc_dir}
69   
70    # move in docs
71    eval move [glob ${worksrcpath}/*.txt] ${doc_dir}/
72   
73    # fix cassandra include file
74    move ${worksrcpath}/bin/cassandra.in.sh ${cas_home}/
75    reinplace "s|CASSANDRA_HOME=.*|CASSANDRA_HOME=${cassandra_destpath}|" ${cas_home}/cassandra.in.sh
76   
77    # install bin scripts
78    eval delete [glob ${worksrcpath}/bin/*.bat]
79    eval reinplace "s|/opt/cassandra/cassandra.in.sh|${cassandra_destpath}/cassandra.in.sh|" [glob ${worksrcpath}/bin/*]
80    eval xinstall -m 755 [glob ${worksrcpath}/bin/*] ${destroot}${prefix}/bin
81
82    # install jars
83    xinstall -m 644 ${worksrcpath}/build/apache-${name}-${version}-SNAPSHOT.jar \
84        ${cas_home}/lib/${name}.jar
85    xinstall -m 644 ${worksrcpath}/build/apache-${name}-thrift-${version}-SNAPSHOT.jar \
86        ${cas_home}/lib/${name}-thrift.jar
87    eval xinstall -m 644 [glob ${worksrcpath}/lib/*.jar] ${cas_home}/lib/
88   
89    # install conf, interface
90    move ${worksrcpath}/conf ${worksrcpath}/interface ${cas_home}
91   
92    # update file storage location to be within Macports hierarchy
93    eval reinplace "s|/var|${prefix}/var|g" [glob ${cas_home}/conf/*]
94
95    reinplace "s|/var/lib/cassandra|/var/db/cassandra|g" ${cas_home}/conf/cassandra.yaml
96}
97
98post-destroot {
99    xinstall -m 755 -o ${cassandrauser} -g ${cassandrauser} -d \
100        ${destroot}${logdir} \
101        ${destroot}${dbdir}
102    destroot.keepdirs-append \
103        ${destroot}${dbdir} \
104        ${destroot}${logdir}
105}
106
107startupitem.create      yes
108# memo: delete env setup when release merges in r104118
109startupitem.executable  sudo -u ${cassandrauser} env \
110                            PATH=${prefix}/bin:${prefix}/sbin:/usr/bin:/bin:/usr/sbin:/sbin \
111                            __CFPREFERENCES_AVOID_DAEMON=1 \
112                            ${prefix}/bin/cassandra
113
114livecheck.type          regex
115livecheck.url           ${homepage}download/
116livecheck.regex         /apache-${name}-(\[0-9.\]+)-src${extract.suffix}