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

This commit is contained in:
Yuri Victorovich 2019-12-14 16:48:35 +00:00
parent 7efafe3cdc
commit 3452f824a9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=520132
2 changed files with 29 additions and 7 deletions

View File

@ -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>

View File

@ -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', ':'))