Index: Mk/bsd.gcc.mk =================================================================== --- Mk/bsd.gcc.mk +++ Mk/bsd.gcc.mk @@ -17,6 +17,16 @@ # do so by specifying USE_GCC=X.Y+ which requests at least GCC version # X.Y. To request a specific version omit the trailing + sign. # +# Optional comma-separated arguments may be specified after the version +# specifier. The following arguments are supported: +# build add GCC to BUILD_DEPENDS +# run add GCC to RUN_DEPENDS +# test add GCC to TEST_DEPENDS +# if no arguments are specified, GCC is added to BUILD_DEPENDS and RUN_DEPENDS. +# +# USE_GCC=build, USE_GCC=run and USE_GCC=test are aliases to yes:build, yes:run +# and yes:test, respectively. +# # Examples: # USE_GCC= yes # port requires a current version of GCC # # as defined in bsd.default-versions.mk. @@ -23,7 +33,10 @@ # USE_GCC= any # port requires GCC 4.2 or later. # USE_GCC= 4.9+ # port requires GCC 4.9 or later. # USE_GCC= 4.9 # port requires GCC 4.9. -# +# USE_GCC= 4.9:build # port requires GCC 4.9 at build-time only. +# USE_GCC= build # port requires a current version of GCC at +# # build-time only. +# # If you are wondering what your port exactly does, use "make test-gcc" # to see some debugging. # @@ -52,6 +65,41 @@ # No configurable parts below this. #################################### # +# Alias {build,run,test} -> yes:{build,run,test} +.if ${USE_GCC} == build || ${USE_GCC} == run || ${USE_GCC} == test +USE_GCC:= yes:${USE_GCC} +.endif + +# Split args +.if defined(USE_GCC) +__USE_GCC:= ${USE_GCC:C/\:.*//} +_USE_GCC_ARGS:= ${USE_GCC:C/^[^\:]*(\:|\$)//:S/,/ /g} +USE_GCC= ${__USE_GCC} +.endif # defined(USE_GCC) + +# Make sure that no dependency or some other environment variable +# pollutes the build/run dependency detection +.undef _USE_GCC_BUILD_DEP +.undef _USE_GCC_RUN_DEP +.undef _USE_GCC_TEST_DEP +.if ${_USE_GCC_ARGS:Mbuild} +_USE_GCC_BUILD_DEP= yes +.endif +.if ${_USE_GCC_ARGS:Mrun} +_USE_GCC_RUN_DEP= yes +.endif +.if ${_USE_GCC_ARGS:Mtest} +_USE_GCC_TEST_DEP= yes +.endif + +# The port does not specify a build, run or test dependency, assume build and +# test are required. +.if !defined(_USE_GCC_BUILD_DEP) && !defined(_USE_GCC_RUN_DEP) && \ + !defined(_USE_GCC_TEST_DEP) && !defined(USE_GCC_NO_DEPENDS) +_USE_GCC_BUILD_DEP= yes +_USE_GCC_RUN_DEP= yes +.endif + .if defined(USE_GCC) && ${USE_GCC} == yes USE_GCC= ${GCC_DEFAULT}+ .endif @@ -173,8 +221,15 @@ .undef V .if defined(_GCC_PORT_DEPENDS) +. if defined(_USE_GCC_BUILD_DEP) BUILD_DEPENDS+= ${_GCC_PORT_DEPENDS}:lang/${_GCC_PORT} +. endif +. if defined(_USE_GCC_RUN_DEP) RUN_DEPENDS+= ${_GCC_PORT_DEPENDS}:lang/${_GCC_PORT} +. endif +. if defined(_USE_GCC_TEST_DEP) +TEST_DEPENDS+= ${_GCC_PORT_DEPENDS}:lang/${_GCC_PORT} +. endif # Later GCC ports already depend on binutils; make sure whatever we # build leverages this as well. USE_BINUTILS= yes @@ -188,11 +243,23 @@ @echo "IGNORE: ${IGNORE}" .else .if defined(USE_GCC) +.if defined(_USE_GCC_ARGS) + @echo "ARGS: ${_USE_GCC_ARGS}" +.endif .if defined(_GCC_ORLATER) @echo Port can use later versions. .else @echo Port cannot use later versions. .endif +.if defined(_USE_GCC_BUILD_DEP) + @echo ${_GCC_PORT_DEPENDS}:lang/${_GCC_PORT} will be added to BUILD_DEPENDS. +.endif +.if defined(_USE_GCC_RUN_DEP) + @echo ${_GCC_PORT_DEPENDS}:lang/${_GCC_PORT} will be added to RUN_DEPENDS. +.endif +.if defined(_USE_GCC_TEST_DEP) + @echo ${_GCC_PORT_DEPENDS}:lang/${_GCC_PORT} will be added to TEST_DEPENDS. +.endif .for v in ${GCCVERSIONS} @echo -n "GCC version: ${_GCCVERSION_${v}_V} " .if defined(_GCC_FOUND${v})