Ticket #30506: Portfile

File Portfile, 7.4 KB (added by jonathan+macports@…, 13 years ago)

Modify cassandra.in.sh correctly and copy apache-cassandra-thrift jar

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 79697 2011-06-23 19:53:19Z singingwolfboy@macports.org $
3
4PortSystem              1.0
5
6name                    cassandra
7version                 0.8.0
8categories              databases
9maintainers             singingwolfboy openmaintainer
10homepage                http://cassandra.apache.org/
11platforms               darwin
12license                 Apache-2.0
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.
19long_description        \
20    The Apache Cassandra Project develops a highly scalable second-generation \
21    distributed database, bringing together Dynamo's fully distributed design \
22    and Bigtable's ColumnFamily-based data model. Cassandra was open sourced \
23    by Facebook in 2008, and is now developed by Apache committers and \
24    contributors from many companies.
25
26checksums               md5     e1235e4e830282953a7636cf3e7702dc \
27                        sha1    7b925610ba141921e68b473106dc60c6b630ce4d \
28                        rmd160  8eef5ee36a149edeff7aa5b1b9a5303c2c68e6cb
29
30depends_build           bin:ant:apache-ant port:apache-ivy
31depends_run             port:antlr3 port:junit port:jline port:slf4j \
32                        port:commons-cli port:commons-lang port:commons-collections \
33                        port:commons-codec port:jakarta-log4j \
34                        port:google-collections  port:google-guava \
35                        port:servlet25-api
36set mp_libs {antlr junit jline slf4j-api slf4j-log4j12 commons-cli \
37    commons-lang commons-collections commons-codec jakarta-log4j \
38    google-collect google-guava servlet25-api }
39
40use_configure           no
41
42build.cmd               ${prefix}/bin/ant
43build.target            jar
44
45destroot {
46    # create directories
47    set cas_home ${destroot}${prefix}/share/java/${name}
48    set doc_dir ${destroot}${prefix}/share/doc/${name}
49    xinstall -m 755 -d ${cas_home}/lib ${doc_dir}
50   
51    # move in docs
52    eval move [glob ${worksrcpath}/*.txt] ${doc_dir}/
53   
54    # fix cassandra include file
55    move ${worksrcpath}/bin/cassandra.in.sh ${cas_home}/
56    reinplace "s|CASSANDRA_HOME=.*|CASSANDRA_HOME=${prefix}/share/java/${name}|" ${cas_home}/cassandra.in.sh
57   
58    # install bin scripts
59    eval delete [glob ${worksrcpath}/bin/*.bat]
60    eval reinplace "s|/opt/cassandra/cassandra.in.sh|${prefix}/share/java/${name}/cassandra.in.sh|" [glob ${worksrcpath}/bin/*]
61    eval xinstall -m 755 [glob ${worksrcpath}/bin/*] ${destroot}${prefix}/bin
62
63    # install jars
64    xinstall -m 644 ${worksrcpath}/build/apache-${name}-${version}-SNAPSHOT.jar \
65        ${cas_home}/lib/${name}.jar
66    xinstall -m 644 ${worksrcpath}/build/apache-${name}-thrift-${version}-SNAPSHOT.jar \
67        ${cas_home}/lib/${name}-thrift.jar
68    if {[variant_isset no_deps]} {
69        eval xinstall -m 644 [glob ${worksrcpath}/lib/*.jar] ${cas_home}/lib/
70    } else {
71        foreach lib $mp_libs {
72            ln -s ${prefix}/share/java/$lib.jar ${cas_home}/lib/$lib.jar
73            file delete ${worksrcpath}/lib/$lib.jar
74        }
75        eval xinstall -m 644 [glob ${worksrcpath}/lib/*.jar] ${cas_home}/lib/
76    }
77   
78    # install conf, contrib, interface
79    move ${worksrcpath}/conf ${worksrcpath}/contrib ${worksrcpath}/interface ${cas_home}
80   
81    # update file storage location to be within Macports hierarchy
82    eval reinplace "s|/var|${prefix}/var|" [glob ${cas_home}/conf/*]
83   
84    # create these files
85    xinstall -m 755 -d ${destroot}${prefix}/var/log/cassandra/ ${destroot}${prefix}/var/lib/cassandra/data/
86    touch ${destroot}${prefix}/var/log/cassandra/system.log
87}
88destroot.keepdirs   ${destroot}${prefix}/var/log/cassandra/ \
89                    ${destroot}${prefix}/var/lib/cassandra/
90
91
92pre-build {
93    # help Ant find Ivy
94    xinstall -d ${worksrcpath}/build
95    ln -s ${prefix}/share/java/ivy.jar ${worksrcpath}/build/ivy.jar
96    reinplace "s|ivy-\${ivy\.version}\.jar|ivy.jar|" ${worksrcpath}/build.xml
97   
98    if {[variant_isset no_deps]} {} else {
99        file delete ${worksrcpath}/lib/antlr-3.2.jar
100        ln -s ${prefix}/share/java/antlr.jar ${worksrcpath}/lib/antlr.jar
101        reinplace "s|antlr-3.2.jar|antlr.jar|" ${worksrcpath}/build.xml
102       
103        file delete ${worksrcpath}/lib/junit-4.6.jar
104        ln -s ${prefix}/share/java/junit.jar ${worksrcpath}/lib/junit.jar
105        reinplace "s|junit-4.6.jar|junit.jar|" ${worksrcpath}/build.xml
106       
107        file delete ${worksrcpath}/lib/commons-cli-1.1.jar
108        ln -s ${prefix}/share/java/commons-cli.jar ${worksrcpath}/lib/commons-cli.jar
109        reinplace "s|commons-cli-1.1.jar|commons-cli.jar|" ${worksrcpath}/build.xml
110       
111        file delete ${worksrcpath}/lib/commons-lang-2.4.jar
112        ln -s ${prefix}/share/java/commons-lang.jar ${worksrcpath}/lib/commons-lang.jar
113        reinplace "s|commons-lang-2.4.jar|commons-lang.jar|" ${worksrcpath}/build.xml
114       
115        file delete ${worksrcpath}/lib/commons-collections-3.2.1.jar
116        ln -s ${prefix}/share/java/commons-collections.jar ${worksrcpath}/lib/commons-collections.jar
117        reinplace "s|commons-collections-3.2.1.jar|commons-collections.jar|" ${worksrcpath}/build.xml
118
119        file delete ${worksrcpath}/lib/commons-codec-1.2.jar
120        ln -s ${prefix}/share/java/commons-codec.jar ${worksrcpath}/lib/commons-codec.jar
121        reinplace "s|commons-codec-1.2.jar|commons-codec.jar|" ${worksrcpath}/build.xml
122       
123        file delete ${worksrcpath}/lib/log4j-1.2.16.jar
124        ln -s ${prefix}/share/java/jakarta-log4j.jar ${worksrcpath}/lib/jakarta-log4j.jar
125        reinplace "s|log4j-1.2.16.jar|jakarta-log4j.jar|" ${worksrcpath}/build.xml
126       
127        file delete ${worksrcpath}/lib/google-collect-1.0-rc1.jar
128        ln -s ${prefix}/share/java/google-collect.jar ${worksrcpath}/lib/google-collect.jar
129        reinplace "s|google-collect-1.0-rc1.jar|google-collect.jar|" ${worksrcpath}/build.xml
130
131        file delete ${worksrcpath}/lib/guava-r08.jar
132        ln -s ${prefix}/share/java/google-guava.jar ${worksrcpath}/lib/google-guava.jar
133        reinplace "s|guava-r08.jar|google-guava.jar|" ${worksrcpath}/build.xml
134       
135        file delete ${worksrcpath}/lib/jline-0.9.94.jar
136        ln -s ${prefix}/share/java/jline.jar ${worksrcpath}/lib/jline.jar
137        reinplace "s|jline-0.9.94.jar|jline.jar|" ${worksrcpath}/build.xml
138       
139        file delete ${worksrcpath}/lib/slf4j-api-1.6.1.jar
140        ln -s ${prefix}/share/java/slf4j-api.jar ${worksrcpath}/lib/slf4j-api.jar
141        reinplace "s|slf4j-api-1.6.1.jar|slf4j-api.jar|" ${worksrcpath}/build.xml
142       
143        file delete ${worksrcpath}/lib/slf4j-log4j12-1.6.1.jar
144        ln -s ${prefix}/share/java/slf4j-log4j12.jar ${worksrcpath}/lib/slf4j-log4j12.jar
145        reinplace "s|slf4j-log4j12-1.6.1.jar|slf4j-log4j12.jar|" ${worksrcpath}/build.xml
146
147        file delete ${worksrcpath}/lib/servlet-api-2.5-20081211.jar
148        ln -s ${prefix}/share/java/servlet25-api.jar ${worksrcpath}/lib/servlet25-api.jar
149        reinplace "s|servlet-api-2.5-20081211.jar|servlet25-api.jar|" ${worksrcpath}/build.xml
150    }
151}
152
153variant no_deps description {Use jar files that came with Cassandra distribution for dependencies, instead of using Macports to install dependencies} {
154    # clear all runtime deps
155    depends_run
156}