Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Dec 2019 16:48:35 +0000 (UTC)
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r520132 - in head/misc/py-tvm: . files
Message-ID:  <201912141648.xBEGmZDT023403@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yuri
Date: Sat Dec 14 16:48:35 2019
New Revision: 520132
URL: https://svnweb.freebsd.org/changeset/ports/520132

Log:
  misc/py-tvm: Add the 'topi' add-on python module that is required to also be built by py-tvm

Added:
  head/misc/py-tvm/files/
  head/misc/py-tvm/files/patch-python_tvm___ffi_libinfo.py   (contents, props changed)
Modified:
  head/misc/py-tvm/Makefile

Modified: head/misc/py-tvm/Makefile
==============================================================================
--- head/misc/py-tvm/Makefile	Sat Dec 14 16:26:07 2019	(r520131)
+++ head/misc/py-tvm/Makefile	Sat Dec 14 16:48:35 2019	(r520132)
@@ -3,6 +3,7 @@
 PORTNAME=	tvm
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.6.0
+PORTREVISION=	1
 CATEGORIES=	misc # machine-learning
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 
@@ -22,23 +23,33 @@ USES=		python
 USE_GITHUB=	yes
 GH_ACCOUNT=	apache
 GH_PROJECT=	incubator-tvm
-USE_PYTHON=	distutils autoplist
+USE_PYTHON=	distutils noegginfo
 GH_TUPLE=	dmlc:dlpack:0acb731:dlpack/3rdparty/dlpack \
 		dmlc:dmlc-core:808f485:dmlc_core/3rdparty/dmlc-core
 
 BUILD_WRKSRC=	${WRKSRC}/python
 INSTALL_WRKSRC=	${WRKSRC}/python
+BUILD_WRKSRC_TOPI=	${WRKSRC}/topi/python
+INSTALL_WRKSRC_TOPI=	${WRKSRC}/topi/python
 
-POST_PLIST=	fix-plist # https://github.com/apache/incubator-tvm/issues/4411
+MAKE_ENV+=	FREEBSD_LIBRARY_PATH=${LOCALBASE}/lib
 
 post-patch:
-	@${REINPLACE_CMD} 's|dll_path = \[\]|dll_path = ["${LOCALBASE}/lib"]|' ${BUILD_WRKSRC}/tvm/_ffi/libinfo.py
+	@${REINPLACE_CMD} 's|dll_path = \[\]|dll_path = ["${LOCALBASE}/lib"]|' ${WRKSRC}/python/tvm/_ffi/libinfo.py
 
-fix-plist:
-	@${REINPLACE_CMD} -e "s|^tvm.*||" ${TMPPLIST}
+post-configure:
+	@cd ${BUILD_WRKSRC_TOPI} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_CONFIGURE_TARGET} ${PYDISTUTILS_CONFIGUREARGS}
 
-post-stage:
-	@${RM} -r ${STAGEDIR}${PREFIX}/tvm # see fix-plist
+post-build:
+	@cd ${BUILD_WRKSRC_TOPI} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}
+
+post-install:
+	@cd ${INSTALL_WRKSRC_TOPI} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}
+	@${RM} -r ${STAGEDIR}${PREFIX}/tvm ${STAGEDIR}${PREFIX}/topi
+	@${RM} ${STAGEDIR}${PREFIX}/topi/libtvm_topi.so
 	@${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name "*.so" | ${XARGS} ${STRIP_CMD}
+	# autoplist because 1) python's autoplist is inaccurate for tvm and 2) because there's the add-on package topi
+	@cd ${STAGEDIR}${PREFIX} && \
+		${FIND} ${PYTHON_SITELIBDIR:C|${LOCALBASE}/||} -type f -or -type l >> ${TMPPLIST}
 
 .include <bsd.port.mk>

Added: head/misc/py-tvm/files/patch-python_tvm___ffi_libinfo.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/py-tvm/files/patch-python_tvm___ffi_libinfo.py	Sat Dec 14 16:48:35 2019	(r520132)
@@ -0,0 +1,11 @@
+--- python/tvm/_ffi/libinfo.py.orig	2019-11-27 03:24:12 UTC
++++ python/tvm/_ffi/libinfo.py
+@@ -72,6 +72,8 @@ def find_lib_path(name=None, search_path=None, optiona
+     if sys.platform.startswith('linux'):
+         dll_path.extend(split_env_var('LD_LIBRARY_PATH', ':'))
+         dll_path.extend(split_env_var('PATH', ':'))
++    elif sys.platform.startswith('freebsd'):
++        dll_path.extend(split_env_var('FREEBSD_LIBRARY_PATH', ':'))
+     elif sys.platform.startswith('darwin'):
+         dll_path.extend(split_env_var('DYLD_LIBRARY_PATH', ':'))
+         dll_path.extend(split_env_var('PATH', ':'))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912141648.xBEGmZDT023403>