Fix incompatibility with Ruby 1.9.
Reported by: linimon
This commit is contained in:
parent
353196de06
commit
bac10487f1
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=280186
13 changed files with 217 additions and 7 deletions
|
@ -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>
|
||||
|
|
24
japanese/migemo/files/extra-patch-Makefile.am.ruby19
Normal file
24
japanese/migemo/files/extra-patch-Makefile.am.ruby19
Normal file
|
@ -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:
|
11
japanese/migemo/files/extra-patch-configure.in.ruby19
Normal file
11
japanese/migemo/files/extra-patch-configure.in.ruby19
Normal file
|
@ -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
|
10
japanese/migemo/files/extra-patch-genchars.sh
Normal file
10
japanese/migemo/files/extra-patch-genchars.sh
Normal file
|
@ -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
|
11
japanese/migemo/files/extra-patch-migemo
Normal file
11
japanese/migemo/files/extra-patch-migemo
Normal file
|
@ -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'
|
22
japanese/migemo/files/extra-patch-migemo-cache.rb
Normal file
22
japanese/migemo/files/extra-patch-migemo-cache.rb
Normal file
|
@ -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
|
||||
|
10
japanese/migemo/files/extra-patch-migemo-client
Normal file
10
japanese/migemo/files/extra-patch-migemo-client
Normal file
|
@ -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'
|
||||
|
10
japanese/migemo/files/extra-patch-migemo-convert.rb
Normal file
10
japanese/migemo/files/extra-patch-migemo-convert.rb
Normal file
|
@ -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 = "[ぁ-んー~]"
|
10
japanese/migemo/files/extra-patch-migemo-grep
Normal file
10
japanese/migemo/files/extra-patch-migemo-grep
Normal file
|
@ -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'
|
9
japanese/migemo/files/extra-patch-migemo-index.rb
Normal file
9
japanese/migemo/files/extra-patch-migemo-index.rb
Normal file
|
@ -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
|
28
japanese/migemo/files/extra-patch-migemo-server
Normal file
28
japanese/migemo/files/extra-patch-migemo-server
Normal file
|
@ -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
|
19
japanese/migemo/files/extra-patch-migemo.rb.in
Normal file
19
japanese/migemo/files/extra-patch-migemo.rb.in
Normal file
|
@ -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
|
20
japanese/migemo/files/extra-patch-tests_Makefile.am
Normal file
20
japanese/migemo/files/extra-patch-tests_Makefile.am
Normal file
|
@ -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.*
|
Loading…
Reference in a new issue