diff options
author | Gerald Pfeifer <gerald@FreeBSD.org> | 2021-01-30 15:15:01 +0000 |
---|---|---|
committer | Gerald Pfeifer <gerald@FreeBSD.org> | 2021-01-30 15:15:01 +0000 |
commit | bba7c612567584ce864c37ac0c178d4218dcdc3e (patch) | |
tree | 9da3ca97202dc54666edd7379e56fb6942d8ee56 /Mk | |
parent | 8c03f4901cf9f85a64b0c4cd0c22e49cbdcac976 (diff) | |
download | ports-bba7c612567584ce864c37ac0c178d4218dcdc3e.tar.gz ports-bba7c612567584ce864c37ac0c178d4218dcdc3e.zip |
In some cases one may want to use GCC to build something when its
runtimes or GCC at runtime are not required.
Introduce an optional argument for USE_GCC that indicates GCC is
only required at build time.
Examples for the new syntax are USE_GCC=yes:build, USE_GCC=9:build,
or USE_GCC=11+:build.
Submitted by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
PR: 211154
Differential Revision: https://reviews.freebsd.org/D7223
Notes
Notes:
svn path=/head/; revision=563416
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.gcc.mk | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Mk/bsd.gcc.mk b/Mk/bsd.gcc.mk index 68227d08e018..4e1d144cdad8 100644 --- a/Mk/bsd.gcc.mk +++ b/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 @@ GCCVERSIONS= 4.8 7 8 9 10 11 # 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 @@ CXXFLAGS:= ${CXXFLAGS:N-mretpoline} .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 |