Changeset 83880 for trunk/dports/java


Ignore:
Timestamp:
Sep 12, 2011, 2:50:27 PM (8 years ago)
Author:
hum@…
Message:

apache-solr: enhance the Portfile; add ja variant for Japanese texts; see #31155.

Location:
trunk/dports/java/apache-solr
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/java/apache-solr/Portfile

    r80207 r83880  
    66name                apache-solr
    77version             3.3.0
    8 categories          java search
     8revision            1
     9categories          java textproc
    910platforms           darwin
    10 maintainers         gmail.com:haya10.ito openmaintainer
     11maintainers         gmail.com:haya10.ito hum openmaintainer
    1112license             Apache-2.0
    1213
    13 description         The open source enterprise search platform
    14 
     14homepage            http://lucene.apache.org/solr/
     15description         An open source enterprise search platform.
    1516long_description    Solr is the popular, blazing fast open source enterprise \
    1617                    search platform from the Apache Lucene project.
    1718
    18 homepage            http://lucene.apache.org/solr/
    1919master_sites        apache:lucene/solr/${version}/
    20 
     20extract.suffix      .tgz
    2121checksums           sha1    e6017419051e5eda9cb222e3b17006eeed682db9 \
    2222                    rmd160  ef2c2e58d44a9d8786c2fc5b2f19f59bf9e1f70c
    2323
    24 extract.suffix      .tgz
     24# set the destination paths.
     25set java_basepath   ${prefix}/share/java
     26set solr_destpath   ${java_basepath}/${distname}
     27set solr_path       ${solr_destpath}/example
     28set solr_home       ${solr_path}/solr
     29
     30post-patch {
     31    # expand relative pathes into abusolute ones.
     32    reinplace "s|\"\.\./\.\./|\"${solr_destpath}/|g" \
     33        ${worksrcpath}/example/solr/conf/solrconfig.xml
     34}
    2535
    2636use_configure       no
     
    2939build {}
    3040
    31 set java_home       /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
    32 
    33 pre-configure {
    34     if {![file exists ${java_home}]} {
    35         ui_error "Java 1.6 is required, but not located at ${java_home}"
    36         return -code error "Java 1.6 missing"
    37     }
     41destroot {
     42    # copy the distribution.
     43    xinstall -d         ${destroot}${java_basepath}
     44    copy ${worksrcpath} ${destroot}${java_basepath}
     45    # install the solr script.
     46    xinstall -m 755 ${filespath}/solr.in     ${destroot}${prefix}/bin/solr
     47    reinplace "s|@solr_path@|${solr_path}|g" ${destroot}${prefix}/bin/solr
     48    reinplace "s|@solr_home@|${solr_home}|g" ${destroot}${prefix}/bin/solr
    3849}
    3950
    40 set target          ${prefix}/share/java/${name}-${version}
     51notes "
     52To try apache-solr, run 'sudo solr' and open http://localhost:8983/solr/browse.
     53To store sample documents, run 'cd ${solr_path}/exampledocs && ./post.sh *.xml'."
    4154
    42 destroot {
    43     xinstall -d ${destroot}[file dirname ${target}]
    44     copy ${worksrcpath}/example ${destroot}${target}
    45     xinstall -m 755 ${filespath}/solr.in ${destroot}${prefix}/bin/solr
    46     reinplace "s|@TARGET@|${target}|g" ${destroot}${prefix}/bin/solr
    47     reinplace "s|@JAVA_HOME@|${java_home}|g" ${destroot}${prefix}/bin/solr
     55# solr home for Japanese configurations.
     56set solr_home_ja    ${solr_home}-ja
     57
     58variant ja description {Add Japanese settings with lucene-gosen} {
     59    depends_run-append  port:lucene-gosen
     60    # create Japanese solr home 'solr-ja'.
     61    post-extract {
     62        copy ${worksrcpath}/example/solr ${worksrcpath}/example/solr-ja
     63    }
     64    patchfiles-append   patch-solr-ja.diff
     65    post-patch {
     66        # expand relative pathes into abusolute ones.
     67        reinplace "s|\"\.\./\.\./|\"${solr_destpath}/|g" \
     68            ${worksrcpath}/example/solr-ja/conf/solrconfig.xml
     69    }
     70    post-destroot {
     71        # set the lucene-gosen configuration path to config files.
     72        foreach config {schema.xml solrconfig.xml} {
     73            reinplace "s|@gosen_path@|${java_basepath}/lucene-gosen|g" \
     74                ${destroot}${solr_home_ja}/conf/${config}
     75        }
     76        # install a property file for UTF-8 encoding.
     77        copy ${filespath}/velocity.properties ${destroot}${solr_home_ja}/conf
     78        # copy a sample Japanese doc for testing.
     79        copy ${filespath}/solr-ja.xml ${destroot}${solr_path}/exampledocs
     80        # install the solr-ja script.
     81        xinstall -m 755 ${filespath}/solr.in        ${destroot}${prefix}/bin/solr-ja
     82        reinplace "s|@solr_path@|${solr_path}|g"    ${destroot}${prefix}/bin/solr-ja
     83        reinplace "s|@solr_home@|${solr_home_ja}|g" ${destroot}${prefix}/bin/solr-ja
     84    }
     85    notes-append "
     86
     87For Japanese texts, please run 'sudo solr-ja' instead of 'sudo solr'.
     88See ${solr_home_ja}."
    4889}
    4990
    5091livecheck.type      regex
    51 livecheck.url       http://mirrors.ibiblio.org/pub/mirrors/apache/lucene/solr/
    52 livecheck.regex     {href="([0-9.]+)"}
     92livecheck.url       http://www.apache.org/dist/lucene/solr/
     93livecheck.regex     (\[0-9.\]+)\/
  • trunk/dports/java/apache-solr/files/solr.in

    r79407 r83880  
    33CMDNAME=`basename "$0"`
    44
    5 export JAVA_HOME=@JAVA_HOME@
    6 SOLR=@TARGET@
    7 
    85usage() {
    9     echo "Usage: ${CMDNAME} path/to/config/dir" 1>&2
     6    echo "Usage: ${CMDNAME} [-h|--help] [solr_home]" 1>&2
    107    exit 1
    118}
    129
    13 if [ -z "$1" ]; then
    14     usage
    15 else
    16     cd ${SOLR} && exec ${JAVA_HOME}/bin/java -Dsolr.solr.home="$1" -jar ${SOLR}/start.jar
    17 fi
     10SOLR_PATH=@solr_path@
     11SOLR_HOME=@solr_home@
     12
     13while test -n "$1"; do
     14    case "$1" in
     15        -h|--help) usage ;;
     16        *)         SOLR_HOME="$1";    shift ;;
     17    esac
     18done
     19
     20java -Dsolr.clustering.enabled=true \
     21     -Dsolr.solr.home="${SOLR_HOME}" \
     22     -Djetty.home="${SOLR_PATH}" \
     23     -jar ${SOLR_PATH}/start.jar
Note: See TracChangeset for help on using the changeset viewer.