git: 6b4cb31396c5 - main - devel/cvise: create port

From: Steve Wills <swills_at_FreeBSD.org>
Date: Sun, 13 Feb 2022 18:00:36 UTC
The branch main has been updated by swills:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6b4cb31396c5b2bba063a409296e015d64b13b5e

commit 6b4cb31396c5b2bba063a409296e015d64b13b5e
Author:     Steve Wills <swills@FreeBSD.org>
AuthorDate: 2022-02-13 17:59:46 +0000
Commit:     Steve Wills <swills@FreeBSD.org>
CommitDate: 2022-02-13 17:59:46 +0000

    devel/cvise: create port
    
    C-Vise is a tool that takes a large C, C++ or OpenCL program that has a
    property of interest (such as triggering a compiler bug) and automatically
    produces a much smaller C/C++ or OpenCL program that has the same property. It
    is intended for use by people who discover and report bugs in compilers and
    other tools that process C/C++ or OpenCL code.
    
    WWW: https://github.com/marxin/cvise
---
 devel/Makefile                   |  1 +
 devel/cvise/Makefile             | 44 +++++++++++++++++++++++++++++++++++
 devel/cvise/distinfo             |  3 +++
 devel/cvise/files/patch-cvise.py | 11 +++++++++
 devel/cvise/pkg-descr            |  7 ++++++
 devel/cvise/pkg-plist            | 50 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 116 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 1424d6312b68..bbc4c4efa590 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -447,6 +447,7 @@
     SUBDIR += cut
     SUBDIR += cutils
     SUBDIR += cutter
+    SUBDIR += cvise
     SUBDIR += cvs
     SUBDIR += cvs+ipv6
     SUBDIR += cvs-devel
