This adds perl and ruby bindings to libmarisa as sub packages. Currently only python binding is included. I had checked this with sample.pl and sample.rb on my openbsd7.0/amd64, and saw this works fine.
Incremented REVISION-main and added REVISION-python in Makefile. ok? Index: Makefile =================================================================== RCS file: /cvs/ports/textproc/libmarisa/Makefile,v retrieving revision 1.2 diff -u -p -u -p -r1.2 Makefile --- Makefile 14 Sep 2021 10:51:53 -0000 1.2 +++ Makefile 23 Nov 2021 08:07:20 -0000 @@ -1,13 +1,18 @@ # $OpenBSD: Makefile,v 1.2 2021/09/14 10:51:53 inoguchi Exp $ COMMENT-main = C++ library for MARISA matching algorithm +COMMENT-perl = marisa-trie bindings for Perl (SWIG) COMMENT-python = marisa-trie bindings for Python (SWIG) +COMMENT-ruby = marisa-trie bindings for Ruby (SWIG) V = 0.2.6 PKGNAME-main = libmarisa-${V} +PKGNAME-perl = p5-libmarisa-${V} PKGNAME-python = py3-libmarisa-${V} +PKGNAME-ruby = ruby-libmarisa-${V} -REVISION-main = 0 +REVISION-main = 1 +REVISION-python = 0 GH_ACCOUNT = s-yata GH_PROJECT = marisa-trie @@ -22,22 +27,37 @@ MAINTAINER = Yifei Zhan <open...@zhan.sc # dual license: either BSD 2-clause or LGPLv2.1+ PERMIT_PACKAGE = Yes -PSEUDO_FLAVORS = no_python +PSEUDO_FLAVORS = no_perl no_python no_ruby FLAVOR? = -MULTI_PACKAGES = -main -python +MULTI_PACKAGES = -main -perl -python -ruby WANTLIB-main += ${COMPILER_LIBCXX} c m .include <bsd.port.arch.mk> -.if ${BUILD_PACKAGES:M-python} +.if ${BUILD_PACKAGES:M-perl} || ${BUILD_PACKAGES:M-python} || ${BUILD_PACKAGES:M-ruby} BUILD_DEPENDS += devel/swig +.endif + +.if ${BUILD_PACKAGES:M-perl} +MODULES += perl +LIB_DEPENDS-perl = ${BUILD_PKGPATH},-main=${V} +WANTLIB-perl = ${COMPILER_LIBCXX} c marisa perl +.endif + +.if ${BUILD_PACKAGES:M-python} MODULES += lang/python LIB_DEPENDS-python = ${BUILD_PKGPATH},-main=${V} ${MODPY_LIB_DEPENDS} WANTLIB-python = ${COMPILER_LIBCXX} ${MODPY_WANTLIB} m marisa .endif +.if ${BUILD_PACKAGES:M-ruby} +MODULES += lang/ruby +LIB_DEPENDS-ruby = ${BUILD_PKGPATH},-main=${V} ${MODRUBY_LIB_DEPENDS} +WANTLIB-ruby = ${COMPILER_LIBCXX} ${MODRUBY_WANTLIB} marisa +.endif + AUTOCONF_VERSION = 2.69 AUTOMAKE_VERSION = 1.15 CONFIGURE_STYLE = autoreconf @@ -48,6 +68,14 @@ CONFIGURE_ARGS += --enable-sse2 .endif post-build: +.if ${BUILD_PACKAGES:M-perl} + cd ${WRKDIST}/bindings && make swig-perl + cd ${WRKDIST}/bindings/perl && \ + perl Makefile.PL \ + INC="-I${WRKSRC}/include" \ + LIBS="-L${WRKSRC}/lib/marisa/.libs -lmarisa" && \ + ${MAKE} ${MAKE_FLAGS} +.endif .if ${BUILD_PACKAGES:M-python} cd ${WRKDIST}/bindings && make swig-python cd ${WRKDIST}/bindings/python && \ @@ -55,11 +83,27 @@ post-build: --include-dirs=${WRKSRC}/include/ \ --library-dirs=${WRKSRC}/lib/marisa/.libs .endif +.if ${BUILD_PACKAGES:M-ruby} + cd ${WRKDIST}/bindings && make swig-ruby + cd ${WRKDIST}/bindings/ruby && \ + ${RUBY} extconf.rb \ + --with-opt-include=${WRKSRC}/include \ + --with-opt-lib=${WRKSRC}/lib/marisa/.libs && \ + ${MAKE} ${MAKE_FLAGS} +.endif post-install: +.if ${BUILD_PACKAGES:M-perl} + cd ${WRKDIST}/bindings/perl && \ + ${MAKE} ${MAKE_FLAGS} install +.endif .if ${BUILD_PACKAGES:M-python} cd ${WRKDIST}/bindings/python && \ ${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL} +.endif +.if ${BUILD_PACKAGES:M-ruby} + cd ${WRKDIST}/bindings/ruby && \ + ${MAKE} ${MAKE_FLAGS} install INSTALL_PROG="${INSTALL_SCRIPT}" .endif .include <bsd.port.mk> Index: pkg/DESCR-perl =================================================================== RCS file: pkg/DESCR-perl diff -N pkg/DESCR-perl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/DESCR-perl 23 Nov 2021 08:07:20 -0000 @@ -0,0 +1 @@ +marisa-trie bindings for Perl (SWIG) Index: pkg/DESCR-ruby =================================================================== RCS file: pkg/DESCR-ruby diff -N pkg/DESCR-ruby --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/DESCR-ruby 23 Nov 2021 08:07:20 -0000 @@ -0,0 +1 @@ +marisa-trie bindings for Ruby (SWIG) Index: pkg/PLIST-perl =================================================================== RCS file: pkg/PLIST-perl diff -N pkg/PLIST-perl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/PLIST-perl 23 Nov 2021 08:07:20 -0000 @@ -0,0 +1,6 @@ +@comment $OpenBSD: PLIST-perl,v$ +${P5ARCH}/ +${P5ARCH}/auto/ +${P5ARCH}/auto/marisa/ +@so ${P5ARCH}/auto/marisa/marisa.so +${P5ARCH}/marisa.pm Index: pkg/PLIST-ruby =================================================================== RCS file: pkg/PLIST-ruby diff -N pkg/PLIST-ruby --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/PLIST-ruby 23 Nov 2021 08:07:20 -0000 @@ -0,0 +1,2 @@ +@comment $OpenBSD: PLIST-ruby,v$ +@so ${MODRUBY_SITEARCHDIR}/marisa.so