[81543] trunk/dports/java

Ryan Schmidt ryandesign at macports.org
Mon Aug 1 20:01:25 PDT 2011


On Aug 1, 2011, at 08:55, hum at macports.org wrote:

> Revision: 81543
>          http://trac.macports.org/changeset/81543
> Author:   hum at macports.org
> Date:     2011-08-01 06:55:15 -0700 (Mon, 01 Aug 2011)
> Log Message:
> -----------
> added a new port for dualist version 0.1; #29984


> Added: trunk/dports/java/dualist/Portfile
> ===================================================================
> --- trunk/dports/java/dualist/Portfile	                        (rev 0)
> +++ trunk/dports/java/dualist/Portfile	2011-08-01 13:55:15 UTC (rev 81543)
> 

> +use_configure       no
> +universal_variant   no
> +
> +build.cmd           true

Based on these three lines, I assume this port should have "supported_archs noarch".


> +set share_java_dir  ${prefix}/share/java
> +set dualist_dir     ${share_java_dir}/${worksrcdir}
> +
> +destroot {
> +    # Copy the distribution.
> +    xinstall -m 755 -d  ${destroot}${share_java_dir}
> +    copy ${worksrcpath} ${destroot}${share_java_dir}
> +
> +    # Configure working directories.
> +    xinstall -m 1777 -d ${destroot}${dualist_dir}/tmp
> +    system "chmod 1777  ${destroot}${dualist_dir}/public/results"

The tcl command for chmod is "file attributes -permissions"


> +    destroot.keepdirs   ${destroot}${dualist_dir}/tmp \
> +                        ${destroot}${dualist_dir}/public/results
> +
> +    # Install an extra script for this port.
> +    xinstall -m 755 ${filespath}/dualist     ${destroot}${prefix}/bin
> +    reinplace "s|@prefix@|${prefix}|g"       ${destroot}${prefix}/bin/dualist
> +    reinplace "s|@java_home@|${java_home}|g" ${destroot}${prefix}/bin/dualist
> +
> +    notes "To try DUALIST, run 'dualist' and open http://localhost:9000/."

The notes need to be declared outside of any phase, so that users can run "port notes" to see them.


> +}
> +
> +post-deactivate {
> +    ui_msg "To revert the system after uninstalling the port,"
> +    ui_msg "delete the dualist directory:"
> +    ui_msg "  $ sudo rm -rf ${dualist_dir}"
> +}
> +
> +variant mecab description {Use MeCab to analyze Japanese texts} {
> +    depends_lib-append port:mecab-java
> +    patchfiles-append  patch-mecab.diff
> +
> +    post-extract {
> +        xinstall -m 644 -W ${filespath} \
> +            Makefile \
> +            SimpleMecabPipe.java \
> +            ${worksrcpath}
> +        system "ln -s ${prefix}/share/java/mecab.jar ${worksrcpath}/lib/"

Use the tcl ln command, not system.


> +    }
> +
> +    post-patch {
> +        reinplace "s|@java_home@|${java_home}|g" ${worksrcpath}/Makefile
> +    }
> +        
> +    build.cmd  make
> +
> +    post-destroot {
> +        # Install an extra script for this variant.
> +        xinstall -m 755 ${filespath}/dualist-mecab ${destroot}${prefix}/bin
> +        reinplace "s|@prefix@|${prefix}|g"         ${destroot}${prefix}/bin/dualist-mecab
> +        reinplace "s|@java_home@|${java_home}|g"   ${destroot}${prefix}/bin/dualist-mecab
> +
> +        notes-append "For Japanese texts, run 'dualist-mecab' instead of 'dualist'."

Same here: notes needs to be outside the post-destroot phase.


> Added: trunk/dports/java/dualist/files/dualist
> ===================================================================
> --- trunk/dports/java/dualist/files/dualist	                        (rev 0)
> +++ trunk/dports/java/dualist/files/dualist	2011-08-01 13:55:15 UTC (rev 81543)
> @@ -0,0 +1,9 @@
> +#!/bin/sh
> +cmd="$1"
> +if [ -z $cmd ]; then
> +    cmd=run
> +fi
> +shift
> +JAVA_HOME=@java_home@
> +cd @prefix@/share/java/dualist
> + at prefix@/bin/play $cmd $@
> 
> Added: trunk/dports/java/dualist/files/dualist-mecab
> ===================================================================
> --- trunk/dports/java/dualist/files/dualist-mecab	                        (rev 0)
> +++ trunk/dports/java/dualist/files/dualist-mecab	2011-08-01 13:55:15 UTC (rev 81543)
> @@ -0,0 +1,9 @@
> +#!/bin/sh
> +cmd="$1"
> +if [ -z $cmd ]; then
> +    cmd=run
> +fi
> +shift
> +JAVA_HOME=@java_home@
> +cd @prefix@/share/java/dualist
> + at prefix@/bin/play $cmd -Ddualist.lang=ja -Djava.library.path=@prefix@/lib -Dfile.encoding=UTF-8 $@

In both of these scripts, "$@" should be in quotes so that arguments containing spaces will work correctly.




More information about the macports-dev mailing list