Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148066490
D7223.1785266350.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D7223.1785266350.diff
View Options
Index: Mk/bsd.gcc.mk
===================================================================
--- Mk/bsd.gcc.mk
+++ Mk/bsd.gcc.mk
@@ -17,13 +17,24 @@
# 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
+# if no arguments are specified, GCC is added to BUILD_DEPENDS and RUN_DEPENDS.
+#
+# USE_GCC=build and USE_GCC=run are aliases to yes:build, yes:run, respectively
+#
# 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= 6+ # port requires GCC 6 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.
#
@@ -49,6 +60,43 @@
# No configurable parts below this. ####################################
#
+# Alias {build,run} -> yes:{build,run}
+.if ${USE_GCC} == build || ${USE_GCC} == run
+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
+.if ${_USE_GCC_ARGS:Mbuild}
+_USE_GCC_BUILD_DEP= yes
+_USE_GCC_ARGS:= ${_USE_GCC_ARGS:Nbuild}
+.endif
+.if ${_USE_GCC_ARGS:Mrun}
+_USE_GCC_RUN_DEP= yes
+_USE_GCC_ARGS:= ${_USE_GCC_ARGS:Nrun}
+.endif
+
+.if !empty(_USE_GCC_ARGS)
+. error bad target specification in USE_GCC. Only build, and run are supported.
+.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_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
@@ -170,8 +218,12 @@
.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
# Later GCC ports already depend on binutils; make sure whatever we
# build leverages this as well.
USE_BINUTILS= yes
@@ -185,11 +237,20 @@
@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
.for v in ${GCCVERSIONS}
@echo -n "GCC version: ${_GCCVERSION_${v}_V} "
.if defined(_GCC_FOUND${v})
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 28, 7:19 PM (15 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29295047
Default Alt Text
D7223.1785266350.diff (3 KB)
Attached To
Mode
D7223: Mk/bsd.gcc.mk: add support for conditional dependencies for USE_GCC
Attached
Detach File
Event Timeline
Log In to Comment