Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-14 Thread Kinichiro Inoguchi
On Mon, Sep 13, 2021 at 02:22:38PM +0100, Stuart Henderson wrote:
> On 2021/09/12 23:45, Kinichiro Inoguchi wrote:
> > - Added "REVISION-main=0".
> >   I didn't add REVISION-main with my last diff since I thought 
> > 'libmarisa-main'
> >   would be the first revision but it was wrong.
> 
> That would be correct if the PKGNAME changed, but it doesn't, it is still
> "libmarisa-$VERSION".
> 
> > +PKGNAME-python =   libmarisa-python-${V}
> 
> Please set this to py3-libmarisa-${V}
> 
> > +.if ${BUILD_PACKAGES:M-python}
> > +BUILD_DEPENDS =devel/swig
> 
> and please use BUILD_DEPENDS +=, not just =. Just defense against adding
> a BUILD_DEPENDS for the non-Python version later.
> 
> OK sthen@ with those two changes.

I've committed with your two inputs, thanks for your comments and advise.
And, SASANO-san, thanks for your understanding, and go ahead your libskk!



Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-13 Thread Stuart Henderson
On 2021/09/12 23:45, Kinichiro Inoguchi wrote:
> - Added "REVISION-main=0".
>   I didn't add REVISION-main with my last diff since I thought 
> 'libmarisa-main'
>   would be the first revision but it was wrong.

That would be correct if the PKGNAME changed, but it doesn't, it is still
"libmarisa-$VERSION".

> +PKGNAME-python = libmarisa-python-${V}

Please set this to py3-libmarisa-${V}

> +.if ${BUILD_PACKAGES:M-python}
> +BUILD_DEPENDS =  devel/swig

and please use BUILD_DEPENDS +=, not just =. Just defense against adding
a BUILD_DEPENDS for the non-Python version later.

OK sthen@ with those two changes.



Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-13 Thread SASANO Takayoshi
Hello,

> This is just my thoughts, but this could be a subpackage of libmarisa since
> it uses the same dist file, and libxml does the same kind of thing.

I agree your opinion.
In fact I tryed it but failed, so separate bindings from library.

You are going to work to solve this issue, please go ahead.
Thanks!

-- 
SASANO Takayoshi (JG1UAA) 



Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-12 Thread Kinichiro Inoguchi
On Sun, Sep 12, 2021 at 02:41:26PM +0100, Stuart Henderson wrote:
> On 2021/09/12 14:41, Stuart Henderson wrote:
> > - please merge the ".if ${BUILD_PACKAGES:M-python}" blocks
> > 
> > - the BUILD_DEPENDS on lang/python is set automatically by the python module
> > and shouldn't be listed separately
> > 
> > - ${BUILD_PKGPATH}-main=${V} should be ${BUILD_PKGPATH},-main=${V}
> > (the , is missing), but a LIB_DEPENDS entry is only valid if there is a
> > WANTLIB referencing a library from the dependency, so either a WANTLIB
> > entry is missing or it should be a RUN_DEPENDS (i didn't build-test;
> > run "make port-lib-depends-check" and add the WANTLIB if it complains)
> > 
> > - post-install should not hardcode /usr/local. I think you should probably
> > use "${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL}" here.
> > 
> > - pkg/PLIST-main requires "@pkgpath textproc/libmarisa" otherwise the new
> > subpackage won't be considered by pkg_add as an update for the old
> > "non-subpackaged" version
> > 
> 
> ..also it needs "REVISION-main=0"

Thanks for checking this.

- Merged ".if ${BUILD_PACKAGES:M-python}" blocks into one.

- Removed "lang/python/${MODPY_VERSION}" from BUILD_DEPENDS.

- Added "," (= "${BUILD_PKGPATH},-main=${V}").
  Also added "m marisa" to WANTLIB-python after checking with
  "make port-lib-depends-check". I should run this before posting, sorry.

- ${MODPY_DISTUTILS_INSTALL} works great as I intended!

- Added "@pkgpath textproc/libmarisa" to pkg/PLIST-main.
  I had no idea about this. Thanks for telling me this.

- Added "REVISION-main=0".
  I didn't add REVISION-main with my last diff since I thought 'libmarisa-main'
  would be the first revision but it was wrong.

