| 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 | |
|---|
| 4 | PortSystem 1.0 |
|---|
| 5 | |
|---|
| 6 | name cassandra2 |
|---|
| 7 | version 2.1.3 |
|---|
| 8 | categories databases |
|---|
| 9 | maintainers nomaintainer |
|---|
| 10 | homepage http://cassandra.apache.org/ |
|---|
| 11 | platforms darwin |
|---|
| 12 | license Apache-2 |
|---|
| 13 | master_sites apache |
|---|
| 14 | master_sites.mirror_subdir cassandra/${version} |
|---|
| 15 | distname apache-cassandra-${version}-src |
|---|
| 16 | |
|---|
| 17 | description A highly scalable, eventually consistent, \ |
|---|
| 18 | distributed, structured key-value store. |
|---|
| 19 | |
|---|
| 20 | long_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 | |
|---|
| 27 | checksums rmd160 19c560bedaa32a39666244fa798c4f9a327d33d0 \ |
|---|
| 28 | sha256 f999d303464f0f33faafbe9005536e7e69a486353fb44c954f5bb04d6b1fbd2e |
|---|
| 29 | |
|---|
| 30 | depends_build bin:ant:apache-ant \ |
|---|
| 31 | port:apache-ivy |
|---|
| 32 | |
|---|
| 33 | depends_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 | |
|---|
| 43 | set java_basepath ${prefix}/share/java |
|---|
| 44 | set cassandra_destpath ${java_basepath}/${name}-${version} |
|---|
| 45 | |
|---|
| 46 | set mp_libs {antlr junit jline slf4j-api slf4j-log4j12 commons-cli \ |
|---|
| 47 | commons-lang commons-codec jakarta-log4j \ |
|---|
| 48 | google-guava } |
|---|
| 49 | |
|---|
| 50 | set dbdir ${prefix}/var/db/${name} |
|---|
| 51 | set logdir ${prefix}/var/log/${name} |
|---|
| 52 | if {${os.platform} eq "darwin" && ${os.major} > 8} { |
|---|
| 53 | set cassandrauser _cassandra |
|---|
| 54 | } else { |
|---|
| 55 | set cassandrauser cassandra |
|---|
| 56 | } |
|---|
| 57 | add_users ${cassandrauser} group=${cassandrauser} realname=Cassandra\ Server |
|---|
| 58 | |
|---|
| 59 | use_configure no |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | #build.env-append HOME=${workpath}/home |
|---|
| 63 | build.env-append _JAVA_OPTIONS=-Duser.home=${workpath}/home |
|---|
| 64 | build.cmd ant |
|---|
| 65 | build.target jar |
|---|
| 66 | #build.pre_args -Dmaven-ant-tasks.local=${worksrcpath}/../.home ${build.target} |
|---|
| 67 | |
|---|
| 68 | destroot { |
|---|
| 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 | |
|---|
| 102 | post-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 | |
|---|
| 111 | startupitem.create yes |
|---|
| 112 | # memo: delete env setup when release merges in r104118 |
|---|
| 113 | startupitem.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 | |
|---|
| 118 | livecheck.type regex |
|---|
| 119 | livecheck.url ${homepage}download/ |
|---|
| 120 | livecheck.regex /apache-cassandra-(\[0-9.\]+)-src${extract.suffix} |
|---|