source: trunk/dports/textproc/chasen/Portfile @ 22311

Last change on this file since 22311 was 22311, checked in by takanori@…, 13 years ago

Add dictionaries for UTF-8 and Shift_JIS support.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1# $Id: Portfile 22311 2007-02-26 03:11:44Z takanori@macports.org $
2
3PortSystem        1.0
4name              chasen
5version           2.3.3
6revision          3
7set ipa           ipadic-2.7.0
8categories        textproc japanese
9maintainers       takanori@macports.org
10description       Japanese morphological analysis system
11long_description  ChaSen is a tool to analyze a text according to a set of dictionaries that \
12                  specifies grammer, part of speech of words, and so on. Because ChaSen itself \
13                  has no dictionaries, we need explicit dictionaries to use. IPADIC is such a \
14                  set of dictionaries that specifies Japanese language. \
15                  \
16                  This version of chasen treats encoding of input as EUC-JP, and its output is \
17                  encoded as EUC-JP by default.
18platforms         darwin
19homepage          http://chasen.naist.jp/hiki/ChaSen/
20master_sites      http://chasen.naist.jp/stable/chasen/:chasen \
21                  http://chasen.naist.jp/stable/ipadic/:ipadic
22distfiles         ${name}-${version}.tar.gz:chasen \
23                  chasen-2.3.3.20030821.patch:chasen \
24                  chasen-2.3.3.20030822.patch:chasen
25extract.only      ${name}-${version}.tar.gz
26patchfiles        configure.diff dartsdic.cpp.patch
27
28checksums         ${name}-${version}.tar.gz md5 629e90d9490bac95606c38c2d344cc5f \
29                                            sha1 711f5717ee284d26aa5616292f7aaffaef11d03a \
30                                            rmd160 2f2416f82fb0341023314a4672e442fed86207a9 \
31                  chasen-2.3.3.20030821.patch md5 44b14a50c8269f982fc0d59cb580ecc5 \
32                                              sha1 c608e5e613bc8a9758436681846047099610bf4a \
33                                              rmd160 a7e581132abc3ae89eb109b25b917d704ca006bf \
34                  chasen-2.3.3.20030822.patch md5 22466f08c3916b415d222508fdcc9bbe \
35                                              sha1 0728884dcdf6983a3e32774111e7996a43008722 \
36                                              rmd160 30c2ff84ad8b68271fcd7656d9972e7392a806f5 \
37                  ${ipa}.tar.gz md5 f36d315cae25b086a889b7090c674977 \
38                                sha1 52784d8abb3361eafec83ab543be63cf087f9eb2 \
39                                rmd160 5e37c750801df63439032be4954c4b63a44012cb
40
41default_variants  +ipadic
42
43depends_lib     port:darts port:libiconv
44depends_build   port:nkf
45
46post-extract    {
47                system "cd ${worksrcpath} && patch -p0 < ${distpath}/chasen-2.3.3.20030821.patch"
48                system "cd ${worksrcpath} && patch -p0 < ${distpath}/chasen-2.3.3.20030822.patch"
49}
50
51configure.args  --libexecdir=${prefix}/lib --with-darts=${prefix}/include --with-libiconv=${prefix}
52
53test.run        yes
54test.target     check
55
56post-destroot   {
57                xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}/doc
58
59                xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING ChangeLog INSTALL NEWS README ${destroot}${prefix}/share/doc/${name}
60                xinstall -m 644 ${worksrcpath}/doc/manual-j.pdf ${destroot}${prefix}/share/doc/${name}/doc
61}
62
63variant ipadic  {
64        # Japanese dictionaries for ChaSen
65        distfiles-append ${ipa}.tar.gz:ipadic
66        extract.only-append ${ipa}.tar.gz
67        post-destroot {
68                foreach {enc c} {UTF-8 w EUC-JP e Shift_JIS s} {
69                        file mkdir ${workpath}/${ipa}-${enc}
70                        system "(cd ${workpath}/${ipa}; tar cf - .) | (cd ${workpath}/${ipa}-${enc}; tar xf -)"
71                        reinplace "s|PACKAGE=ipadic|PACKAGE=ipadic-${enc}|" ${workpath}/${ipa}-${enc}/configure
72                        reinplace "s|/makemat|/makemat -i ${c}|" ${workpath}/${ipa}-${enc}/Makefile.in
73                        reinplace "s|/makeda|/makeda -i ${c}|" ${workpath}/${ipa}-${enc}/Makefile.in
74                        foreach f [glob ${workpath}/${ipa}-${enc}/*.cha ${workpath}/${ipa}-${enc}/*.dic ${workpath}/${ipa}-${enc}/chasenrc.in] {
75                                system "mv ${f} ${f}_ && ${prefix}/bin/nkf --ic=EUC-JP --oc=${enc} ${f}_ > ${f}"
76                        }
77                        system "cd ${workpath}/${ipa}-${enc} && ./configure --with-dicdir=${prefix}/lib/chasen/dic --with-mkchadic=${destroot}${prefix}/lib/chasen --with-chasenrc-path=${destroot}${prefix}/etc/chasenrc-${enc} && DYLD_LIBRARY_PATH=${destroot}${prefix}/lib make && make install DESTDIR=${destroot}"
78                }
79                system "ln -sf chasenrc-EUC-JP ${destroot}${prefix}/etc/chasenrc"
80
81                xinstall -m 755 -d ${destroot}${prefix}/share/doc/ipadic/doc
82
83                xinstall -m 644 -W ${workpath}/${ipa} AUTHORS COPYING ChangeLog INSTALL INSTALL-ja NEWS README ${destroot}${prefix}/share/doc/ipadic
84                xinstall -m 644 ${workpath}/${ipa}/doc/ipadic-ja.pdf ${destroot}${prefix}/share/doc/ipadic/doc
85        }
86
87        post-activate   {
88                ui_msg "\nDue to historical reasons, the default encoding of ChaSen is set to EUC-JP."
89                ui_msg "If you'd like to handle text files written in UTF-8 or Shift_JIS, you may use -r and -i options.\n"
90                ui_msg "  UTF-8)     chasen -r ${prefix}/etc/chasenrc-UTF-8 -i w <input>"
91                ui_msg "  Shift_JIS) chasen -r ${prefix}/etc/chasenrc-Shift_JIS -i s <input>\n"
92        }
93}
94
95livecheck.check regex
96livecheck.url   http://chasen.naist.jp/hiki/ChaSen/?%C3%E3%E4%A5%A4%CE%C7%DB%C9%DB
97livecheck.regex ${name}-(\[0-9.a-z\]+)\\.tar
Note: See TracBrowser for help on using the repository browser.