# $Id: Portfile,v 1.4 2006/03/21 13:50:07 takanori Exp $

PortSystem        1.0
name              kinput2-macim
version           3.1.20050629
revision	  2
categories        x11
maintainers       takanori@opendarwin.org
description       Input server for easy input of Japanese text, using Kotoeri
long_description  Kinput2 is an input server for X11 applications that want Japanese \
		  text input. \
		  \
		  A client that wants kana-kanji conversion service for Japanese text \
		  sends a request to kinput2.  Kinput2 receives the request, does \
		  kana-kanji conversion, and sends the converted text back to the \
		  client.
homepage          http://www.sol.dti.ne.jp/~kikuyan/macosx/x11kotoeri.html
master_sites      ftp://ftp.sra.co.jp/pub/x11/kinput2/:kinput2 \
		  http://homepage1.nifty.com/daemon/MachTen/sonoda/:MachTen \
		  http://www.sol.dti.ne.jp/~kikuyan/macosx/patches/:macosx
distfiles         kinput2-v3.1.tar.gz:kinput2 \
		  kinput2.fix4.macim.0.2.patch.gz:MachTen \
		  Kinput2-MacIM.README.gz:MachTen \
		  kinput2-v3.1-macim-20050629.patch.gz:macosx
checksums	  kinput2-v3.1.tar.gz \
		  md5 2de20576f150248d1fdfe66d7cc4e510 \
		  sha1 48050f70e7c0cc67193ea260f8d7f6e822a02ca3 \
		  rmd160 c56684769859bbee5f8238cd1af061796ff931e8 \
		  kinput2.fix4.macim.0.2.patch.gz \
		  md5 8533185fe2957f7106d02803f28bc31b \
		  sha1 40d4b7aac9e72f2e29020941716a43eab56f2afb \
		  rmd160 e0a1b877ed94fe5346cd5f401bf1871413f55410 \
		  Kinput2-MacIM.README.gz \
		  md5 f99be328fc4b5145fb48bfe53cf25c4d \
		  sha1 bb7b64a45ca98eb0b841691ea675da0d32308bd6 \
		  rmd160 7888caf3b34436ed90176391b384236e6ee114ac \
		  kinput2-v3.1-macim-20050629.patch.gz \
		  md5 701dc2f61e3b89444611e9dabef561ac \
		  sha1 d015835436a29807d8d72bca5e50a84bd0eb9395 \
		  rmd160 20a1788f2464dffaa74fc075d8f54ddbd9358e53
platforms	  macosx

depends_lib       lib:libX11.6:XFree86
extract.only	  kinput2-v3.1.tar.gz
worksrcdir        kinput2-v3.1
post-extract	  {
		  system "cd ${worksrcpath} && gzip -cd ${distpath}/kinput2.fix4.macim.0.2.patch.gz | sed -n -e '143,549p' -e '581,\$p' | patch -p1"
		  system "cd ${worksrcpath} && gzip -cd ${distpath}/kinput2-v3.1-macim-20050629.patch.gz | patch -p0"
		  system "gzip -cd ${distpath}/Kinput2-MacIM.README.gz > ${worksrcpath}/Kinput2-MacIM.README"
}
patch.pre_args	  -p1
patchfiles	  kinput2.macim.patch
use_xmkmf	  yes
build		  {
		  system "cd ${worksrcpath} && make depend PREFIX=${prefix}"
		  system "cd ${worksrcpath} && make PREFIX=${prefix} CDEBUGFLAGS=-O3"
}
destroot	  {
		  system "cd ${worksrcpath} && make install install.man DESTDIR=${destroot} PREFIX=${prefix} BINDIR=${prefix}/bin LIBDIR=${prefix}/lib CONFDIR=${prefix}/etc MANSOURCEPATH=${prefix}/share/man/man DOCDIR=${prefix}/share/doc/${name} XAPPLOADDIR=/usr/X11R6/lib/X11/app-defaults"
		  #notice: app-defaults/Kinput2.macim is installed outside of /opt tree.
		  file delete ${destroot}${prefix}/lib/app-defaults
}
post-destroot	  {
                  xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
                  xinstall -m 644 -W ${worksrcpath} NEWS README Kinput2-MacIM.README copyright ${destroot}${prefix}/share/doc/${name}
}
