Index: head/Mk/bsd.gcc.mk =================================================================== --- head/Mk/bsd.gcc.mk +++ head/Mk/bsd.gcc.mk @@ -17,12 +17,25 @@ # do so by specifying USE_GCC=X+ which requests at least GCC version X. # To request a specific version omit the trailing + sign. # +# Optionally comma-separated arguments follow the version specifier. +# Currently we support: +# build ... which adds GCC as a build dependency (BUILD_DEPENDS) only. +# +# If no arguments are specified, GCC is added as both a build dependency +# and a run time dependency. +# +# # Examples: # USE_GCC= yes # port requires a current version of GCC # # as defined in bsd.default-versions.mk. # USE_GCC= any # port requires GCC 4.2 or later. # USE_GCC= 9+ # port requires GCC 9 or later. # USE_GCC= 8 # port requires GCC 8. +# USE_GCC= yes:build # port requires a current version of GCC at +# # build time only. +# USE_GCC= 9:build # port requires GCC 9 at build time only. +# USE_GCC= 11+:build # port requires GCC 11 or later at build +# # time only. # # If you are wondering what your port exactly does, use "make test-gcc" # to see some debugging. @@ -39,6 +52,23 @@ # No configurable parts below this. #################################### # +# Split arguments +.if defined(USE_GCC) +__USE_GCC:= ${USE_GCC:C/\:.*//} +_USE_GCC_ARGS:= ${USE_GCC:C/^[^\:]*(\:|\$)//:S/,/ /g} +USE_GCC= ${__USE_GCC} +.endif + +.if ${_USE_GCC_ARGS:Mbuild} +_USE_GCC_ARGS:= ${_USE_GCC_ARGS:Nbuild} +.else +_USE_GCC_RUN_DEPENDS= yes +.endif + +.if !empty(_USE_GCC_ARGS) +IGNORE= bad target specification in USE_GCC; only "build" is supported +.endif + .if defined(USE_GCC) && !defined(FORCE_BASE_CC_FOR_TESTING) .if ${USE_GCC} == any && exists(/usr/bin/gcc) @@ -116,7 +146,9 @@ .if defined(_GCC_PORT) BUILD_DEPENDS+= ${CC}:lang/${_GCC_PORT} +. if defined(_USE_GCC_RUN_DEPENDS) RUN_DEPENDS+= ${CC}:lang/${_GCC_PORT} +. endif # GCC ports already depend on binutils; make sure whatever we build # leverages this as well. USE_BINUTILS= yes