Several ports use USE_GCC but manually remove gcc from RUN_DEPENDS by using RUN_DEPENDS:=${RUN_DEPENDS:Ngcc*} after after including bsd.port.mk: * sysutils/memtest86+ * sysutils/grub2-bhyve * sysutils/grub2-pcbsd * sysutils/grub2-efi * misc/seabios This is a very hacky approach. There are several other ports (e.g. sysutils/uefi-edi2-bhyve) that have a build-time dependency on gcc but do not depend on it at run-time. Therefore support for adding a build-time dependency e.g. by setting USE_GCC=yes:build or similar would be very useful.
A patch exists in bug 155408 that didn't received an example port showing usage. It probably needs a second version created to account for modern framework design, but nonetheless is a reference
Here's a review request I created for that: https://reviews.freebsd.org/D7173
Based on the patch by novel@ and how Mk/Uses/python.mk does it, I've created review D7223
+1 on D7223
D7173 has been closed
Thanks for doing this! While I am currently not fully available for FreeBSD work, I quite support the idea behind this and just reviewed the patch on reviews.FreeBSD.org. Once it is approved there, please go ahead and commit. (Might it make sense for you to assign this PR to yourself?)
*** Bug 199897 has been marked as a duplicate of this bug. ***
+1 It looks like a very practical solution. Does fortran also involve a runtime library? Just wondering on anything that depends on, for example, blas.
A commit references this bug: Author: tobik Date: Thu Nov 2 20:31:53 UTC 2017 New revision: 453376 URL: https://svnweb.freebsd.org/changeset/ports/453376 Log: net/ipxe: Update to latest commit iPXE naturally doesn't require or link with any of the libraries provided by GCC, so remove the GCC run dependency. In the absence of a better solution to do this we use the hack used by other ports like devel/linux-kernel, sysutils/memtest86+, sysutils/grub2-bhyve, misc/seabios, ... [1] Changes: https://github.com/ipxe/ipxe/compare/26050fd4c87c50503d5bd573b2ec91703676e211...1b67a0564657b6fcef18b1588ea6491ca1b1996d PR: 211154 [1] Changes: head/net/ipxe/Makefile head/net/ipxe/distinfo
A commit references this bug: Author: tobik Date: Sat Mar 10 10:07:46 UTC 2018 New revision: 464059 URL: https://svnweb.freebsd.org/changeset/ports/464059 Log: sysutils/uefi-edk2-bhyve: Remove GCC run dependency The firmware does not require or link with any of the libraries provided by GCC, so remove the GCC run dependency. Due to the lack of an accepted better solution in bsd.gcc.mk to do this, we use the hack used by other ports like devel/linux-kernel, sysutils/memtest86+, sysutils/grub2-bhyve, misc/seabios, net/ipxe, ... PR: 211079, 211154 Approved by: Process paralysis Changes: head/sysutils/uefi-edk2-bhyve/Makefile
(In reply to Gerald Pfeifer from comment #6) > Thanks for doing this! While I am currently not fully available > for FreeBSD work, I quite support the idea behind this and just > reviewed the patch on reviews.FreeBSD.org. > > Once it is approved there, please go ahead and commit. (Might it > make sense for you to assign this PR to yourself?) Sadly this got stuck even after I returned from my long medical leave in 2016. Apologies for that! I have updated the patch, simplified it to cover just the "build-only" case, which is the only one we need in the Ports Collection it seems. I'll update https://reviews.freebsd.org/D7173 with my candidate patch and plan on committing it shortly.
https://reviews.freebsd.org/D7223 actually.
A commit references this bug: Author: gerald Date: Sat Jan 30 15:15:01 UTC 2021 New revision: 563416 URL: https://svnweb.freebsd.org/changeset/ports/563416 Log: 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 Changes: head/Mk/bsd.gcc.mk
It is in, finally. I'll be converting the ports I could find that benefit from this in the coming days; no need for any of you to take any action (I think) - most patches (and approvals) are on my disk already.
A commit references this bug: Author: gerald Date: Sun Jan 31 10:46:11 UTC 2021 New revision: 563483 URL: https://svnweb.freebsd.org/changeset/ports/563483 Log: Convert misc/seabios to use the new "build" argument to USE_GCC, replacing direct manipulation of RUN_DEPENDS by the much more declarative and simpler USE_GCC=yes:build. PR: 211154 Changes: head/misc/seabios/Makefile
A commit references this bug: Author: gerald Date: Wed Feb 3 08:34:09 UTC 2021 New revision: 563869 URL: https://svnweb.freebsd.org/changeset/ports/563869 Log: Convert sysutils/memtest86+ to use the new "build" argument to USE_GCC, replacing direct manipulation of RUN_DEPENDS by the more declarative and simpler USE_GCC=4.8:build. PR: 211154 Approved by: avg (maintainer) Changes: head/sysutils/memtest86+/Makefile
A commit references this bug: Author: gerald Date: Sat Feb 6 11:48:18 UTC 2021 New revision: 564216 URL: https://svnweb.freebsd.org/changeset/ports/564216 Log: Convert sysutils/grub2-bhyve to use the new "build" argument to USE_GCC, replacing direct manipulation of RUN_DEPENDS by the more declarative and simpler USE_GCC=yes:build. PR: 211154 Changes: head/sysutils/grub2-bhyve/Makefile
A commit references this bug: Author: gerald Date: Tue Feb 9 10:42:37 UTC 2021 New revision: 564778 URL: https://svnweb.freebsd.org/changeset/ports/564778 Log: Convert uefi-edk2-bhyve-devel to leverage the new "build" argument to USE_GCC, thus replacing direct manipulation of RUN_DEPENDS by the much simpler, declarative USE_GCC=yes:build. PR: 211154 Changes: head/sysutils/uefi-edk2-bhyve-devel/Makefile
A commit references this bug: Author: gerald Date: Sat Feb 13 22:49:43 UTC 2021 New revision: 565184 URL: https://svnweb.freebsd.org/changeset/ports/565184 Log: Back port r564778 | gerald | 2021-02-09 from uefi-edk2-bhyve-devel to uefi-edk2-bhyve: Convert uefi-edk2-bhyve-devel to leverage the new "build" argument to USE_GCC, thus replacing direct manipulation of RUN_DEPENDS by the much simpler, declarative USE_GCC=yes:build. PR: 211154 Changes: head/sysutils/uefi-edk2-bhyve/Makefile
A commit references this bug: Author: gerald Date: Sun Feb 14 09:28:23 UTC 2021 New revision: 565213 URL: https://svnweb.freebsd.org/changeset/ports/565213 Log: Convert uefi-edk2-qemu to use the new "build" argument to USE_GCC instead of using a direct dependency and then directly manipulating RUN_DEPENDS - simpler and more declarative. PR: 211154 Approved by: bcran (maintainer) Changes: head/sysutils/uefi-edk2-qemu/Makefile
A commit references this bug: Author: gerald Date: Fri Mar 12 09:30:48 UTC 2021 New revision: 568155 URL: https://svnweb.freebsd.org/changeset/ports/568155 Log: Convert net/ipxe to use the new "build" argument to USE_GCC. This replaces direct manipulation of RUN_DEPENDS by the more declarative and simpler USE_GCC=yes:build. PR: 211154 Approved by: maintainer timeout (three weeks) Changes: head/net/ipxe/Makefile