Bug 211154 - Mk/bsd.gcc.mk: add support for build-only dependencies for USE_GCC
Summary: Mk/bsd.gcc.mk: add support for build-only dependencies for USE_GCC
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Gerald Pfeifer
URL: https://reviews.freebsd.org/D7223
Keywords: feature, needs-qa, patch
: 199897 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-07-16 12:34 UTC by Fabian Freyer
Modified: 2021-03-12 09:31 UTC (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Freyer 2016-07-16 12:34:18 UTC
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.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-16 12:40:20 UTC
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
Comment 2 Roman Bogorodskiy freebsd_committer freebsd_triage 2016-07-16 12:45:48 UTC
Here's a review request I created for that: https://reviews.freebsd.org/D7173
Comment 3 Fabian Freyer 2016-07-16 13:53:57 UTC
Based on the patch by novel@ and how Mk/Uses/python.mk does it, I've created review D7223
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-17 08:37:15 UTC
+1 on D7223
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-21 11:36:20 UTC
D7173 has been closed
Comment 6 Gerald Pfeifer freebsd_committer freebsd_triage 2016-07-25 19:36:35 UTC
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?)
Comment 7 Gerald Pfeifer freebsd_committer freebsd_triage 2017-01-15 21:46:15 UTC
*** Bug 199897 has been marked as a duplicate of this bug. ***
Comment 8 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-01-16 04:11:42 UTC
+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.
Comment 9 commit-hook freebsd_committer freebsd_triage 2017-11-02 20:32:53 UTC
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
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-03-10 10:08:34 UTC
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
Comment 11 Gerald Pfeifer freebsd_committer freebsd_triage 2021-01-26 22:53:59 UTC
(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.
Comment 12 Gerald Pfeifer freebsd_committer freebsd_triage 2021-01-26 22:54:53 UTC
https://reviews.freebsd.org/D7223 actually.
Comment 13 commit-hook freebsd_committer freebsd_triage 2021-01-30 15:15:18 UTC
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
Comment 14 Gerald Pfeifer freebsd_committer freebsd_triage 2021-01-30 23:50:19 UTC
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.
Comment 15 commit-hook freebsd_committer freebsd_triage 2021-01-31 10:46:22 UTC
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
Comment 16 commit-hook freebsd_committer freebsd_triage 2021-02-03 08:35:11 UTC
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
Comment 17 commit-hook freebsd_committer freebsd_triage 2021-02-06 11:48:35 UTC
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
Comment 18 commit-hook freebsd_committer freebsd_triage 2021-02-09 10:43:23 UTC
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
Comment 19 commit-hook freebsd_committer freebsd_triage 2021-02-13 22:49:53 UTC
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
Comment 20 commit-hook freebsd_committer freebsd_triage 2021-02-14 09:28:34 UTC
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
Comment 21 commit-hook freebsd_committer freebsd_triage 2021-03-12 09:31:48 UTC
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