diff --git a/Mk/Features/testing.mk b/Mk/Features/testing.mk new file mode 100644 --- /dev/null +++ b/Mk/Features/testing.mk @@ -0,0 +1,15 @@ +# Automatic testing Support +# +# Add WITH_TESTING=yes into make.conf: +# - If set, and the port supports it, the software's test suite will be compiled +# and run during the normal building pipeline between 'stage' and 'package' +# stages. + +.if !defined(_TESTING_MK_INCLUDED) +_TESTING_MK_INCLUDED= yes +TESTING_Include_MAINTAINER= portmgr@FreeBSD.org + +_TESTING_PACKAGE_DEP= test + +.endif + diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1013,7 +1013,7 @@ # These need to be absolute since we don't know how deep in the ports # tree we are and thus can't go relative. They can, of course, be overridden # by individual Makefiles or local system make configuration. -_LIST_OF_WITH_FEATURES= bind_now debug debuginfo lto pie relro sanitize ssp +_LIST_OF_WITH_FEATURES= bind_now debug debuginfo lto pie relro sanitize ssp testing _DEFAULT_WITH_FEATURES= ssp PORTSDIR?= /usr/ports LOCALBASE?= /usr/local @@ -1322,18 +1322,39 @@ TMPDIR?= /tmp . endif # defined(PACKAGE_BUILDING) +# If user specified WITH_FEATURE=yes for a feature that is disabled by default +# treat it as enabled by default +. for feature in ${_LIST_OF_WITH_FEATURES} +. if ${_DEFAULT_WITH_FEATURES:N${feature}} +. if defined(WITH_${feature:tu}) +_DEFAULT_WITH_FEATURES+= ${feature} +. endif +. endif +. endfor + +. for feature in ${_LIST_OF_WITH_FEATURES} +# Create _{WITH,WITHOUT}_FEATURE vars based on user-provided {WITH,WITHOUT}_FEATURE +. if defined(WITH_${feature:tu}) +_WITH_${feature:tu}= ${WITH_${feature:tu}} +. endif +. if defined(WITHOUT_${feature:tu}) +_WITHOUT_${feature:tu}= ${WITHOUT_${feature:tu}} +. endif # For each Feature we support, process the # WITH_FEATURE_PORTS and WITHOUT_FEATURE_PORTS variables -. for feature in ${_LIST_OF_WITH_FEATURES} . if ${_DEFAULT_WITH_FEATURES:M${feature}} -_WITH_OR_WITHOUT= WITHOUT +. if defined(WITHOUT_${feature:tu}_PORTS) +. if ${WITHOUT_${feature:tu}_PORTS:M${PKGORIGIN}} +_WITHOUT_${feature:tu}= yes +.undef _WITH_${feature:tu} +. endif +. endif . else -_WITH_OR_WITHOUT= WITH -. endif - -. if defined(${_WITH_OR_WITHOUT}_${feature:tu}_PORTS) -. if ${${_WITH_OR_WITHOUT}_${feature:tu}_PORTS:M${PKGORIGIN}} -${_WITH_OR_WITHOUT}_${feature:tu}= yes +. if defined(WITH_${feature:tu}_PORTS) +. if ${WITH_${feature:tu}_PORTS:M${PKGORIGIN}} +_WITH_${feature:tu}= yes +.undef _WITHOUT_${feature:tu} +. endif . endif . endif . endfor @@ -1787,7 +1808,7 @@ . endif . for f in ${_LIST_OF_WITH_FEATURES} -. if defined(WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(WITHOUT_${f:tu}) ) +. if defined(_WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(_WITHOUT_${f:tu}) ) .include "${PORTSDIR}/Mk/Features/$f.mk" . endif . endfor @@ -5490,7 +5511,7 @@ 300:create-manifest _INSTALL_SUSEQ= 400:fake-pkg 500:security-check -_PACKAGE_DEP= stage +_PACKAGE_DEP= stage ${_TESTING_PACKAGE_DEP} _PACKAGE_SEQ= 100:package-message 300:pre-package 450:pre-package-script \ 500:do-package 850:post-package-script \ ${_OPTIONS_package} ${_USES_package}