Ticket #38314: Portfile

File Portfile, 4.1 KB (added by brian+macports@…, 12 years ago)

Portfile

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 99643 2012-11-13 04:26:02Z singingwolfboy@macports.org $
3
4PortSystem              1.0
5
6name                    cassandra
7version                 1.2.2
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               md5     df9b5a88f33d3961ee33f24ee9bd52ff \
28                        sha1    dae64c407d9040688614234b8469e4eba982bc37 \
29                        rmd160  832630aa3841694bffa0d35e141834f931da3178
30
31depends_build           bin:ant:apache-ant \
32                        port:apache-ivy
33
34depends_run             port:antlr3 \
35                        port:junit \
36                        port:jline \
37                        port:slf4j \
38                        port:commons-cli \
39                        port:commons-lang \
40                        port:commons-codec \
41                        port:jakarta-log4j \
42                        port:google-guava
43
44set java_basepath       ${prefix}/share/java
45set cassandra_destpath  ${java_basepath}/${name}-${version}
46
47set mp_libs {antlr junit jline slf4j-api slf4j-log4j12 commons-cli \
48    commons-lang commons-codec jakarta-log4j \
49    google-guava }
50
51set dbdir           ${prefix}/var/db/cassandra
52set logdir          ${prefix}/var/log/cassandra
53if {"darwin" == ${os.platform} && ${os.major} > 8} {
54    set cassandrauser       _cassandra
55} else {
56    set cassandrauser       cassandra
57}
58add_users ${cassandrauser} group=${cassandrauser} realname=Cassandra\ Server
59
60use_configure           no
61
62build.cmd               ant
63build.target            jar
64
65destroot {
66    # create directories
67    set cas_home ${destroot}${cassandra_destpath}
68    set doc_dir ${destroot}${prefix}/share/doc/${name}-${version}
69    xinstall -m 755 -d ${cas_home}/lib ${doc_dir}
70   
71    # move in docs
72    eval move [glob ${worksrcpath}/*.txt] ${doc_dir}/
73   
74    # fix cassandra include file
75    move ${worksrcpath}/bin/cassandra.in.sh ${cas_home}/
76    reinplace "s|CASSANDRA_HOME=.*|CASSANDRA_HOME=${cassandra_destpath}|" ${cas_home}/cassandra.in.sh
77   
78    # install bin scripts
79    eval delete [glob ${worksrcpath}/bin/*.bat]
80    eval reinplace "s|/opt/cassandra/cassandra.in.sh|${cassandra_destpath}/cassandra.in.sh|" [glob ${worksrcpath}/bin/*]
81    eval xinstall -m 755 [glob ${worksrcpath}/bin/*] ${destroot}${prefix}/bin
82
83    # install jars
84    xinstall -m 644 ${worksrcpath}/build/apache-${name}-${version}-SNAPSHOT.jar \
85        ${cas_home}/lib/${name}.jar
86    xinstall -m 644 ${worksrcpath}/build/apache-${name}-thrift-${version}-SNAPSHOT.jar \
87        ${cas_home}/lib/${name}-thrift.jar
88    eval xinstall -m 644 [glob ${worksrcpath}/lib/*.jar] ${cas_home}/lib/
89   
90    # install conf, interface
91    move ${worksrcpath}/conf ${worksrcpath}/interface ${cas_home}
92   
93    # update file storage location to be within Macports hierarchy
94    eval reinplace "s|/var|${prefix}/var|g" [glob ${cas_home}/conf/*]
95
96    reinplace "s|/var/lib/cassandra|/var/db/cassandra|g" ${cas_home}/conf/cassandra.yaml
97}
98
99post-destroot {
100    xinstall -m 755 -o ${cassandrauser} -g ${cassandrauser} -d \
101        ${destroot}${logdir} \
102        ${destroot}${dbdir}
103    destroot.keepdirs-append \
104        ${destroot}${dbdir} \
105        ${destroot}${logdir}
106}
107
108startupitem.create      yes
109startupitem.executable  sudo -u ${cassandrauser} ${prefix}/bin/cassandra