Re: Adding python bindings to link-grammar

2015-10-24 Thread Fred

Any comments on enabling python bindings to link-grammar?

Cheers

Fred

On 09/21/15 12:28, Fred wrote:

Hi Ports@

The following diff allows the building of the python bindings for
link-grammar, but to get it to work I have to do:

ln -fs _clinkgrammar.so.7.5 _clinkgrammar.so

in the /usr/local/lib/python2.7/site-packages/linkgrammar/ directory.

Should I add a post-install command to do this?

There is also a tests.py (which passes) and an example.py file that is
available in the tarball but is not installed as part of the
--enable-python-bindings should I copy them to site-packages/linkgrammar?

Thanks

Fred




Adding python bindings to link-grammar

2015-09-21 Thread Fred

Hi Ports@

The following diff allows the building of the python bindings for 
link-grammar, but to get it to work I have to do:


ln -fs _clinkgrammar.so.7.5 _clinkgrammar.so

in the /usr/local/lib/python2.7/site-packages/linkgrammar/ directory.

Should I add a post-install command to do this?

There is also a tests.py (which passes) and an example.py file that is 
available in the tarball but is not installed as part of the 
--enable-python-bindings should I copy them to site-packages/linkgrammar?


Thanks

Fred
Index: Makefile
===
RCS file: /cvs/ports/textproc/link-grammar/Makefile,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile
--- Makefile	28 May 2015 10:17:25 -	1.17
+++ Makefile	20 Sep 2015 19:20:16 -
@@ -1,19 +1,21 @@
-# $OpenBSD: Makefile,v 1.17 2015/05/28 10:17:25 pascal Exp $
+# $OpenBSD:$
 
 ONLY_FOR_ARCHS-java =	i386 amd64
 COMMENT-main =		syntactic parser of different languages
 COMMENT-java =		Java bindings for link-grammar
+COMMENT-python =		Python bindings for link-grammar
 VERSION =		5.2.5
 DISTNAME =		link-grammar-${VERSION}
 PKGNAME-main =		${DISTNAME}
 PKGNAME-java =		link-grammar-java-${VERSION}
+PKGNAME-python =		link-grammar-python-${VERSION}
+REVISION-python =		0
 REVISION-java =		0
 REVISION-main =		0
 
 SHARED_LIBS +=  minisat  0.0  # 2.0
 SHARED_LIBS +=  sat-solver   1.0  # 4.0
 SHARED_LIBS +=  link-grammar 3.0  # 7.0
-SHARED_LIBS +=  link-grammar-java3.0  # 7.0
 
 CATEGORIES =		textproc
 
@@ -25,8 +27,10 @@ PERMIT_PACKAGE_CDROM =	Yes
 cWANTLIB += ${MODGETTEXT_WANTLIB} aspell m pthread sqlite3
 WANTLIB-main += ${cWANTLIB} ${MODGCC4_CPPWANTLIB} c
 WANTLIB-java += ${cWANTLIB} link-grammar minisat sat-solver
+WANTLIB-python += ${cWANTLIB} ${MODPY_WANTLIB} \
+		 link-grammar minisat sat-solver estdc++ util
 
-MASTER_SITES =		http://www.abisource.com/downloads/link-grammar/${VERSION}/
+MASTER_SITES =	http://www.abisource.com/downloads/link-grammar/${VERSION}/
 
 MODULES =		devel/gettext
 
@@ -35,8 +39,8 @@ MODULES +=		gcc4
 MODGCC4_ARCHS =		*
 MODGCC4_LANGS =		c++
 
-MULTI_PACKAGES =	-main -java
-PSEUDO_FLAVORS =	no_java
+MULTI_PACKAGES =	-main -java -python
+PSEUDO_FLAVORS =	no_java no_python
 
 .include 
 
@@ -48,8 +52,11 @@ LIB_DEPENDS-main =	${LIB_DEPENDS} \
 LIB_DEPENDS-java =	${MODGETTEXT_LIB_DEPENDS} \
 			${BUILD_PKGPATH},-main
 
+LIB_DEPENDS-python = ${BUILD_PKGPATH},-main
+
 RUN_DEPENDS-main = 	${MODGETTEXT_RUN_DEPENDS}
 RUN_DEPENDS-java =	${MODJAVA_RUN_DEPENDS}
+RUN_DEPENDS-python =	${MODPY_RUN_DEPENDS}
 
 SUBST_VARS =		VERSION
 
@@ -66,9 +73,15 @@ CONFIGURE_ARGS =	${CONFIGURE_SHARED}
 .if ${BUILD_PACKAGES:M-java}
 MODULES +=		java
 MODJAVA_VER =		1.6+
+SHARED_LIBS +=  link-grammar-java3.0  # 7.0
 BUILD_DEPENDS +=	devel/apache-ant
 .else
 CONFIGURE_ARGS +=	--disable-java-bindings
+.endif
+
+.if ${BUILD_PACKAGES:M-python}
+MODULES+=	lang/python
+CONFIGURE_ARGS +=	--enable-python-bindings
 .endif
 
 pre-configure:
Index: pkg/DESCR-python
===
RCS file: pkg/DESCR-python
diff -N pkg/DESCR-python
--- /dev/null	1 Jan 1970 00:00:00 -
+++ pkg/DESCR-python	20 Sep 2015 19:20:16 -
@@ -0,0 +1,2 @@
+This package contains Python bindings to Link Grammar Parser, see the
+link-grammar package.
Index: pkg/PLIST-java
===
RCS file: /cvs/ports/textproc/link-grammar/pkg/PLIST-java,v
retrieving revision 1.5
diff -u -p -r1.5 PLIST-java
--- pkg/PLIST-java	26 Jun 2014 08:33:27 -	1.5
+++ pkg/PLIST-java	20 Sep 2015 19:20:16 -
@@ -1,7 +1,6 @@
 @comment $OpenBSD: PLIST-java,v 1.5 2014/06/26 08:33:27 ajacoutot Exp $
 lib/liblink-grammar-java.a
 lib/liblink-grammar-java.la
-@lib lib/liblink-grammar-java.so.${LIBlink-grammar-java_VERSION}
 share/java/
 share/java/linkgrammar-${VERSION}.jar
 share/java/linkgrammar.jar
Index: pkg/PLIST-main
===
RCS file: /cvs/ports/textproc/link-grammar/pkg/PLIST-main,v
retrieving revision 1.13
diff -u -p -r1.13 PLIST-main
--- pkg/PLIST-main	2 Feb 2015 10:15:41 -	1.13
+++ pkg/PLIST-main	20 Sep 2015 19:20:16 -
@@ -5,6 +5,7 @@ include/link-grammar/dict-api.h
 include/link-grammar/dict-structures.h
 include/link-grammar/link-features.h
 include/link-grammar/link-includes.h
+@lib lib/liblink-grammar-java.so.${LIBlink-grammar-java_VERSION}
 lib/liblink-grammar.a
 lib/liblink-grammar.la
 @lib lib/liblink-grammar.so.${LIBlink-grammar_VERSION}
Index: pkg/PLIST-python
===
RCS file: pkg/PLIST-python
diff -N pkg/PLIST-python
--- /dev/null	1 Jan 1970 00:00:00 -
+++ pkg/PLIST-python	20 Sep 2015 19:20:16 -
@@ -0,0 +1,17 @@
+@comment $OpenBSD$
+lib/python2.7/
+lib/python2.7/site-packages/
+lib/python2.7/site-packages/linkgrammar/