Ticket #45004: Portfile.2

File Portfile.2, 4.6 KB (added by neverline@…, 10 years ago)

cassandra2 (2.1.3) 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 114325 2013-12-05 09:20:31Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    cassandra2
7version                 2.1.3
8categories              databases
9maintainers             nomaintainer
10homepage                http://cassandra.apache.org/
11platforms               darwin
12license                 Apache-2
13master_sites            apache
14master_sites.mirror_subdir  cassandra/${version}
15distname                apache-cassandra-${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  19c560bedaa32a39666244fa798c4f9a327d33d0 \
28                        sha256  f999d303464f0f33faafbe9005536e7e69a486353fb44c954f5bb04d6b1fbd2e
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/${name}
51set logdir          ${prefix}/var/log/${name}
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
61
62#build.env-append        HOME=${workpath}/home
63build.env-append        _JAVA_OPTIONS=-Duser.home=${workpath}/home
64build.cmd               ant
65build.target            jar
66#build.pre_args          -Dmaven-ant-tasks.local=${worksrcpath}/../.home ${build.target}
67
68destroot {
69    # create directories
70    set cas_home ${destroot}${cassandra_destpath}
71    set doc_dir ${destroot}${prefix}/share/doc/${name}-${version}
72    xinstall -m 755 -d ${cas_home}/lib ${doc_dir}
73
74    # move in docs
75    eval move [glob ${worksrcpath}/*.txt] ${doc_dir}/
76
77    # fix cassandra include file
78    move ${worksrcpath}/bin/cassandra.in.sh ${cas_home}/
79    reinplace "s|CASSANDRA_HOME=.*|CASSANDRA_HOME=${cassandra_destpath}|" ${cas_home}/cassandra.in.sh
80
81    # install bin scripts
82    eval delete [glob ${worksrcpath}/bin/*.bat]
83    eval reinplace "s|/opt/cassandra/cassandra.in.sh|${cassandra_destpath}/cassandra.in.sh|" [glob ${worksrcpath}/bin/*]
84    eval xinstall -m 755 [glob ${worksrcpath}/bin/*] ${destroot}${prefix}/bin
85
86    # install jars
87    xinstall -m 644 ${worksrcpath}/build/apache-cassandra-${version}-SNAPSHOT.jar \
88        ${cas_home}/lib/cassandra.jar
89    xinstall -m 644 ${worksrcpath}/build/apache-cassandra-thrift-${version}-SNAPSHOT.jar \
90        ${cas_home}/lib/cassandra-thrift.jar
91    eval xinstall -m 644 [glob ${worksrcpath}/lib/*.jar] ${cas_home}/lib/
92
93    # install conf, interface
94    move ${worksrcpath}/conf ${worksrcpath}/interface ${cas_home}
95
96    # update file storage location to be within Macports hierarchy
97    eval reinplace "s|/var|${prefix}/var|g" [glob ${cas_home}/conf/*]
98
99    reinplace "s|/var/lib/cassandra|/var/db/${name}|g" ${cas_home}/conf/cassandra.yaml
100}
101
102post-destroot {
103    xinstall -m 755 -o ${cassandrauser} -g ${cassandrauser} -d \
104        ${destroot}${logdir} \
105        ${destroot}${dbdir}
106    destroot.keepdirs-append \
107        ${destroot}${dbdir} \
108        ${destroot}${logdir}
109}
110
111startupitem.create      yes
112# memo: delete env setup when release merges in r104118
113startupitem.executable  sudo -u ${cassandrauser} env \
114                            PATH=${prefix}/bin:${prefix}/sbin:/usr/bin:/bin:/usr/sbin:/sbin \
115                            __CFPREFERENCES_AVOID_DAEMON=1 \
116                            ${prefix}/bin/cassandra
117
118livecheck.type          regex
119livecheck.url           ${homepage}download/
120livecheck.regex         /apache-cassandra-(\[0-9.\]+)-src${extract.suffix}