I had built and install this on amd64 and tested with
"bindings/python/sample.py", it ran with no error.

Index: textproc/libmarisa/Makefile
===
RCS file: /cvs/ports/textproc/libmarisa/Makefile,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 Makefile
--- textproc/libmarisa/Makefile 11 Sep 2021 07:55:18 -  1.1
+++ textproc/libmarisa/Makefile 12 Sep 2021 14:18:54 -
@@ -1,9 +1,13 @@
 # $OpenBSD: Makefile,v 1.1 2021/09/11 07:55:18 inoguchi Exp $
 
-COMMENT =  C++ library for MARISA matching algorithm
+COMMENT-main = C++ library for MARISA matching algorithm
+COMMENT-python =   marisa-trie bindings for Python (SWIG)
 
-V =0.2.6
-PKGNAME =  libmarisa-${V}
+V =0.2.6
+PKGNAME-main = libmarisa-${V}
+PKGNAME-python =   libmarisa-python-${V}
+
+REVISION-main =0
 
 GH_ACCOUNT =   s-yata
 GH_PROJECT =   marisa-trie
@@ -18,7 +22,21 @@ MAINTAINER = Yifei Zhan 
+
+.if ${BUILD_PACKAGES:M-python}
+BUILD_DEPENDS =devel/swig
+MODULES += lang/python
+LIB_DEPENDS-python =   ${BUILD_PKGPATH},-main=${V} ${MODPY_LIB_DEPENDS}
+WANTLIB-python =   ${COMPILER_LIBCXX} ${MODPY_WANTLIB} m marisa
+.endif
 
 AUTOCONF_VERSION = 2.69
 AUTOMAKE_VERSION = 1.15
@@ -27,6 +45,21 @@ CONFIGURE_ARGS = CXX="${CXX}" CXXFLAGS="
 
 .if ${MACHINE_ARCH} == "amd64"
 CONFIGURE_ARGS +=  --enable-sse2
+.endif
+
+post-build:
+.if ${BUILD_PACKAGES:M-python}
+   cd ${WRKDIST}/bindings && make swig-python
+   cd ${WRKDIST}/bindings/python && \
+   ${MODPY_BIN} setup.py build_ext \
+   --include-dirs=${WRKSRC}/include/ \
+   --library-dirs=${WRKSRC}/lib/marisa/.libs
+.endif
+
+post-install:
+.if ${BUILD_PACKAGES:M-python}
+   cd ${WRKDIST}/bindings/python && \
+   ${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL}
 .endif
 
 .include 
Index: textproc/libmarisa/pkg/DESCR
===
RCS file: textproc/libmarisa/pkg/DESCR
diff -N textproc/libmarisa/pkg/DESCR
--- textproc/libmarisa/pkg/DESCR11 Sep 2021 07:55:18 -  1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,5 +0,0 @@
-Matching Algorithm with Recursively Implemented StorAge (MARISA)
-is a static and space-efficient trie data structure. And libmarisa
-is a C++ library to provide an implementation of MARISA. Also, the
-package of libmarisa contains a set of command line tools for
-building and operating a MARISA-based dictionary.
Index: textproc/libmarisa/pkg/DESCR-main
===
RCS file: textproc/libmarisa/pkg/DESCR-main
diff -N textproc/libmarisa/pkg/DESCR-main
--- /dev/null   1 Jan 1970 00:00:00 -
+++ textproc/libmarisa/pkg/DESCR-main   12 Sep 2021 14:18:54 -
@@ -0,0 +1,5 @@
+Matching Algorithm with Recursively Implemented StorAge (MARISA)
+is a static and space-efficient trie data structure. And libmarisa
+is a C++ library to provide an implementation of MARISA. Also, the
+package of libmarisa contains a set of command line tools for
+building and operating a MARISA-based dictionary.
Index: textproc/libmarisa/pkg/DESCR-python

Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-12 Thread Stuart Henderson
On 2021/09/12 14:41, Stuart Henderson wrote:
> - please merge the ".if ${BUILD_PACKAGES:M-python}" blocks
> 
> - the BUILD_DEPENDS on lang/python is set automatically by the python module
> and shouldn't be listed separately
> 
> - ${BUILD_PKGPATH}-main=${V} should be ${BUILD_PKGPATH},-main=${V}
> (the , is missing), but a LIB_DEPENDS entry is only valid if there is a
> WANTLIB referencing a library from the dependency, so either a WANTLIB
> entry is missing or it should be a RUN_DEPENDS (i didn't build-test;
> run "make port-lib-depends-check" and add the WANTLIB if it complains)
> 
> - post-install should not hardcode /usr/local. I think you should probably
> use "${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL}" here.
> 
> - pkg/PLIST-main requires "@pkgpath textproc/libmarisa" otherwise the new
> subpackage won't be considered by pkg_add as an update for the old
> "non-subpackaged" version
> 

..also it needs "REVISION-main=0"



Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-12 Thread Stuart Henderson
- please merge the ".if ${BUILD_PACKAGES:M-python}" blocks

- the BUILD_DEPENDS on lang/python is set automatically by the python module
and shouldn't be listed separately

- ${BUILD_PKGPATH}-main=${V} should be ${BUILD_PKGPATH},-main=${V}
(the , is missing), but a LIB_DEPENDS entry is only valid if there is a
WANTLIB referencing a library from the dependency, so either a WANTLIB
entry is missing or it should be a RUN_DEPENDS (i didn't build-test;
run "make port-lib-depends-check" and add the WANTLIB if it complains)

- post-install should not hardcode /usr/local. I think you should probably
use "${MODPY_BIN} setup.py ${MODPY_DISTUTILS_INSTALL}" here.

- pkg/PLIST-main requires "@pkgpath textproc/libmarisa" otherwise the new
subpackage won't be considered by pkg_add as an update for the old
"non-subpackaged" version



Re: [NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-12 Thread Kinichiro Inoguchi
On Sun, Sep 12, 2021 at 11:57:11AM +0900, SASANO Takayoshi wrote:
> Hi,
> 
> marisa-0.2.6 trie library is now imported to textproc/libmarisa,
> so here is the Python(3) binding will be settled at textproc/py-marisa.
> 
> this is needed to build libkkc.
> 
> 
> thanks to inoguchi@ that telling me about libmarisa is already posted.
> 
> -- 
> SASANO Takayoshi (JG1UAA) 
> 


> 

Hello,

This is just my thoughts, but this could be a subpackage of libmarisa since
it uses the same dist file, and libxml does the same kind of thing.

Use MULTI_PACKAGES.
Rename DESCR and PLIST to DESCR-main and PLIST-main.
Add DESCR-python and PLIST-python.
This diff adds python bindings only, and I think we can add perl and ruby
bindings too.

Index: textproc/libmarisa/Makefile
===
RCS file: /cvs/ports/textproc/libmarisa/Makefile,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 Makefile
--- textproc/libmarisa/Makefile 11 Sep 2021 07:55:18 -  1.1
+++ textproc/libmarisa/Makefile 12 Sep 2021 12:57:36 -
@@ -1,9 +1,11 @@
 # $OpenBSD: Makefile,v 1.1 2021/09/11 07:55:18 inoguchi Exp $
 
-COMMENT =  C++ library for MARISA matching algorithm
+COMMENT-main = C++ library for MARISA matching algorithm
+COMMENT-python =   marisa-trie bindings for Python (SWIG)
 
-V =0.2.6
-PKGNAME =  libmarisa-${V}
+V =0.2.6
+PKGNAME-main = libmarisa-${V}
+PKGNAME-python =   libmarisa-python-${V}
 
 GH_ACCOUNT =   s-yata
 GH_PROJECT =   marisa-trie
@@ -18,7 +20,25 @@ MAINTAINER = Yifei Zhan 
+
+.if ${BUILD_PACKAGES:M-python}
+BUILD_DEPENDS =devel/swig
+.endif
+
+.if ${BUILD_PACKAGES:M-python}
+MODULES += lang/python
+BUILD_DEPENDS +=   lang/python/${MODPY_VERSION}
+LIB_DEPENDS-python =   ${BUILD_PKGPATH}-main=${V} ${MODPY_LIB_DEPENDS}
+WANTLIB-python =   ${COMPILER_LIBCXX} ${MODPY_WANTLIB}
+.endif
 
 AUTOCONF_VERSION = 2.69
 AUTOMAKE_VERSION = 1.15
@@ -27,6 +47,21 @@ CONFIGURE_ARGS = CXX="${CXX}" CXXFLAGS="
 
 .if ${MACHINE_ARCH} == "amd64"
 CONFIGURE_ARGS +=  --enable-sse2
+.endif
+
+post-build:
+.if ${BUILD_PACKAGES:M-python}
+   cd ${WRKDIST}/bindings && make swig-python
+   cd ${WRKDIST}/bindings/python && \
+   ${MODPY_BIN} setup.py build_ext \
+   --include-dirs=${WRKSRC}/include/ \
+   --library-dirs=${WRKSRC}/lib/marisa/.libs
+.endif
+
+post-install:
+.if ${BUILD_PACKAGES:M-python}
+   cd ${WRKDIST}/bindings/python && \
+   ${MODPY_BIN} setup.py install --prefix=${WRKINST}/usr/local
 .endif
 
 .include 
Index: textproc/libmarisa/pkg/DESCR
===
RCS file: textproc/libmarisa/pkg/DESCR
diff -N textproc/libmarisa/pkg/DESCR
--- textproc/libmarisa/pkg/DESCR11 Sep 2021 07:55:18 -  1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,5 +0,0 @@
-Matching Algorithm with Recursively Implemented StorAge (MARISA)
-is a static and space-efficient trie data structure. And libmarisa
-is a C++ library to provide an implementation of MARISA. Also, the
-package of libmarisa contains a set of command line tools for
-building and operating a MARISA-based dictionary.
Index: textproc/libmarisa/pkg/DESCR-main
===
RCS file: textproc/libmarisa/pkg/DESCR-main
diff -N textproc/libmarisa/pkg/DESCR-main
--- /dev/null   1 Jan 1970 00:00:00 -
+++ textproc/libmarisa/pkg/DESCR-main   12 Sep 2021 12:57:36 -
@@ -0,0 +1,5 @@
+Matching Algorithm with Recursively Implemented StorAge (MARISA)
+is a static and space-efficient trie data structure. And libmarisa
+is a C++ library to provide an implementation of MARISA. Also, the
+package of libmarisa contains a set of command line tools for
+building and operating a MARISA-based dictionary.
Index: textproc/libmarisa/pkg/DESCR-python
===
RCS file: textproc/libmarisa/pkg/DESCR-python
diff -N textproc/libmarisa/pkg/DESCR-python
--- /dev/null   1 Jan 1970 00:00:00 -
+++ textproc/libmarisa/pkg/DESCR-python 12 Sep 2021 12:57:36 -
@@ -0,0 +1 @@
+marisa-trie bindings for Python (SWIG)
Index: textproc/libmarisa/pkg/PLIST
===
RCS file: textproc/libmarisa/pkg/PLIST
diff -N textproc/libmarisa/pkg/PLIST
--- textproc/libmarisa/pkg/PLIST11 Sep 2021 07:55:18 -  1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,25 +0,0 @@
-@comment $OpenBSD: PLIST,v 1.1 2021/09/11 07:55:18 inoguchi Exp $
-@bin bin/marisa-benchmark
-@bin bin/marisa-build
-@bin bin/marisa-common-prefix-search
-@bin bin/marisa-dump
-@bin bin/marisa-lookup
-@bin bin/marisa-predictive-search
-@bin bin/marisa-reverse-lookup
-include/marisa/
-include/marisa.h
-include/marisa/agent.h
-include/marisa/base.h
-include/marisa/exception.h
-include/marisa/iostream.h

[NEW] textproc/py-marisa (previously posted as devel/py-marisa)

2021-09-11 Thread SASANO Takayoshi
Hi,

marisa-0.2.6 trie library is now imported to textproc/libmarisa,
so here is the Python(3) binding will be settled at textproc/py-marisa.

this is needed to build libkkc.


thanks to inoguchi@ that telling me about libmarisa is already posted.

-- 
SASANO Takayoshi (JG1UAA) 



py-marisa.tgz
Description: Binary data