diff --git a/devel/cvise/Makefile b/devel/cvise/Makefile
new file mode 100644
index 000000000000..3155f2007c47
--- /dev/null
+++ b/devel/cvise/Makefile
@@ -0,0 +1,44 @@
+PORTNAME=	cvise
+PORTVERSION=	2.4.0
+DISTVERSIONPREFIX=	v
+CATEGORIES=	devel python
+
+MAINTAINER=	swills@FreeBSD.org
+COMMENT=	C-Vise is a super-parallel Python port of the C-Reduce
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pebble>0:devel/py-pebble@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}chardet>0:textproc/py-chardet@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \
+		llvm-config${LLVM_VER}:devel/llvm${LLVM_VER}
+RUN_DEPENDS=	bash:shells/bash \
+		${PYTHON_PKGNAMEPREFIX}pebble>0:devel/py-pebble@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}chardet>0:textproc/py-chardet@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \
+		llvm-config${LLVM_VER}:devel/llvm${LLVM_VER}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-flake8>=0:devel/py-pytest-flake8@${PY_FLAVOR}
+#		gcc:lang/gcc
+# gcc required for tests to pass. framework errors:
+# Error: lang/gcc should not be depended upon. Instead, use USE_GCC.
+# but doesn't support gcc as a test only depends
+# once this is installed, all tests pass for me:
+# 260 passed, 1 skipped in 64.82 seconds
+
+USES=		cmake python:3.6+ shebangfix
+CMAKE_ARGS+=	-DClang_DIR:PATH=${LOCALBASE}/llvm${LLVM_VER}/lib/cmake/clang
+LLVM_VER=	13
+SHEBANG_FILES=	cvise-delta.py cvise.py
+USE_GITHUB=	yes
+GH_ACCOUNT=	marxin
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/cvise.py
+
+do-test:
+	cd ${BUILD_WRKSRC} && pytest
+
+.include <bsd.port.mk>
diff --git a/devel/cvise/distinfo b/devel/cvise/distinfo
new file mode 100644
index 000000000000..27e9b9ff4071
--- /dev/null
+++ b/devel/cvise/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1644767746
+SHA256 (marxin-cvise-v2.4.0_GH0.tar.gz) = 55ae8c39bdbaddba9a2ac1173bef7995e58387bc81f4610125dd1488c8e8b1ae
+SIZE (marxin-cvise-v2.4.0_GH0.tar.gz) = 252810
diff --git a/devel/cvise/files/patch-cvise.py b/devel/cvise/files/patch-cvise.py
new file mode 100644
index 000000000000..e63a3f8051da
--- /dev/null
+++ b/devel/cvise/files/patch-cvise.py
@@ -0,0 +1,11 @@
+--- cvise.py.orig	2022-02-13 16:58:05 UTC
++++ cvise.py
+@@ -283,7 +283,7 @@ if __name__ == '__main__':
+     script = None
+     if args.commands:
+         with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.sh') as script:
+-            script.write('#!/bin/bash\n\n')
++            script.write('#!%%LOCALBASE%%/bin/bash\n\n')
+             script.write(args.commands + '\n')
+         os.chmod(script.name, 0o744)
+         logging.info('Using temporary interestingness test: %s' % script.name)
diff --git a/devel/cvise/pkg-descr b/devel/cvise/pkg-descr
new file mode 100644
index 000000000000..2382e40e65bf
--- /dev/null
+++ b/devel/cvise/pkg-descr
@@ -0,0 +1,7 @@
+C-Vise is a tool that takes a large C, C++ or OpenCL program that has a
+property of interest (such as triggering a compiler bug) and automatically
+produces a much smaller C/C++ or OpenCL program that has the same property. It
+is intended for use by people who discover and report bugs in compilers and
+other tools that process C/C++ or OpenCL code.
+
+WWW: https://github.com/marxin/cvise
diff --git a/devel/cvise/pkg-plist b/devel/cvise/pkg-plist
new file mode 100644
index 000000000000..10707f47de37
--- /dev/null
+++ b/devel/cvise/pkg-plist
@@ -0,0 +1,50 @@
+bin/cvise-delta
+bin/cvise
+libexec/cvise/clang_delta
+libexec/cvise/clex
+libexec/cvise/strlex
+libexec/cvise/topformflat
+%%DATADIR%%/__init__.py
+%%DATADIR%%/cvise.py
+%%DATADIR%%/pass_groups/all.json
+%%DATADIR%%/pass_groups/binary.json
+%%DATADIR%%/pass_groups/delta.json
+%%DATADIR%%/pass_groups/opencl-120.json
+%%DATADIR%%/passes/__init__.py
+%%DATADIR%%/passes/abstract.py
+%%DATADIR%%/passes/balanced.py
+%%DATADIR%%/passes/blank.py
+%%DATADIR%%/passes/clang.py
+%%DATADIR%%/passes/clangbinarysearch.py
+%%DATADIR%%/passes/clex.py
+%%DATADIR%%/passes/comments.py
+%%DATADIR%%/passes/gcdabinary.py
+%%DATADIR%%/passes/ifs.py
+%%DATADIR%%/passes/includeincludes.py
+%%DATADIR%%/passes/includes.py
+%%DATADIR%%/passes/indent.py
+%%DATADIR%%/passes/ints.py
+%%DATADIR%%/passes/line_markers.py
+%%DATADIR%%/passes/lines.py
+%%DATADIR%%/passes/peep.py
+%%DATADIR%%/passes/special.py
+%%DATADIR%%/passes/ternary.py
+%%DATADIR%%/passes/unifdef.py
+%%DATADIR%%/tests/__init__.py
+%%DATADIR%%/tests/test_balanced.py
+%%DATADIR%%/tests/test_comments.py
+%%DATADIR%%/tests/test_ifs.py
+%%DATADIR%%/tests/test_ints.py
+%%DATADIR%%/tests/test_line_markers.py
+%%DATADIR%%/tests/test_nestedmatcher.py
+%%DATADIR%%/tests/test_peep.py
+%%DATADIR%%/tests/test_special.py
+%%DATADIR%%/tests/test_ternary.py
+%%DATADIR%%/tests/testabstract.py
+%%DATADIR%%/utils/__init__.py
+%%DATADIR%%/utils/error.py
+%%DATADIR%%/utils/misc.py
+%%DATADIR%%/utils/nestedmatcher.py
+%%DATADIR%%/utils/readkey.py
+%%DATADIR%%/utils/statistics.py
+%%DATADIR%%/utils/testing.py