From e69694463fe684c9d43f61d8529a446ab527d5e5 Mon Sep 17 00:00:00 2001 From: jeremy Date: Mon, 23 Oct 2017 21:46:43 +0000 Subject: [PATCH] Switch to using estraier gem This is much simpler than trying to build the support that ships with the hyperestaier distfile. No significant difference in the ruby code, even though it appears to be 3 tiny versions behind (1.4.10 vs 1.4.13). This should make it easier to support future ruby versions, as previously those required manual changes to the port Makefile. --- textproc/ruby-hyperestraier/Makefile | 61 +++--------------- textproc/ruby-hyperestraier/distinfo | 4 +- ...ve_src_estraier_c => patch-ext_estraier_c} | 10 ++- .../patches/patch-rubynative_Makefile_in | 63 ------------------- .../patches/patch-rubynative_configure | 53 ---------------- .../patches/patch-rubynative_estcmd_rb | 34 ---------- .../patches/patch-rubynative_src_extconf_rb | 22 ------- textproc/ruby-hyperestraier/pkg/PLIST | 28 ++++++--- 8 files changed, 39 insertions(+), 236 deletions(-) rename textproc/ruby-hyperestraier/patches/{patch-rubynative_src_estraier_c => patch-ext_estraier_c} (88%) delete mode 100644 textproc/ruby-hyperestraier/patches/patch-rubynative_Makefile_in delete mode 100644 textproc/ruby-hyperestraier/patches/patch-rubynative_configure delete mode 100644 textproc/ruby-hyperestraier/patches/patch-rubynative_estcmd_rb delete mode 100644 textproc/ruby-hyperestraier/patches/patch-rubynative_src_extconf_rb diff --git a/textproc/ruby-hyperestraier/Makefile b/textproc/ruby-hyperestraier/Makefile index 1d45672fb47..94be5bfc34c 100644 --- a/textproc/ruby-hyperestraier/Makefile +++ b/textproc/ruby-hyperestraier/Makefile @@ -1,71 +1,28 @@ -# $OpenBSD: Makefile,v 1.43 2017/01/06 16:04:59 jeremy Exp $ +# $OpenBSD: Makefile,v 1.44 2017/10/23 21:46:43 jeremy Exp $ COMMENT= Ruby interface to hyperestraier -DISTNAME= hyperestraier-1.4.13 -PKGNAME= ruby-hyperestraier-1.0.0 -REVISION = 23 +V= 1.4.10 +DISTNAME= estraier-${V} +PKGNAME= hyperestraier-${V} CATEGORIES= textproc -HOMEPAGE= http://hyperestraier.sourceforge.net/ +HOMEPAGE= http://fallabs.com/hyperestraier/rubynativeapi/ MAINTAINER= Jeremy Evans # LGPL PERMIT_PACKAGE_CDROM= Yes -MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=hyperestraier/} - -FLAVORS = ruby21 ruby22 ruby23 ruby24 -FLAVOR ?= -.if ${FLAVOR:Mruby21} -MODRUBY_REV = 2.1 -FULLPKGNAME = ruby21-hyperestraier-1.0.0 -BIN_SUFFIX = 21 -WANTLIB += gmp -.elif ${FLAVOR:Mruby22} -MODRUBY_REV = 2.2 -FULLPKGNAME = ruby22-hyperestraier-1.0.0 -BIN_SUFFIX = 22 -WANTLIB += gmp -.elif ${FLAVOR:Mruby23} -MODRUBY_REV = 2.3 -FULLPKGNAME = ruby23-hyperestraier-1.0.0 -BIN_SUFFIX = 23 -WANTLIB += gmp -.elif ${FLAVOR:Mruby24} -MODRUBY_REV = 2.4 -FULLPKGNAME = ruby24-hyperestraier-1.0.0 -BIN_SUFFIX = 24 -WANTLIB += gmp -.else -MODRUBY_REV = 1.8 -BIN_SUFFIX = -.endif -SUBST_VARS += BIN_SUFFIX - -WANTLIB += c m pthread estraier ${MODRUBY_WANTLIB} MODULES= lang/ruby -LIB_DEPENDS= ${MODRUBY_LIB_DEPENDS} \ - textproc/hyperestraier +WANTLIB += estraier iconv qdbm z -CONFIGURE_STYLE= gnu -CONFIGURE_ENV = RUBY=${RUBY} RDOC=`echo ${RUBY} | sed s/ruby/rdoc/` +LIB_DEPENDS= textproc/hyperestraier -WRKSRC= ${WRKDIST}/rubynative - -SUBST_VARS += RUBY +CONFIGURE_STYLE= ruby gem ext pre-configure: - ${SUBST_CMD} ${WRKSRC}/estcmd.rb - -post-install: -.if ${BIN_SUFFIX} - mv ${PREFIX}/bin/estcmd{,${BIN_SUFFIX}}.rb -.endif - ${INSTALL_DATA_DIR} ${MODRUBY_EXAMPLEDIR}/hyperestraier - ${INSTALL_DATA} ${WRKSRC}/example/*.rb \ - ${MODRUBY_EXAMPLEDIR}/hyperestraier + rm -r ${WRKSRC}/lib .include diff --git a/textproc/ruby-hyperestraier/distinfo b/textproc/ruby-hyperestraier/distinfo index 41558aca4b0..66da280c498 100644 --- a/textproc/ruby-hyperestraier/distinfo +++ b/textproc/ruby-hyperestraier/distinfo @@ -1,2 +1,2 @@ -SHA256 (hyperestraier-1.4.13.tar.gz) = kvPnbRLaeeEW5OaEh//d38Kr5fUPUJJHkFQU2qXDj/8= -SIZE (hyperestraier-1.4.13.tar.gz) = 1014600 +SHA256 (estraier-1.4.10.gem) = fwvXOTnx3yW68j1NLRpVdE0rrjXHGKNS4aeRevXQqZ4= +SIZE (estraier-1.4.10.gem) = 30208 diff --git a/textproc/ruby-hyperestraier/patches/patch-rubynative_src_estraier_c b/textproc/ruby-hyperestraier/patches/patch-ext_estraier_c similarity index 88% rename from textproc/ruby-hyperestraier/patches/patch-rubynative_src_estraier_c rename to textproc/ruby-hyperestraier/patches/patch-ext_estraier_c index 4641e4c5584..8c1321d5f48 100644 --- a/textproc/ruby-hyperestraier/patches/patch-rubynative_src_estraier_c +++ b/textproc/ruby-hyperestraier/patches/patch-ext_estraier_c @@ -1,6 +1,10 @@ -$OpenBSD: patch-rubynative_src_estraier_c,v 1.1 2011/07/12 18:06:23 jeremy Exp $ ---- rubynative/src/estraier.c.orig Fri Jul 8 09:05:46 2011 -+++ rubynative/src/estraier.c Fri Jul 8 09:08:29 2011 +$OpenBSD: patch-ext_estraier_c,v 1.1 2017/10/23 21:46:43 jeremy Exp $ + +Use modern ruby macros for accessing ptr/len for strings and arrays. + +Index: ext/estraier.c +--- ext/estraier.c.orig ++++ ext/estraier.c @@ -351,7 +351,7 @@ static VALUE doc_make_snippet(VALUE vself, VALUE vword vdoc = rb_iv_get(vself, VNDATA); Data_Get_Struct(vdoc, ESTDOC, doc); diff --git a/textproc/ruby-hyperestraier/patches/patch-rubynative_Makefile_in b/textproc/ruby-hyperestraier/patches/patch-rubynative_Makefile_in deleted file mode 100644 index cd3b5ca3a10..00000000000 --- a/textproc/ruby-hyperestraier/patches/patch-rubynative_Makefile_in +++ /dev/null @@ -1,63 +0,0 @@ -$OpenBSD: patch-rubynative_Makefile_in,v 1.3 2009/01/30 21:15:05 ajacoutot Exp $ ---- rubynative/Makefile.in.orig Wed Feb 21 10:06:29 2007 -+++ rubynative/Makefile.in Fri Jan 30 22:13:09 2009 -@@ -29,7 +29,7 @@ DESTDIR = - # Building binaries - RUBY = @RUBY@ - RDOC = @RDOC@ --RUNENV = LD_LIBRARY_PATH=.:..:/lib:/usr/lib:$(MYLIBDIR):$(HOME)/lib:/usr/local/lib:@MYRUNPATH@ -+RUNENV = LD_LIBRARY_PATH=:/usr/lib:/usr/local/lib:@MYRUNPATH@ - - - -@@ -53,10 +53,10 @@ clean : - - - install : -- mkdir -p $(DESTDIR)$(MYRBLIBDIR) -- ( cd src && cp -Rf $(MYRBLIBS) $(DESTDIR)$(MYRBLIBDIR) ) -- mkdir -p $(DESTDIR)$(MYRBBINDIR) -- cp -Rf $(MYRBBINS) $(DESTDIR)$(MYRBBINDIR) -+ $(BSD_INSTALL_DATA_DIR) $(DESTDIR)$(MYRBLIBDIR) -+ cd src && $(BSD_INSTALL_DATA) $(MYRBLIBS) $(DESTDIR)$(MYRBLIBDIR) -+ $(BSD_INSTALL_PROGRAM_DIR) $(DESTDIR)$(MYRBBINDIR) -+ $(BSD_INSTALL_SCRIPT) $(MYRBBINS) $(DESTDIR)$(MYRBBINDIR) - @printf '\n' - @printf '#================================================================\n' - @printf '# Thanks for using Hyper Estraier for Ruby.\n' -@@ -82,21 +82,21 @@ distclean : clean - - check : - rm -rf casket -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test001.est -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test002.est -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test003.est -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test004.est -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test005.est -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test006.est -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb edit casket 1 "@title" "java" -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb get casket 1 -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb get casket 1 "@title" -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb out casket 1 -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb inform casket -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb optimize casket -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb search \ -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test001.est -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test002.est -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test003.est -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test004.est -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test005.est -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb put casket ../misc/test006.est -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb edit casket 1 "@title" "java" -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb get casket 1 -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb get casket 1 "@title" -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb out casket 1 -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb inform casket -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb optimize casket -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb search \ - -vf -cd casket "estraier" > check.out -- $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb search \ -+ LD_PRELOAD=/usr/lib/libpthread.so $(RUNENV) $(RUBY) -I./src -w -d estcmd.rb search \ - -vs -gs -attr "@uri" -ord "@mdate NUMD" -max 1 casket "estraier OR mikio" > check.out - rm -rf casket - diff --git a/textproc/ruby-hyperestraier/patches/patch-rubynative_configure b/textproc/ruby-hyperestraier/patches/patch-rubynative_configure deleted file mode 100644 index 27ca2343a9b..00000000000 --- a/textproc/ruby-hyperestraier/patches/patch-rubynative_configure +++ /dev/null @@ -1,53 +0,0 @@ -$OpenBSD: patch-rubynative_configure,v 1.4 2015/01/08 18:59:03 jeremy Exp $ - -Use RbConfig instead of Config, as RbConfig no longer exists -in ruby 2.2. - -Use the current ruby version to figure out prefix and sitelibdir. - ---- rubynative/configure.orig Mon Dec 24 17:53:40 2007 -+++ rubynative/configure Mon Dec 1 15:57:38 2014 -@@ -1228,8 +1228,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - # Export variables --RUBY="ruby" --RDOC="rdoc" - MYRBLIBDIR=/usr/local/lib/ruby/site_ruby - MYRUNPATH="" - -@@ -1258,7 +1256,7 @@ fi - # Setting the default prefix - if test "$prefix" = NONE - then -- prefix=`ruby -rrbconfig -e 'puts(Config::CONFIG.fetch("prefix"))'` -+ prefix=`$RUBY -rrbconfig -e 'puts(RbConfig::CONFIG.fetch("prefix"))'` - fi - - -@@ -1268,24 +1266,8 @@ fi - #================================================================ - - --# Ruby interpreter --printf 'checking RUBY... ' --if which ruby > /dev/null --then -- RUBY=`which ruby` --fi --printf '%s\n' "$RUBY" -- --# Other building tools --printf 'checking RDOC... ' --if which rdoc > /dev/null --then -- RDOC=`which rdoc` --fi --printf '%s\n' "$RDOC" -- - # Librarh path --myrblibdir=`ruby -rrbconfig -e 'puts(Config::CONFIG.fetch("sitelibdir"))'` -+myrblibdir=`$RUBY -rrbconfig -e 'puts(RbConfig::CONFIG.fetch("sitearchdir"))'` - if test -n "$myrblibdir" - then - MYRBLIBDIR="$myrblibdir" diff --git a/textproc/ruby-hyperestraier/patches/patch-rubynative_estcmd_rb b/textproc/ruby-hyperestraier/patches/patch-rubynative_estcmd_rb deleted file mode 100644 index 3e7b87edfd7..00000000000 --- a/textproc/ruby-hyperestraier/patches/patch-rubynative_estcmd_rb +++ /dev/null @@ -1,34 +0,0 @@ -$OpenBSD: patch-rubynative_estcmd_rb,v 1.3 2012/09/21 13:17:46 jasper Exp $ ---- rubynative/estcmd.rb.orig Tue Feb 20 00:13:15 2007 -+++ rubynative/estcmd.rb Thu Apr 12 14:42:29 2007 -@@ -1,4 +1,4 @@ --#! /usr/bin/ruby -w -+#! ${RUBY} - #-- - # Ruby binding of Hyper Estraier - # Copyright (C) 2004-2007 Mikio Hirabayashi -@@ -373,6 +373,12 @@ end - - # perform the put command - def procput(dbname, file, opts) -+ db = Database::new -+ unless db.open(dbname, Database::DBWRITER | Database::DBCREAT) -+ printerror(dbname + ": " + db.err_msg(db.error)) -+ return 1 -+ end -+ - if file - begin - ifp = open(file, "rb") -@@ -388,11 +394,6 @@ def procput(dbname, file, opts) - draft = STDIN.read - end - doc = Document::new(draft) -- db = Database::new -- unless db.open(dbname, Database::DBWRITER | Database::DBCREAT) -- printerror(dbname + ": " + db.err_msg(db.error)) -- return 1 -- end - db.set_informer(Informer::new) - unless db.put_doc(doc, opts) - printerror(dbname + ": " + db.err_msg(db.error)) diff --git a/textproc/ruby-hyperestraier/patches/patch-rubynative_src_extconf_rb b/textproc/ruby-hyperestraier/patches/patch-rubynative_src_extconf_rb deleted file mode 100644 index 4633c969937..00000000000 --- a/textproc/ruby-hyperestraier/patches/patch-rubynative_src_extconf_rb +++ /dev/null @@ -1,22 +0,0 @@ -$OpenBSD: patch-rubynative_src_extconf_rb,v 1.3 2009/11/09 17:45:24 bernd Exp $ - -Use -lpthread to make it work. - ---- rubynative/src/extconf.rb.orig Thu Apr 12 03:52:50 2007 -+++ rubynative/src/extconf.rb Fri Jan 30 21:57:25 2009 -@@ -3,12 +3,9 @@ require "mkmf" - dir_config('estraier') - - ENV["PATH"] = ENV["PATH"] + ":/usr/local/bin:.:..:../.." --estcflags = `estconfig --cflags`.chomp --estldflags = `estconfig --ldflags`.chomp --estlibs = `estconfig --libs`.chomp --$CFLAGS = "-I. -I.. -I../.. #{estcflags} -Wall #{$CFLAGS} -O3 -fomit-frame-pointer -fforce-addr" --$LDFLAGS = "#{$LDFLAGS} -L. -L.. -L../.. #{estldflags}" --$libs = "#{$libs} #{estlibs}" -+$CFLAGS = "#{$CFLAGS} -fomit-frame-pointer -fforce-addr" -+$LDFLAGS = "#{$LDFLAGS} -lpthread" -+$libs = "#{$libs}" - - if have_header('estraier.h') and have_library('estraier') - create_makefile('estraier') diff --git a/textproc/ruby-hyperestraier/pkg/PLIST b/textproc/ruby-hyperestraier/pkg/PLIST index e83a862ff70..80414de86ee 100644 --- a/textproc/ruby-hyperestraier/pkg/PLIST +++ b/textproc/ruby-hyperestraier/pkg/PLIST @@ -1,7 +1,21 @@ -@comment $OpenBSD: PLIST,v 1.5 2011/07/19 18:00:16 jeremy Exp $ -bin/estcmd${BIN_SUFFIX}.rb -${MODRUBY_SITEARCHDIR}/estraier.so -${MODRUBY_RELEXAMPLEDIR}/ -${MODRUBY_RELEXAMPLEDIR}/hyperestraier/ -${MODRUBY_RELEXAMPLEDIR}/hyperestraier/example001.rb -${MODRUBY_RELEXAMPLEDIR}/hyperestraier/example002.rb +@comment $OpenBSD: PLIST,v 1.6 2017/10/23 21:46:43 jeremy Exp $ +${GEM_BIN}/estcmd${GEM_BIN_SUFFIX} +${GEM_LIB}/cache/${DISTNAME}.gem +${GEM_LIB}/gems/${DISTNAME}/ +${GEM_LIB}/gems/${DISTNAME}/CHANGELOG.txt +${GEM_LIB}/gems/${DISTNAME}/History.txt +${GEM_LIB}/gems/${DISTNAME}/README.txt +${GEM_LIB}/gems/${DISTNAME}/Rakefile +${GEM_LIB}/gems/${DISTNAME}/bin/ +${GEM_LIB}/gems/${DISTNAME}/bin/estcmd +${GEM_LIB}/gems/${DISTNAME}/examples/ +${GEM_LIB}/gems/${DISTNAME}/examples/Makefile +${GEM_LIB}/gems/${DISTNAME}/examples/example001.rb +${GEM_LIB}/gems/${DISTNAME}/examples/example002.rb +${GEM_LIB}/gems/${DISTNAME}/lib/ +${GEM_LIB}/gems/${DISTNAME}/lib/estraier.so +${GEM_LIB}/gems/${DISTNAME}/setup.rb +${GEM_LIB}/gems/${DISTNAME}/test/ +${GEM_LIB}/gems/${DISTNAME}/test/test_estraier.rb +${GEM_LIB}/gems/${DISTNAME}/test/test_helper.rb +${GEM_LIB}/specifications/${DISTNAME}.gemspec