diff options
author | nobutaka <nobutaka@FreeBSD.org> | 2011-08-22 22:48:19 +0800 |
---|---|---|
committer | nobutaka <nobutaka@FreeBSD.org> | 2011-08-22 22:48:19 +0800 |
commit | 37bb390727e119f5b715066b5527da4d6c075eee (patch) | |
tree | de6bff4ed515d7cea7be56d2cd405b72038d3ce0 /japanese/migemo | |
parent | 053ae4a30d043aaeb9286699facf139cd92c1746 (diff) | |
download | freebsd-ports-gnome-37bb390727e119f5b715066b5527da4d6c075eee.tar.gz freebsd-ports-gnome-37bb390727e119f5b715066b5527da4d6c075eee.tar.zst freebsd-ports-gnome-37bb390727e119f5b715066b5527da4d6c075eee.zip |
Fix incompatibility with Ruby 1.9.
Reported by: linimon
Diffstat (limited to 'japanese/migemo')
-rw-r--r-- | japanese/migemo/Makefile | 40 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-Makefile.am.ruby19 | 24 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-configure.in.ruby19 | 11 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-genchars.sh | 10 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo | 11 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo-cache.rb | 22 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo-client | 10 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo-convert.rb | 10 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo-grep | 10 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo-index.rb | 9 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo-server | 28 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-migemo.rb.in | 19 | ||||
-rw-r--r-- | japanese/migemo/files/extra-patch-tests_Makefile.am | 20 |
13 files changed, 217 insertions, 7 deletions
diff --git a/japanese/migemo/Makefile b/japanese/migemo/Makefile index a082309b4c2f..9c1428d8922c 100644 --- a/japanese/migemo/Makefile +++ b/japanese/migemo/Makefile @@ -7,7 +7,7 @@ PORTNAME= migemo PORTVERSION= 0.40 -PORTREVISION= 7 +PORTREVISION= 8 PORTEPOCH= 1 CATEGORIES= japanese elisp MASTER_SITES= http://0xcc.net/migemo/ \ @@ -24,12 +24,13 @@ LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/COPYING .if !defined(SLAVE_PORT) -USE_AUTOTOOLS= automake14 autoconf213 -EXTRA_PATCHES= ${FILESDIR}/extra-patch-Makefile.am ${FILESDIR}/extra-patch-configure.in +EXTRA_PATCHES= ${FILESDIR}/extra-patch-Makefile.am \ + ${FILESDIR}/extra-patch-configure.in PLIST_SUB= MIGEMO="" ELISP="@comment " .endif USE_RUBY= yes +USE_AUTOTOOLS= automake14 autoconf213 BUILD_DEPENDS+= ${RUBY_SITELIBDIR}/romkan.rb:${PORTSDIR}/japanese/ruby-romkan \ ${RUBY_SITELIBDIR}/bsearch.rb:${PORTSDIR}/devel/ruby-bsearch RUN_DEPENDS+= ${RUBY_SITELIBDIR}/romkan.rb:${PORTSDIR}/japanese/ruby-romkan \ @@ -38,10 +39,27 @@ RUN_DEPENDS+= ${RUBY_SITELIBDIR}/romkan.rb:${PORTSDIR}/japanese/ruby-romkan \ CONFIGURE_ARGS+=--with-rubydir=${RUBY_SITELIBDIR} MAKE_JOBS_UNSAFE= yes +SHEBANG_FILES= migemo migemo-client migemo-grep migemo-server + SKKDIC_FILE= SKK-JISYO.L-20110813 .include <bsd.port.pre.mk> +.if ${RUBY_VER} == 1.9 +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-Makefile.am.ruby19 \ + ${PATCHDIR}/extra-patch-configure.in.ruby19 \ + ${PATCHDIR}/extra-patch-genchars.sh \ + ${PATCHDIR}/extra-patch-migemo \ + ${PATCHDIR}/extra-patch-migemo-cache.rb \ + ${PATCHDIR}/extra-patch-migemo-client \ + ${PATCHDIR}/extra-patch-migemo-convert.rb \ + ${PATCHDIR}/extra-patch-migemo-grep \ + ${PATCHDIR}/extra-patch-migemo-index.rb \ + ${PATCHDIR}/extra-patch-migemo-server \ + ${PATCHDIR}/extra-patch-migemo.rb.in \ + ${PATCHDIR}/extra-patch-tests_Makefile.am +.endif + .if ${ARCH} == "ia64" BROKEN= Does not compile on ia64 .endif @@ -51,9 +69,21 @@ post-extract: ${BZIP2_CMD} -cd ${DISTDIR}/${DIST_SUBDIR}/${SKKDIC_FILE}.bz2 > ${WRKSRC}/SKK-JISYO.L .endif +post-patch: +.if ${RUBY_VER} == 1.9 && ${SLAVE_PORT} == "no" + @cd ${WRKSRC} ; \ + for f in ${SHEBANG_FILES} ; do \ + ${REINPLACE_CMD} -e 's:#!.*:#!${RUBY} -Ke:' $$f ; \ + done +.endif + post-configure: .if ${SLAVE_PORT} == "no" +.if ${RUBY_VER} == 1.9 + (cd ${WRKSRC}; ${CAT} SKK-JISYO.L | ${RUBY} -Ke migemo-convert.rb > migemo-dict) +.else (cd ${WRKSRC}; ${CAT} SKK-JISYO.L | ${RUBY} migemo-convert.rb > migemo-dict) +.endif ${CP} ${AUTOMAKE_DIR}/config.guess ${WRKSRC} ${CP} ${AUTOMAKE_DIR}/config.sub ${WRKSRC} .endif @@ -63,8 +93,4 @@ post-install: @${CAT} ${PKGMESSAGE} .endif -.if ${RUBY_VER} == 1.9 -BROKEN= does not build with ruby 1.9 -.endif - .include <bsd.port.post.mk> diff --git a/japanese/migemo/files/extra-patch-Makefile.am.ruby19 b/japanese/migemo/files/extra-patch-Makefile.am.ruby19 new file mode 100644 index 000000000000..44115289a66c --- /dev/null +++ b/japanese/migemo/files/extra-patch-Makefile.am.ruby19 @@ -0,0 +1,24 @@ +--- Makefile.am.orig 2011-08-22 13:05:16.000000000 +0900 ++++ Makefile.am 2011-08-22 13:05:23.000000000 +0900 +@@ -15,17 +15,17 @@ + sed -e 's!@pkgdatadir@!$(pkgdatadir)!g' migemo.el.in > $@ + + migemo-dict: # SKK-JISYO.L +- ruby -I. migemo-convert.rb SKK-JISYO.L > $@ ++ ruby -Ke -I. migemo-convert.rb SKK-JISYO.L > $@ + + migemo-dict.idx: migemo-dict +- ruby -I. migemo-index.rb migemo-dict > migemo-dict.idx ++ ruby -Ke -I. migemo-index.rb migemo-dict > migemo-dict.idx + + migemo-dict.cache: frequent-chars migemo-dict migemo-dict.idx +- sort frequent-chars | ruby -I. migemo-cache.rb migemo-dict ++ sort frequent-chars | ruby -Ke -I. migemo-cache.rb migemo-dict + + frequent-chars: genchars.sh migemo-dict + sh genchars.sh > tmp.list1 +- cat tmp.list1 | ruby -rromkan -ne 'puts $$_.to_kunrei' > tmp.list2 ++ cat tmp.list1 | ruby -Ke -rromkan -ne 'puts $$_.to_kunrei' > tmp.list2 + cat tmp.list1 tmp.list2 | sort | uniq > frequent-chars + + clean-local: diff --git a/japanese/migemo/files/extra-patch-configure.in.ruby19 b/japanese/migemo/files/extra-patch-configure.in.ruby19 new file mode 100644 index 000000000000..9efcbc235a69 --- /dev/null +++ b/japanese/migemo/files/extra-patch-configure.in.ruby19 @@ -0,0 +1,11 @@ +--- configure.in.orig 2011-08-22 13:07:45.000000000 +0900 ++++ configure.in 2011-08-22 13:08:00.000000000 +0900 +@@ -19,7 +19,7 @@ + fi + + echo -n "checking Ruby/Romkan... " +-if ruby -rromkan -e 'exit(if Romkan::VERSION >= "0.3" then 0 else 1 end)'; then ++if ruby -Ke -rromkan -e 'exit(if Romkan::VERSION >= "0.3" then 0 else 1 end)'; then + echo found + else + echo not found diff --git a/japanese/migemo/files/extra-patch-genchars.sh b/japanese/migemo/files/extra-patch-genchars.sh new file mode 100644 index 000000000000..57e8c1e25254 --- /dev/null +++ b/japanese/migemo/files/extra-patch-genchars.sh @@ -0,0 +1,10 @@ +--- genchars.sh.orig 2001-08-13 18:30:48.000000000 +0900 ++++ genchars.sh 2011-08-21 23:37:29.000000000 +0900 +@@ -1,6 +1,6 @@ + #! /bin/sh + +-ruby -rromkan -nle 'head = split[0]; if /^\w+$/ =~ head then puts head else roma = head.to_roma; puts roma, roma.to_kunrei end' migemo-dict |uniq> tmp.ascii.words ++ruby -Ke -rromkan -nle 'head = $_.split[0]; if /^\w+$/ =~ head then puts head else roma = head.to_roma; puts roma, roma.to_kunrei end' migemo-dict |uniq> tmp.ascii.words + + # Get the top 500 frequent ngrams. + for i in 1 2 3 4 5 6 7 8; do diff --git a/japanese/migemo/files/extra-patch-migemo b/japanese/migemo/files/extra-patch-migemo new file mode 100644 index 000000000000..d48fd3dec86f --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo @@ -0,0 +1,11 @@ +--- migemo.orig 2011-08-22 02:15:54.000000000 +0900 ++++ migemo 2011-08-22 02:16:01.000000000 +0900 +@@ -10,8 +10,6 @@ + # the GNU General Public License version 2. + # + +-$KCODE = "e" +- + require 'migemo' + require 'getoptlong' + require 'thread' diff --git a/japanese/migemo/files/extra-patch-migemo-cache.rb b/japanese/migemo/files/extra-patch-migemo-cache.rb new file mode 100644 index 000000000000..c06b28165055 --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo-cache.rb @@ -0,0 +1,22 @@ +--- migemo-cache.rb.orig 2011-08-22 03:56:56.000000000 +0900 ++++ migemo-cache.rb 2011-08-22 03:59:20.000000000 +0900 +@@ -1,5 +1,4 @@ + require 'migemo' +-$KCODE="e" + raise if ARGV[0] == nil + dict = ARGV[0] + static_dict = MigemoStaticDict.new(dict) +@@ -18,10 +17,10 @@ + migemo = Migemo.new(static_dict, pattern) + migemo.optimization = 3 + data = Marshal.dump(migemo.regex_tree) +- output = [pattern.length].pack("N") + pattern + +- [data.length].pack("N") + data ++ output = [pattern.bytesize].pack("N") + pattern.dup.force_encoding("ASCII-8BIT") + ++ [data.bytesize].pack("N") + data + cache.print output + index.print [idx].pack("N") +- idx += output.length ++ idx += output.bytesize + end + diff --git a/japanese/migemo/files/extra-patch-migemo-client b/japanese/migemo/files/extra-patch-migemo-client new file mode 100644 index 000000000000..483e0e4ac4cb --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo-client @@ -0,0 +1,10 @@ +--- migemo-client.orig 2011-08-22 02:16:46.000000000 +0900 ++++ migemo-client 2011-08-22 02:16:48.000000000 +0900 +@@ -10,7 +10,6 @@ + # the GNU General Public License version 2. + # + +-$KCODE = "e" + require 'net/http' + require 'getoptlong' + diff --git a/japanese/migemo/files/extra-patch-migemo-convert.rb b/japanese/migemo/files/extra-patch-migemo-convert.rb new file mode 100644 index 000000000000..dfc202602d32 --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo-convert.rb @@ -0,0 +1,10 @@ +--- migemo-convert.rb.orig 2003-05-26 15:55:22.000000000 +0900 ++++ migemo-convert.rb 2011-08-22 02:20:13.000000000 +0900 +@@ -14,7 +14,6 @@ + # + # Convert a SKK's dictionary into Migemo's. + # +-$KCODE= "e" + require 'romkan' + + HIRAGANA = "[¤¡-¤ó¡¼¡Á]" diff --git a/japanese/migemo/files/extra-patch-migemo-grep b/japanese/migemo/files/extra-patch-migemo-grep new file mode 100644 index 000000000000..4b991e99a112 --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo-grep @@ -0,0 +1,10 @@ +--- migemo-grep.orig 2011-08-22 02:14:28.000000000 +0900 ++++ migemo-grep 2011-08-22 02:14:32.000000000 +0900 +@@ -9,7 +9,6 @@ + # You can redistribute it and/or modify it under the terms of + # the GNU General Public License version 2. + # +-$KCODE = "e" + + require 'migemo' + require 'getoptlong' diff --git a/japanese/migemo/files/extra-patch-migemo-index.rb b/japanese/migemo/files/extra-patch-migemo-index.rb new file mode 100644 index 000000000000..59a703cfb9dc --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo-index.rb @@ -0,0 +1,9 @@ +--- migemo-index.rb.orig 2003-05-26 15:45:53.000000000 +0900 ++++ migemo-index.rb 2011-08-22 02:21:25.000000000 +0900 +@@ -19,5 +19,5 @@ + unless line =~ /^;/ + print [offset].pack("N") + end +- offset += line.length ++ offset += line.bytesize + end diff --git a/japanese/migemo/files/extra-patch-migemo-server b/japanese/migemo/files/extra-patch-migemo-server new file mode 100644 index 000000000000..005acfa04589 --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo-server @@ -0,0 +1,28 @@ +--- migemo-server.orig 2001-08-13 18:30:51.000000000 +0900 ++++ migemo-server 2011-08-22 22:45:10.000000000 +0900 +@@ -10,7 +10,6 @@ + # the GNU General Public License version 2. + # + +-$KCODE = "e" + require 'migemo' + require 'cgi' + require 'socket' +@@ -73,7 +72,7 @@ + end + + def print_form (socket) +- print_http (socket, ++ print_http(socket, + ['HTTP/1.0 200', + 'Content-type: text/html'], + <<"EOF") +@@ -111,7 +110,7 @@ + + def print_http (socket, header, body) + header.each { |h| socket.syswrite h + CRLF } +- socket.syswrite 'Content-Length: ' + body.size.to_s + CRLF ++ socket.syswrite 'Content-Length: ' + body.bytesize.to_s + CRLF + socket.syswrite CRLF + socket.syswrite body + end diff --git a/japanese/migemo/files/extra-patch-migemo.rb.in b/japanese/migemo/files/extra-patch-migemo.rb.in new file mode 100644 index 000000000000..1d1eba40b7bc --- /dev/null +++ b/japanese/migemo/files/extra-patch-migemo.rb.in @@ -0,0 +1,19 @@ +--- migemo.rb.in.orig 2003-05-28 21:00:52.000000000 +0900 ++++ migemo.rb.in 2011-08-22 02:23:18.000000000 +0900 +@@ -14,7 +14,6 @@ + require 'migemo-dict' + require 'migemo-regex' + require 'romkan' +-require 'jcode' + include MigemoRegex + + class String +@@ -24,7 +23,7 @@ + end + + def quotemeta +- self.gsub(/([^ \w])/, '\\\\\\1') ++ self.gsub(/([[:punct:]])/, '\\\\\\1') + end + + def first diff --git a/japanese/migemo/files/extra-patch-tests_Makefile.am b/japanese/migemo/files/extra-patch-tests_Makefile.am new file mode 100644 index 000000000000..f7ef05331b91 --- /dev/null +++ b/japanese/migemo/files/extra-patch-tests_Makefile.am @@ -0,0 +1,20 @@ +--- tests/Makefile.am.orig 2001-08-14 02:12:57.000000000 +0900 ++++ tests/Makefile.am 2011-08-22 00:54:29.000000000 +0900 +@@ -5,13 +5,13 @@ + + + test-dict.idx: test-dict ../migemo-index.rb +- ruby -I.. ../migemo-index.rb test-dict > test-dict.idx ++ ruby -Ke -I.. ../migemo-index.rb test-dict > test-dict.idx + + test-dict.cache: test-dict test-dict.idx ../migemo-cache.rb +- ruby -rromkan -ne 'puts $$1.to_roma if /^(.+?) /' test-dict |\ ++ ruby -Ke -rromkan -ne 'puts $$1.to_roma if /^(.+?) /' test-dict |\ + while read line; do\ +- echo $$line | ruby -ne 'chomp!;1.upto($$_.length) do |x| puts $$_[0,x] end';\ +- done | ruby -I.. ../migemo-cache.rb test-dict ++ echo $$line | ruby -Ke -ne '$$_.chomp!;1.upto($$_.length) do |x| puts $$_[0,x] end';\ ++ done | ruby -Ke -I.. ../migemo-cache.rb test-dict + + clean-local: + rm -f tmp.* |