Index: Mk/bsd.gcc.mk =================================================================== --- Mk/bsd.gcc.mk +++ Mk/bsd.gcc.mk @@ -17,6 +17,15 @@ # do so by specifying USE_GCC=X+ which requests at least GCC version X. # 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 as a build dependency (BUILD_DEPENDS). +# If no arguments are specified, GCC is added both as a build dependency +# and a runtime dependency. +# +# USE_GCC=build is a shortcut for USE_GCC=yes:build. +# +# # Examples: # USE_GCC= yes # port requires a current version of GCC # # as defined in bsd.default-versions.mk. @@ -23,6 +32,9 @@ # USE_GCC= any # port requires GCC 4.2 or later. # USE_GCC= 7+ # port requires GCC 7 or later. # USE_GCC= 5 # port requires GCC 5. +# USE_GCC= 8:build # port requires GCC 8 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. @@ -49,6 +61,35 @@ # No configurable parts below this. #################################### # +# Alias USE_GCC=build to USE_GCC=yes:build +.if ${USE_GCC} == build +USE_GCC:= yes:${USE_GCC} +.endif + +# 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_BUILD_DEP= yes +_USE_GCC_ARGS:= ${_USE_GCC_ARGS:Nbuild} +.endif + +.if !empty(_USE_GCC_ARGS) +IGNORE= Bad target specification in USE_GCC; only "build" is supported +.endif + +# If the port does not specify a specific dependency, assume all are required. +.if !defined(_USE_GCC_BUILD_DEP) && !defined(_USE_GCC_RUN_DEP) +_USE_GCC_BUILD_DEP:= yes +_USE_GCC_RUN_DEP:= yes +.endif + + +# Handle USE_GCC=yes. .if defined(USE_GCC) && ${USE_GCC} == yes USE_GCC= ${GCC_DEFAULT}+ .endif @@ -177,8 +218,12 @@ CXXFLAGS:= ${CXXFLAGS:N-mretpoline} .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 # Later GCC ports already depend on binutils; make sure whatever we # build leverages this as well. USE_BINUTILS= yes