Ticket #30834: Portfile.3

File Portfile.3, 4.6 KB (added by jul_bsd@…, 10 years ago)

1.3.2

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$
3
4PortSystem 1.0
5
6PortGroup           github 1.0
7
8github.setup      elasticsearch elasticsearch 1.4.4 v
9categories        java databases
10maintainers       semenov.co:ilya openmaintainer
11platforms         darwin
12
13description       ElasticSearch is a flexible and powerful open source, distributed real-time \
14        search and analytics engine for the cloud
15long_description  ${description}
16license           APL-2
17
18homepage          http://elasticsearch.org
19
20## Don't think it's a good idea to depend on this old port and no openjdk for now
21#depends_lib       bin:java:kaffe
22conflicts         ${name}
23use_configure     no
24
25set dbuser        elasticsearch
26set dbgrp         elasticsearch
27set es_parent     ${prefix}/share/java
28set es_home       ${es_parent}/${name}
29set pidfile       ${prefix}/var/run/${name}/pid
30
31add_users ${dbuser} shell=/bin/sh group=${dbgrp} \
32    home=${es_home} \
33    realname=Elasticsearch Server
34
35build {}
36
37destroot {
38  xinstall -m 755 -d ${destroot}${es_parent}
39  file copy ${worksrcpath} ${destroot}${es_home}
40  xinstall -m 700 -o ${dbuser} -g ${dbgrp} -d ${destroot}${es_home}/data
41  xinstall -m 755 -o ${dbuser} -g ${dbgrp} -d ${destroot}${es_home}/logs
42  xinstall -m 755 -o ${dbuser} -g ${dbgrp} -d ${destroot}${prefix}/var/run/${name}
43}
44
45post-destroot {
46    foreach arch {amd64-freebsd-6 amd64-linux amd64-solaris ia64-linux sparc-solaris sparc64-solaris x86-freebsd-5 x86-freebsd-6 x86-linux x86-solaris } {
47        delete ${destroot}${es_home}/lib/sigar/libsigar-${arch}.so
48    }
49
50    reinplace "s|#path.data: /path/to.+$|path.data: ${es_home}/|" ${destroot}${es_home}/config/elasticsearch.yml
51    reinplace "s|#path.logs: /path/to.+$|path.logs: ${prefix}/var/log/elasticsearch/|" ${destroot}${es_home}/config/elasticsearch.yml
52    reinplace "s|#path.plugins: /path/to.+$|path.logs: ${es_home}/plugins|" ${destroot}${es_home}/config/elasticsearch.yml
53    reinplace "s|#network\.host: .+$|network.host: 127.0.0.1|" ${destroot}${es_home}/config/elasticsearch.yml
54    #reinplace "s|#\!\/bin\/sh\n|#!/bin/sh\n\nES_HOME=${es_home}|" ${destroot}${es_home}/bin/elasticsearch.in.sh
55    #reinplace "s|ES_HOME/lib/|ES_HOME/libexec/|" ${destroot}${es_home}/bin/elasticsearch.in.sh
56    #reinplace "s|SCRIPT="\$0"|SCRIPT="\$0"\nES_CLASSPATH=${es_home}/libexec|" ${destroot}${es_home}/bin/plugin
57    #reinplace "s|\$ES_HOME\/lib\/|\$ES_CLASSPATH/|" ${destroot}${es_home}/bin/plugin
58
59    #reinplace "s|%%ES_HOME%%|${es_home}|"
60    #reinplace "s|%%VAR%%|${prefix}/var/elasticsearch|"
61}
62
63destroot.keepdirs ${destroot}${es_home}/data \
64                  ${destroot}${prefix}/var/run/${name} \
65                  ${destroot}${prefix}/var/log/${name}
66
67startupitem.create yes
68startupitem.logfile ${prefix}/var/log/elasticsearch.log
69startupitem.logevents yes
70startupitem.pidfile auto ${pidfile}
71startupitem.start "su ${dbuser} -c \"${es_home}/bin/elasticsearch -p ${pidfile}\""
72startupitem.stop "su ${dbuser} -c \"kill `cat ${pidfile}`\""
73
74if {${subport} eq ${name}} {
75    checksums           rmd160  5028c788343c467bb5905f484be62e3f82491e1d \
76                        sha256  fe1d47bb93e98ddda284f8d0109fe9addf2b77793529768fbcf3a764ae09f9d7
77
78    conflicts  ${name}-devel
79
80    livecheck.type      regex
81    livecheck.url       https://github.com/elasticsearch/elasticsearch/releases
82    livecheck.regex     "<a href=\"/elasticsearch/elasticsearch/releases/tag/v(.*)\">"
83}
84
85#subport ${name}-devel {
86#    version             20150220
87#    distname            3e2f4b86e428723d6fa17ad039904f6ab8e0ee23
88#    checksums           rmd160  5028c788343c467bb5905f484be62e3f82491e1d \
89#                        sha256  fe1d47bb93e98ddda284f8d0109fe9addf2b77793529768fbcf3a764ae09f9d7
90#    #worksrcdir          ${distname}
91#
92#    ## FIXME! fails as dom4j port broken
93#    depends_lib-append port:maven1 port:dom4j
94#
95#    pre-configure {
96#        # Build the package from source
97#        system -W ${worksrcpath} "${prefix}/share/java/maven1/bin/mvn clean package -DskipTests"
98#        # Extract the package to the current directory
99#        system -W ${worksrcpath} "tar --strip 1 -xzf target/releases/elasticsearch-*.tar.gz"
100#    }
101#
102### FIXME! build failed "org.dom4j.dom.DOMDocumentFactory is not abstract and does not override abstract method getFeature(java.lang.String,java.lang.String) in org.w3c.dom.DOMImplementation"
103#
104#    conflicts  ${name}
105#    livecheck.type      none
106#}
107
108notes "
109   To enable ${name} as background daemon:
110       $ sudo ln -s ${prefix}/Library/LaunchDaemons/org.macports.${name}.plist /Library/LaunchDaemons/
111       $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.${name}.plist
112"