From rafan@svm.csie.ntu.edu.tw  Mon Nov 15 18:57:38 2004
Return-Path: <rafan@svm.csie.ntu.edu.tw>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5C8BC16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Nov 2004 18:57:38 +0000 (GMT)
Received: from svm.csie.ntu.edu.tw (svm.csie.ntu.edu.tw [140.112.90.75])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 06F6543D3F
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Nov 2004 18:57:37 +0000 (GMT)
	(envelope-from rafan@svm.csie.ntu.edu.tw)
Received: from svm.csie.ntu.edu.tw (localhost.csie.ntu.edu.tw [127.0.0.1])
	by svm.csie.ntu.edu.tw (8.13.1/8.13.1) with ESMTP id iAFIv0Bb047468;
	Tue, 16 Nov 2004 02:57:00 +0800 (CST)
	(envelope-from rafan@svm.csie.ntu.edu.tw)
Received: (from rafan@localhost)
	by svm.csie.ntu.edu.tw (8.13.1/8.13.1/Submit) id iAFIuqTN047467;
	Tue, 16 Nov 2004 02:56:52 +0800 (CST)
	(envelope-from rafan)
Message-Id: <200411151856.iAFIuqTN047467@svm.csie.ntu.edu.tw>
Date: Tue, 16 Nov 2004 02:56:52 +0800 (CST)
From: rafan <rafan@infor.org>
Reply-To: rafan <rafan@infor.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: me@davidyu.org
Subject: [PATCH] science/libsvm: update to 2.7, python iface to slave port
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73981
>Category:       ports
>Synopsis:       [PATCH] science/libsvm: update to 2.7, python iface to slave port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 15 19:00:54 GMT 2004
>Closed-Date:    Sat Dec 11 04:55:23 GMT 2004
>Last-Modified:  Sat Dec 11 04:55:23 GMT 2004
>Originator:     rafan
>Release:        FreeBSD 5.3-BETA5 i386
>Organization:
NTU CSIE
>Environment:
System: FreeBSD svm.csie.ntu.edu.tw 5.3-BETA5 FreeBSD 5.3-BETA5 #13: Mon Sep 20 02:31:32 CST 2004 root@svm.csie.ntu.edu.tw:/usr/obj/usr/src/sys/SVM i386


	
>Description:
	LIBSVM 2.7 has been released this month. Update ports
	and make changes:

	1. install tools
	2. make python interface to a slave port, like subverion
	3. respect to CXX and CFLAGS in python/Makefile
	4. take maintainship, I'm much more fimilar with libsvm
	   than David Yu does and David told me he is happy
	   that I can take over.

	I don't know how to make libsvm-python pass `port test'
	since I install python packages to ${PYTHON_SITELIBDIR}
	which is ${LOCALBASE}/..., not prefix with ${PREFIX}...

	On the other hand, libsvm does pass `port test'
>How-To-Repeat:
	
>Fix:

===> Generating patch
===> Viewing diff with less
diff -ruN --exclude=CVS /usr/ports/science/libsvm/Makefile /home/rafan/tmp/ports/libsvm/Makefile
--- /usr/ports/science/libsvm/Makefile	Sun Jun  6 21:27:56 2004
+++ /home/rafan/tmp/ports/libsvm/Makefile	Tue Nov 16 02:44:15 2004
@@ -6,25 +6,49 @@
 #
 
 PORTNAME=	libsvm
-PORTVERSION=	2.5
+PORTVERSION=	2.7
 CATEGORIES=	science math
 MASTER_SITES=	http://www.csie.ntu.edu.tw/~cjlin/libsvm/
 
-MAINTAINER=	me@davidyu.org
+MAINTAINER=	rafan@infor.org
 COMMENT=	A library for Support Vector Machines
 
 .if defined(WITH_PYTHON)
 USE_PYTHON=	yes
-ALL_TARGET=	all py
-MAKE_ARGS+=	PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
+USE_REINPLACE=	yes
 PLIST_SUB+=	LIBSVM_PYTHON=""
 .else
 PLIST_SUB+=	LIBSVM_PYTHON="@comment "
+PYEXAMPLES=	python/cross_validation.py \
+		python/svm_test.py \
+		python/test_cross_validation.py
 .endif
 
+TXT_DOCS=	COPYRIGHT README FAQ.html python/README.python
+.if !defined(NOPORTDOCS)
+PORTDOCS=	${TXT_DOCS}
+.endif
+TOOLS=		python/grid.py python/easy.py
+
+MSG_FILE=	${PKGDIR}/pkg-message
+PKGMESSAGE=	${WRKSRC}/pkg-message
+
 pre-everything::
-.if !defined(WITH_PYTHON)
-	@${ECHO_MSG} "You can install python interface by defining WITH_PYTHON=yes"
+.if defined(WITH_PYTHON)
+	@${ECHO_MSG} "Build with Python interface."
+.else
+	@${ECHO_MSG} "You can enable Python interface by defining WITH_PYTHON."
+.endif
+
+post-patch:
+.if defined(WITH_PYTHON)
+	@${REINPLACE_CMD} -e "s,%%PYTHON_INCLUDEDIR%%,${PYTHON_INCLUDEDIR}," ${WRKSRC}/python/Makefile
+.endif
+	@${SED} 's|%%DATADIR%%|${DATADIR}|g' ${MSG_FILE} > ${PKGMESSAGE}
+
+post-build:
+.if defined(WITH_PYTHON)
+	cd ${WRKSRC}/python; ${MAKE}
 .endif
 
 do-install:
@@ -34,11 +58,24 @@
 .if defined(WITH_PYTHON)
 	${INSTALL_SCRIPT} ${WRKSRC}/python/svm.py ${PYTHON_SITELIBDIR}/
 	${INSTALL_PROGRAM} ${WRKSRC}/python/svmc.so ${PYTHON_SITELIBDIR}/
+	${MKDIR} ${EXAMPLESDIR}
+	for f in ${PYEXAMPLES}; do \
+	  ${INSTALL_DATA} ${WRKSRC}/$$f ${EXAMPLESDIR}; \
+	done
 .endif
+	${MKDIR} ${DATADIR}
+	for f in ${TOOLS}; do \
+	  ${INSTALL_DATA} ${WRKSRC}/$$f ${DATADIR}; \
+	done
 .if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
-	${INSTALL_DATA} ${WRKSRC}/COPYRIGHT ${DOCSDIR}
+	${MKDIR} ${DOCSDIR}
+	${CP} ${WRKSRC}/python/README ${WRKSRC}/python/README.python
+	for f in ${TXT_DOCS}; do \
+	  ${INSTALL_DATA} ${WRKSRC}/$$f ${DOCSDIR}; \
+	done
 .endif
+	@${ECHO} ""
+	@${CAT} ${PKGMESSAGE}
+	@${ECHO} ""
 
 .include <bsd.port.mk>
diff -ruN --exclude=CVS /usr/ports/science/libsvm/distinfo /home/rafan/tmp/ports/libsvm/distinfo
--- /usr/ports/science/libsvm/distinfo	Wed Mar 31 11:10:54 2004
+++ /home/rafan/tmp/ports/libsvm/distinfo	Tue Nov 16 00:40:26 2004
@@ -1,2 +1,2 @@
-MD5 (libsvm-2.5.tar.gz) = 5973401a9b5d9fdd65fc46bdc61a5f9e
-SIZE (libsvm-2.5.tar.gz) = 320549
+MD5 (libsvm-2.7.tar.gz) = b09a9fc273a85ffbfcf25abec16b5ce8
+SIZE (libsvm-2.7.tar.gz) = 437233
diff -ruN --exclude=CVS /usr/ports/science/libsvm/files/patch-Makefile /home/rafan/tmp/ports/libsvm/files/patch-Makefile
--- /usr/ports/science/libsvm/files/patch-Makefile	Tue May 21 23:26:21 2002
+++ /home/rafan/tmp/ports/libsvm/files/patch-Makefile	Tue Nov 16 01:13:55 2004
@@ -1,16 +1,9 @@
---- Makefile.orig	Sat Sep 22 23:04:16 2001
-+++ Makefile	Fri May 10 14:40:09 2002
-@@ -1,5 +1,5 @@
+--- Makefile.orig	Tue Nov 16 00:45:06 2004
++++ Makefile	Tue Nov 16 00:46:01 2004
+@@ -1,5 +1,4 @@
 -CXXC = g++
--CFLAGS = -Wall -O3 -g
-+CXXC = ${CXX}
-+CFLAGS += -g
+-CFLAGS = -Wall -O3 
++CXXC = $(CXX)
  
  all: svm-train svm-predict svm-scale
  
-@@ -13,3 +13,5 @@
- 	$(CXXC) $(CFLAGS) -c svm.cpp
- clean:
- 	rm -f *~ svm.o svm-train svm-predict svm-scale
-+py:
-+	cd python; $(MAKE) PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
diff -ruN --exclude=CVS /usr/ports/science/libsvm/files/patch-python-Makefile /home/rafan/tmp/ports/libsvm/files/patch-python-Makefile
--- /usr/ports/science/libsvm/files/patch-python-Makefile	Thu Jan  1 08:00:00 1970
+++ /home/rafan/tmp/ports/libsvm/files/patch-python-Makefile	Tue Nov 16 01:14:45 2004
@@ -0,0 +1,18 @@
+--- python/Makefile.orig	Wed Mar 24 19:33:46 2004
++++ python/Makefile	Tue Nov 16 01:14:32 2004
+@@ -1,11 +1,11 @@
+-CC = g++
++CC = $(CXX)
+ SWIG ?= swig
+ 
+ #Windows: see ../README ../Makefile.win
+-PYTHON_INCLUDEDIR ?= /usr/include/python2.3
++PYTHON_INCLUDEDIR ?= %%PYTHON_INCLUDEDIR%%
+ 
+-CFLAGS = -O3 -I$(PYTHON_INCLUDEDIR) -I..
+-LDFLAGS = -shared
++CFLAGS += -I$(PYTHON_INCLUDEDIR) -I..
++LDFLAGS += -shared
+ 
+ all: svmc.so
+ 
diff -ruN --exclude=CVS /usr/ports/science/libsvm/libsvm.diff /home/rafan/tmp/ports/libsvm/libsvm.diff
--- /usr/ports/science/libsvm/libsvm.diff	Thu Jan  1 08:00:00 1970
+++ /home/rafan/tmp/ports/libsvm/libsvm.diff	Tue Nov 16 02:47:38 2004
@@ -0,0 +1 @@
+===> Generating patch
diff -ruN --exclude=CVS /usr/ports/science/libsvm/pkg-message /home/rafan/tmp/ports/libsvm/pkg-message
--- /usr/ports/science/libsvm/pkg-message	Thu Jan  1 08:00:00 1970
+++ /home/rafan/tmp/ports/libsvm/pkg-message	Tue Nov 16 02:47:12 2004
@@ -0,0 +1,5 @@
+
+Some useful tools are installed to %%DATADIR%%.
+Most of them are written in Python, please install
+lang/python before trying them.
+
diff -ruN --exclude=CVS /usr/ports/science/libsvm/pkg-plist /home/rafan/tmp/ports/libsvm/pkg-plist
--- /usr/ports/science/libsvm/pkg-plist	Sun Jun  6 21:27:56 2004
+++ /home/rafan/tmp/ports/libsvm/pkg-plist	Tue Nov 16 02:11:08 2004
@@ -1,8 +1,7 @@
 bin/svm-predict
 bin/svm-scale
 bin/svm-train
+%%DATADIR%%/grid.py
+%%DATADIR%%/easy.py
 %%LIBSVM_PYTHON%%%%PYTHON_SITELIBDIR%%/svm.py
 %%LIBSVM_PYTHON%%%%PYTHON_SITELIBDIR%%/svmc.so
-%%PORTDOCS%%%%DOCSDIR%%/README
-%%PORTDOCS%%%%DOCSDIR%%/COPYRIGHT
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
===> Done


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	libsvm-python
#	libsvm-python/pkg-descr
#	libsvm-python/Makefile
#
echo c - libsvm-python
mkdir -p libsvm-python > /dev/null 2>&1
echo x - libsvm-python/pkg-descr
sed 's/^X//' >libsvm-python/pkg-descr << 'END-of-libsvm-python/pkg-descr'
XThis slave port adds Python interface to LIBSVM.
X
XWWW: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
XAuthor: Chih-Chung Chang and Chih-Jen Lin <cjlin@csie.ntu.edu.tw>
END-of-libsvm-python/pkg-descr
echo x - libsvm-python/Makefile
sed 's/^X//' >libsvm-python/Makefile << 'END-of-libsvm-python/Makefile'
X# New ports collection makefile for:   libsvm-python
X# Date Created:                Nov 16 2004
X# Whom:                        rafan@infor.org
X#
X# $FreeBSD$
X#
X
XPKGNAMESUFFIX=	-python
X
XMAINTAINER=	rafan@infor.org
X
XMASTERDIR=	${.CURDIR}/../../science/libsvm
X
XWITH_PYTHON=	yes
X
X.include "${MASTERDIR}/Makefile"
END-of-libsvm-python/Makefile
exit

	


>Release-Note:
>Audit-Trail:

From: David Yu <davidyu@ucsd.edu>
To: freebsd-gnats-submit@FreeBSD.org, rafan@infor.org
Cc:  
Subject: Re: ports/73981: [PATCH] science/libsvm: update to 2.7, python iface
 to slave port
Date: Mon, 15 Nov 2004 21:10:34 -0800

 great!
 
State-Changed-From-To: open->feedback 
State-Changed-By: sem 
State-Changed-When: Sat Dec 11 02:59:03 GMT 2004 
State-Changed-Why:  
Ask submitter for a feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73981 

From: Sergey Matveychuk <sem@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, rafan@infor.org
Cc:  
Subject: Re: ports/73981: [PATCH] science/libsvm: update to 2.7, python iface
 to slave port
Date: Sat, 11 Dec 2004 05:58:56 +0300

 distfile is unfetchable anymore:
 
 => libsvm-2.7.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
 => Attempting to fetch from http://www.csie.ntu.edu.tw/~cjlin/libsvm/.
 fetch: http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-2.7.tar.gz: Not Found
 => Attempting to fetch from 
 ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/.
 fetch: 
 ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/libsvm-2.7.tar.gz: 
 File unavailable (e.g., file not found, no access)
 => Couldn't fetch it - please try to retrieve this
 => port manually into /usr/ports/distfiles/ and try again.
 *** Error code 1
 
 Stop in /usr/ports/science/libsvm.
 
 -- 
 Sem.
 

From: Rong-En Fan <rafan@infor.org>
To: Sergey Matveychuk <sem@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/73981: [PATCH] science/libsvm: update to 2.7, python iface to slave port
Date: Sat, 11 Dec 2004 11:40:37 +0800

 --nFreZHaLTZJo0R7j
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 ok, please change to following:
 
 
 PORTVERSION=3D    2.71
 CATEGORIES=3D     science math
 MASTER_SITES=3D   http://www.csie.ntu.edu.tw/~cjlin/libsvm/ \
                 http://www.csie.ntu.edu.tw/~cjlin/libsvm/oldfiles/
 
 MAINTAINER=3D     rafan@infor.org
 COMMENT=3D        A library for Support Vector Machines
 
 USE_ZIP=3D        yes
 
 changes:
 
 1. use 2.71, instead of 2.7
 2. add another MASTER_SITES, author moves old release to oldfiles/
 3. USE_ZIP since author only save .zip in oldfiles/
 
 distinfo is now:
 
 MD5 (libsvm-2.71.zip) =3D 2c963638a0ae0f2bdcc36afe6fdc173b
 SIZE (libsvm-2.71.zip) =3D 455940
 
 -rafan
 
 On Sat, Dec 11, 2004 at 05:58:56AM +0300, Sergey Matveychuk wrote:
 > distfile is unfetchable anymore:
 >=20
 > =3D> libsvm-2.7.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
 > =3D> Attempting to fetch from http://www.csie.ntu.edu.tw/~cjlin/libsvm/.
 > fetch: http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-2.7.tar.gz: Not Fo=
 und
 > =3D> Attempting to fetch from=20
 > ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/.
 > fetch:=20
 > ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/libsvm-2.7.tar.gz:=20
 > File unavailable (e.g., file not found, no access)
 > =3D> Couldn't fetch it - please try to retrieve this
 > =3D> port manually into /usr/ports/distfiles/ and try again.
 > *** Error code 1
 >=20
 > Stop in /usr/ports/science/libsvm.
 >=20
 > --=20
 > Sem.
 >=20
 
 --nFreZHaLTZJo0R7j
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (FreeBSD)
 
 iD8DBQFBumw0144QkYb9jGgRAspSAJ4jzaxFXqxXiEJDjILtQ1kULothjACeJ0an
 RoNTBf9fp6ta8RVDVxk4Wy4=
 =+agE
 -----END PGP SIGNATURE-----
 
 --nFreZHaLTZJo0R7j--
State-Changed-From-To: feedback->closed 
State-Changed-By: sem 
State-Changed-When: Sat Dec 11 04:53:24 GMT 2004 
State-Changed-Why:  
Commited, thanks! 
But fix README.python removing. 
And add python in port category (to master or slave - it's your choice). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73981 
>Unformatted:
