aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Piotrowski <0mp@FreeBSD.org>2021-07-13 13:24:01 +0000
committerMateusz Piotrowski <0mp@FreeBSD.org>2021-07-13 13:39:43 +0000
commit41a3548060aa366986f36945c5a3303e4daa0009 (patch)
treeb31fcc83d0abcd8fccd393e4dccaa04a772dc39b
parent5dfe0d2922b56e8037cd1e8d8940d5d9d9893c4c (diff)
downloadports-41a3548060aa366986f36945c5a3303e4daa0009.tar.gz
ports-41a3548060aa366986f36945c5a3303e4daa0009.zip
Mk/Uses: Add angr.mk
angr.mk will be used to simplify the ports related to security/py-angr.
-rw-r--r--Mk/Uses/angr.mk65
1 files changed, 65 insertions, 0 deletions
diff --git a/Mk/Uses/angr.mk b/Mk/Uses/angr.mk
new file mode 100644
index 000000000000..7d2489854e6c
--- /dev/null
+++ b/Mk/Uses/angr.mk
@@ -0,0 +1,65 @@
+# Shared namespace for angr-related ports.
+#
+# Feature: angr
+# Usage: USES=angr[:ARGS]
+# Valid ARGS: binaries, nose
+#
+# binaries The port requires the special angr binaries to be present for
+# testing.
+# nose The port is using nosetests for the test target.
+#
+# Variables, which can be set by the port:
+#
+# ANGR_VERSION - The version of the angr project programs.
+# ANGR_BINARIES_TAGNAME - The tagname of the angr binaries.
+# ANGR_NOSETESTS - The path to the nosetests program.
+#
+# Other information:
+# - USES=angr:nose implies USES=python:test unless USES=python has already
+# been specified yet.
+#
+# MAINTAINER: ports@FreeBSD.org
+
+.if !defined(_INCLUDE_USES_ANGR_MK)
+_INCLUDE_USES_ANGR_MK= yes
+
+# Arguments validation.
+_valid_ARGS= binaries nose
+.for _arg in ${angr_ARGS}
+. if !${_valid_ARGS:M${_arg}}
+IGNORE= USES=angr: invalid argument: ${_arg}
+. endif
+.endfor
+
+# Set the default angr version for all angr-related ports.
+ANGR_VERSION?= 9.0.5405
+ANGR_BINARIES_TAGNAME?= v${ANGR_VERSION}
+
+.if "${angr_ARGS:Mbinaries}" != ""
+USE_GITHUB?= yes
+GH_TUPLE+= angr:binaries:${ANGR_BINARIES_TAGNAME}:binaries
+
+# Provide the binaries directory where it is expected by the test scripts.
+pre-test: angr-provide-test-binaries
+angr-provide-test-binaries:
+ @${LN} -Fs ${WRKSRC_binaries} ${WRKDIR}/binaries
+.endif # "${angr_ARGS:Mbinaries}" != ""
+
+.if "${angr_ARGS:Mnose}" != ""
+# Ensure that python.mk variables are available.
+. if !${USES:Mpython*}
+python_ARGS= test
+_USES_POST+= python:test
+.include "${USESDIR}/python.mk"
+. endif # !${USES:Mpython*}
+
+TEST_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}nose>0:devel/py-nose@${PY_FLAVOR}
+TEST_WRKSRC?= ${WRKSRC}/tests
+
+ANGR_NOSETESTS?= nosetests-${PYTHON_VER}
+
+do-test:
+ @(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${ANGR_NOSETESTS})
+.endif # "${angr_ARGS:Mnose}" != ""
+
+.endif