update textproc/libmarisa to add perl and ruby bindings

built and tested on amd64.
build check on arm64 by Yifei Zhan < openbsd () zhan ! science >.
review comments and OK from sthen@
This commit is contained in:
inoguchi 2021-11-26 13:35:06 +00:00
parent 3b5d0d852e
commit e4a38a4e0e
5 changed files with 67 additions and 7 deletions

View File

@ -1,13 +1,18 @@
# $OpenBSD: Makefile,v 1.2 2021/09/14 10:51:53 inoguchi Exp $ # $OpenBSD: Makefile,v 1.3 2021/11/26 13:35:06 inoguchi Exp $
COMMENT-main = C++ library for MARISA matching algorithm 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-python = marisa-trie bindings for Python (SWIG)
COMMENT-ruby = marisa-trie bindings for Ruby (SWIG)
V = 0.2.6 V = 0.2.6
PKGNAME-main = libmarisa-${V} PKGNAME-main = libmarisa-${V}
PKGNAME-perl = p5-libmarisa-${V}
PKGNAME-python = py3-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_ACCOUNT = s-yata
GH_PROJECT = marisa-trie GH_PROJECT = marisa-trie
@ -22,20 +27,39 @@ MAINTAINER = Yifei Zhan <openbsd@zhan.science>
# dual license: either BSD 2-clause or LGPLv2.1+ # dual license: either BSD 2-clause or LGPLv2.1+
PERMIT_PACKAGE = Yes PERMIT_PACKAGE = Yes
PSEUDO_FLAVORS = no_python PSEUDO_FLAVORS = no_perl no_python no_ruby
FLAVOR? = FLAVOR? =
MULTI_PACKAGES = -main -python MULTI_PACKAGES = -main -perl -python -ruby
RUN_DEPENDS-main = # empty
WANTLIB-main += ${COMPILER_LIBCXX} c m WANTLIB-main += ${COMPILER_LIBCXX} c m
.include <bsd.port.arch.mk> .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 BUILD_DEPENDS += devel/swig
.endif
.if ${BUILD_PACKAGES:M-perl}
MODULES += perl
LIB_DEPENDS-perl = ${BUILD_PKGPATH},-main=${V}
RUN_DEPENDS-perl = # empty
WANTLIB-perl = c marisa perl
.endif
.if ${BUILD_PACKAGES:M-python}
MODULES += lang/python MODULES += lang/python
LIB_DEPENDS-python = ${BUILD_PKGPATH},-main=${V} ${MODPY_LIB_DEPENDS} LIB_DEPENDS-python = ${BUILD_PKGPATH},-main=${V}
WANTLIB-python = ${COMPILER_LIBCXX} ${MODPY_WANTLIB} m marisa RUN_DEPENDS-python = ${MODPY_RUN_DEPENDS}
WANTLIB-python = ${COMPILER_LIBCXX} m marisa
.endif
.if ${BUILD_PACKAGES:M-ruby}
MODULES += lang/ruby
LIB_DEPENDS-ruby = ${BUILD_PKGPATH},-main=${V}
RUN_DEPENDS-ruby = ${MODRUBY_RUN_DEPENDS}
WANTLIB-ruby = ${COMPILER_LIBCXX} c m marisa pthread
.endif .endif
AUTOCONF_VERSION = 2.69 AUTOCONF_VERSION = 2.69
@ -48,6 +72,14 @@ CONFIGURE_ARGS += --enable-sse2
.endif .endif
post-build: 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} .if ${BUILD_PACKAGES:M-python}
cd ${WRKDIST}/bindings && make swig-python cd ${WRKDIST}/bindings && make swig-python
cd ${WRKDIST}/bindings/python && \ cd ${WRKDIST}/bindings/python && \
@ -55,11 +87,27 @@ post-build:
--include-dirs=${WRKSRC}/include/ \ --include-dirs=${WRKSRC}/include/ \
--library-dirs=${WRKSRC}/lib/marisa/.libs --library-dirs=${WRKSRC}/lib/marisa/.libs
.endif .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: post-install:
.if ${BUILD_PACKAGES:M-perl}
cd ${WRKDIST}/bindings/perl && \
${MAKE} ${MAKE_FLAGS} install
.endif
.if ${BUILD_PACKAGES:M-python} .if ${BUILD_PACKAGES:M-python}
cd ${WRKDIST}/bindings/python && \ cd ${WRKDIST}/bindings/python && \
${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL} ${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL}
.endif .endif
.if ${BUILD_PACKAGES:M-ruby}
cd ${WRKDIST}/bindings/ruby && \
${MAKE} ${MAKE_FLAGS} install INSTALL_PROG="${INSTALL_SCRIPT}"
.endif
.include <bsd.port.mk> .include <bsd.port.mk>

View File

@ -0,0 +1 @@
marisa-trie bindings for Perl (SWIG)

View File

@ -0,0 +1 @@
marisa-trie bindings for Ruby (SWIG)

View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PLIST-perl,v 1.1 2021/11/26 13:35:06 inoguchi Exp $
${P5ARCH}/
${P5ARCH}/auto/
${P5ARCH}/auto/marisa/
@so ${P5ARCH}/auto/marisa/marisa.so
@comment ${P5ARCH}/benchmark.pl
${P5ARCH}/marisa.pm
@comment ${P5ARCH}/sample.pl

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PLIST-ruby,v 1.1 2021/11/26 13:35:06 inoguchi Exp $
@so ${MODRUBY_SITEARCHDIR}/marisa.so