[98598] trunk/dports/textproc/irstlm

hum at macports.org hum at macports.org
Tue Oct 9 08:40:47 PDT 2012


Revision: 98598
          http://trac.macports.org//changeset/98598
Author:   hum at macports.org
Date:     2012-10-09 08:40:47 -0700 (Tue, 09 Oct 2012)
Log Message:
-----------
irstlm: install executables at /opt/libexec/irstlm; replace IRSTLM with the installed directory; enable caching; install additional documents.

Modified Paths:
--------------
    trunk/dports/textproc/irstlm/Portfile

Added Paths:
-----------
    trunk/dports/textproc/irstlm/files/
    trunk/dports/textproc/irstlm/files/patch-scripts.diff

Modified: trunk/dports/textproc/irstlm/Portfile
===================================================================
--- trunk/dports/textproc/irstlm/Portfile	2012-10-09 15:27:54 UTC (rev 98597)
+++ trunk/dports/textproc/irstlm/Portfile	2012-10-09 15:40:47 UTC (rev 98598)
@@ -5,7 +5,7 @@
 
 name                irstlm
 version             5.80.01
-revision            1
+revision            2
 categories          textproc math
 maintainers         hum openmaintainer
 
@@ -30,6 +30,18 @@
 
 depends_build       port:autoconf port:automake port:libtool
 
+# binaries and scripts are installed at ${libexec_dir}.
+set libexec_dir     ${prefix}/libexec/${name}
+
+# replace the value of the IRSTLM environmental variable with ${libexec_dir}.
+patchfiles          patch-scripts.diff
+
+post-patch {
+    foreach f {build-lm-qsub.sh build-lm.sh lm-stat.pl split-ngt.sh} {
+        reinplace "s|@libexec_dir@|${libexec_dir}|g" ${worksrcpath}/scripts/${f}
+    }
+}
+
 universal_variant   no
 
 pre-configure {
@@ -38,14 +50,23 @@
 
 # install include files at ${prefix}/include/${name} to avoid conflicts with other builds.
 # e.g. mosesdecoder
-configure.args      --includedir=${prefix}/include/${name}
+configure.args      --includedir=${prefix}/include/${name} \
+                    --bindir=${libexec_dir} \
+                    --enable-caching
 
 compiler.blacklist  clang
 
 post-destroot {
-    foreach f [glob -directory ${destroot}${prefix}/bin -type f *] {
+    # fix permissions of the binaries and scripts.
+    foreach f [glob -directory ${destroot}${libexec_dir} -type f *] {
         file attributes ${f} -permissions 0755
     }
+    # install additional documents.
+    set doc_dir ${prefix}/share/doc/${name}
+    xinstall -d ${destroot}${doc_dir}
+    xinstall -m 644 -W ${worksrcpath} \
+        Copyright README RELEASE \
+        ${destroot}${doc_dir}
 }
 
 livecheck.type      regex

Added: trunk/dports/textproc/irstlm/files/patch-scripts.diff
===================================================================
--- trunk/dports/textproc/irstlm/files/patch-scripts.diff	                        (rev 0)
+++ trunk/dports/textproc/irstlm/files/patch-scripts.diff	2012-10-09 15:40:47 UTC (rev 98598)
@@ -0,0 +1,82 @@
+--- scripts/build-lm-qsub.sh.orig	2012-04-11 18:54:15.000000000 +0900
++++ scripts/build-lm-qsub.sh	2012-10-07 00:40:14.000000000 +0900
+@@ -33,13 +33,12 @@
+ fi
+ 
+ if [ ! $IRSTLM ]; then
+-   echo "Set IRSTLM environment variable with path to irstlm"
+-   exit 2;
++   IRSTLM=@libexec_dir@
+ fi
+ 
+ #paths to scripts and commands in irstlm
+-scr=$IRSTLM/bin
+-bin=$IRSTLM/bin
++scr=$IRSTLM
++bin=$IRSTLM
+ gzip=`which gzip 2> /dev/null`;
+ gunzip=`which gunzip 2> /dev/null`;
+ 
+--- scripts/build-lm.sh.orig	2012-08-02 21:53:02.000000000 +0900
++++ scripts/build-lm.sh	2012-10-07 00:40:30.000000000 +0900
+@@ -27,13 +27,12 @@
+ }
+ 
+ if [ ! $IRSTLM ]; then
+-   echo "Set IRSTLM environment variable with path to irstlm"
+-   exit 2
++   IRSTLM=@libexec_dir@
+ fi
+ 
+ #paths to scripts and commands in irstlm
+-scr=$IRSTLM/bin
+-bin=$IRSTLM/bin
++scr=$IRSTLM
++bin=$IRSTLM
+ gzip=`which gzip 2> /dev/null`;
+ gunzip=`which gunzip 2> /dev/null`;
+ 
+--- scripts/lm-stat.pl.orig	2011-04-15 21:54:01.000000000 +0900
++++ scripts/lm-stat.pl	2012-10-07 00:40:48.000000000 +0900
+@@ -39,14 +39,7 @@
+   exit(1);
+ }
+ 
+-if (!$ENV{IRSTLM}){
+-  print "Set environment variable IRSTLM with path to the irstlm directory\n";
+-  exit(1);
+-}
+-
+-
+-
+-my $clm="$ENV{IRSTLM}/bin/compile-lm";
++my $clm="@libexec_dir@/compile-lm";
+ 
+ open (OUT,"$clm $lm --eval $txt --debug 1|");
+ while (<OUT>){
+--- scripts/split-ngt.sh.orig	2012-04-11 18:54:15.000000000 +0900
++++ scripts/split-ngt.sh	2012-10-07 00:41:22.000000000 +0900
+@@ -6,9 +6,9 @@
+ #containing ngram statistics (of <order> length) in Google format
+ #These files are a partition of the whole set of ngrams
+ 
+-basedir=$IRSTLM
+-bindir=$basedir/bin
+-scriptdir=$basedir/scripts
++basedir=@libexec_dir@
++bindir=$basedir
++scriptdir=$basedir
+ 
+ unset par
+ while [ $# -gt 0 ]
+--- scripts/Makefile.am.orig	2012-08-02 21:53:02.000000000 +0900
++++ scripts/Makefile.am	2012-10-07 00:52:13.000000000 +0900
+@@ -3,7 +3,7 @@
+ perl_programs = build-sublm.pl goograms2ngrams.pl lm-stat.pl merge-sublm.pl ngram-split.pl sort-lm.pl split-dict.pl
+ dist_programs = wrapper $(sh_programs) $(perl_programs) 
+ 
+-wrapperbindir = @prefix@/bin
++wrapperbindir = @libexecdir@/irstlm
+ 
+ install:
+ 	for p in $(sh_programs) $(perl_programs) ; do \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121009/e2478505/attachment-0001.html>


More information about the macports-changes mailing list