On Wed, Nov 24, 2021 at 02:31:32PM +0000, Stuart Henderson wrote:
> On 2021/11/24 21:39, Kinichiro Inoguchi wrote:
> > On Wed, Nov 24, 2021 at 08:45:36AM +0000, Stuart Henderson wrote:
> > > On 2021/11/23 17:33, Kinichiro Inoguchi wrote:
> > > > 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?
> > > 
> > > There are some surplus WANTLIB:
> > > 
> > > $ make port-lib-depends-check
> > > 
> > > p5-libmarisa-0.2.6(textproc/libmarisa,-perl):
> > > Extra:  c++.8 c++abi.5 pthread.26
> > > 
> > > py3-libmarisa-0.2.6p0(textproc/libmarisa,-python):
> > > Extra:  python3.9.0
> > > 
> > > ruby-libmarisa-0.2.6(textproc/libmarisa,-ruby):
> > > Extra:  gmp.11 ruby30.0
> > > 
> > > 
> > > Removing those WANTLIB will invalidate the LIB_DEPENDS entries (there 
> > > needs to
> > > be an associated WANTLIB), so those will need to change to RUN_DEPENDS.
> > > 
> > 
> > Thanks for pointing out this.
> > I had checked all WANTLIB and LIB_DEPENDS again and now I saw
> > 'make port-lib-depends-check' finished successfully.
> > I did not add RUN_DEPENDS for this since LIB_DEPENDS is enough.
> > ok?
> 
> There are RUN_DEPENDS for both Python and Ruby in all subpackages:
> 
> $ make dump-vars|grep RUN_DEPENDS
> textproc/libmarisa,-main.RUN_DEPENDS=lang/python/3.9 lang/ruby/3.0
> textproc/libmarisa,-perl.RUN_DEPENDS=lang/python/3.9 lang/ruby/3.0
> textproc/libmarisa,-python.RUN_DEPENDS=lang/python/3.9 lang/ruby/3.0
> textproc/libmarisa,-ruby.RUN_DEPENDS=lang/python/3.9 lang/ruby/3.0
> 
> So you need:
> 
> RUN_DEPENDS-main=     # empty
> RUN_DEPENDS-perl=     # empty
> RUN_DEPENDS-python=   ${MODPY_RUN_DEPENDS}
> RUN_DEPENDS-ruby=     ${MODRUBY_RUN_DEPENDS}
> 
> Also running "make plist" adds new files to PLIST-perl:
> 
> --- pkg/PLIST-perl    Wed Nov 24 14:13:37 2021
> +++ pkg/PLIST-perl.new        Wed Nov 24 14:27:36 2021
> @@ -3,4 +3,6 @@ ${P5ARCH}/
>  ${P5ARCH}/auto/
>  ${P5ARCH}/auto/marisa/
>  @so ${P5ARCH}/auto/marisa/marisa.so
> +${P5ARCH}/benchmark.pl
>  ${P5ARCH}/marisa.pm
> +${P5ARCH}/sample.pl
> 
> I agree with removing them, but it should be explicit so they don't
> get added back in by mistake later. Either add to PLIST with @comment:
> 
> @so ${P5ARCH}/auto/marisa/marisa.so
> @comment ${P5ARCH}/benchmark.pl
> ${P5ARCH}/marisa.pm
> @comment ${P5ARCH}/sample.pl
> 
> or rm in post-install.
> 

Thanks for your review.

Now I added RUN_DEPENDS-* and update PLIST-perl with @comment.
benchmark.pl and sample.pl are sample scripts and I do not think it should be
placed under the ${P5ARCH}/.

I tested build and install on amd64 and works fine.
'make port-lib-depends-check' tells nothing.

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    25 Nov 2021 12:39:32 -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,20 +27,39 @@ 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
 
+RUN_DEPENDS-main =     # empty
 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}
+RUN_DEPENDS-perl =     # empty
+WANTLIB-perl =         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
+LIB_DEPENDS-python =   ${BUILD_PKGPATH},-main=${V}
+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
 
 AUTOCONF_VERSION =     2.69
@@ -48,6 +72,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 +87,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      25 Nov 2021 12:39:32 -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      25 Nov 2021 12:39:32 -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      25 Nov 2021 12:39:32 -0000
@@ -0,0 +1,8 @@
+@comment $OpenBSD: PLIST-perl,v$
+${P5ARCH}/
+${P5ARCH}/auto/
+${P5ARCH}/auto/marisa/
+@so ${P5ARCH}/auto/marisa/marisa.so
+@comment ${P5ARCH}/benchmark.pl
+${P5ARCH}/marisa.pm
+@comment ${P5ARCH}/sample.pl
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      25 Nov 2021 12:39:32 -0000
@@ -0,0 +1,2 @@
+@comment $OpenBSD: PLIST-ruby,v$
+@so ${MODRUBY_SITEARCHDIR}/marisa.so

Reply via email to