misc/py-tvm: Add patches for FreeBSD

This commit is contained in:
Yuri Victorovich 2019-12-15 02:37:02 +00:00
parent 817f7dbc20
commit 2fee608459
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=520153
3 changed files with 52 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= tvm
DISTVERSIONPREFIX= v
DISTVERSION= 0.6.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= misc # machine-learning
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

View File

@ -0,0 +1,38 @@
--- python/tvm/contrib/cc.py.orig 2019-11-27 03:24:12 UTC
+++ python/tvm/contrib/cc.py
@@ -27,7 +27,7 @@ from .util import tempdir
def create_shared(output,
objects,
options=None,
- cc="g++"):
+ cc="c++"):
"""Create shared library.
Parameters
@@ -44,7 +44,7 @@ def create_shared(output,
cc : Optional[str]
The compiler command.
"""
- if sys.platform == "darwin" or sys.platform.startswith("linux"):
+ if sys.platform == "darwin" or sys.platform.startswith("linux") or sys.platform.startswith("freebsd"):
_linux_compile(output, objects, options, cc)
elif sys.platform == "win32":
_windows_shared(output, objects, options)
@@ -56,7 +56,7 @@ def create_shared(output,
create_shared.output_format = "so" if sys.platform != "win32" else "dll"
-def build_create_shared_func(options=None, compile_cmd="g++"):
+def build_create_shared_func(options=None, compile_cmd="c++"):
"""Build create_shared function with particular default options and compile_cmd.
Parameters
@@ -108,7 +108,7 @@ def cross_compiler(compile_func, base_options=None, ou
return _fcompile
-def _linux_compile(output, objects, options, compile_cmd="g++"):
+def _linux_compile(output, objects, options, compile_cmd="c++"):
cmd = [compile_cmd]
if output.endswith(".so") or output.endswith(".dylib"):
cmd += ["-shared", "-fPIC"]

View File

@ -0,0 +1,13 @@
--- python/tvm/micro/base.py.orig 2019-12-14 17:04:12 UTC
+++ python/tvm/micro/base.py
@@ -87,8 +87,8 @@ class Session:
Raises error if not supported.
"""
- if not sys.platform.startswith("linux"):
- raise RuntimeError("microTVM is currently only supported on Linux")
+ if not sys.platform.startswith("linux") and not sys.platform.startswith("freebsd"):
+ raise RuntimeError("microTVM is currently only supported on Linux and FreeBSD")
# TODO(weberlo): Add 32-bit support.
# It's primarily the compilation pipeline that isn't compatible.
if sys.maxsize <= 2**32: