In the three ebuilds app-containers/runc, app-containers/docker, app-containers/docker-cli, the variable CGO_CFLAGS is set like this: export CGO_CFLAGS="-I${ESYSROOT}/usr/include" However, if CGO_CFLAGS is set to anything except the empty string the default value of "-O2 -g" is discarded. Therefore optimization is unconditionally disabled by this line. I suggest as an improvement to instead set export CGO_CFLAGS="-I${ESYSROOT}/usr/include ${CFLAGS}" allowing whatever optimization set in make.conf or package.env to take effect. www-apps/hugo and app-containers/snapd already include ${CFLAGS} in their CGO_CFLAGS, so there is precedent of this behaviour. Reproducible: Always Steps to Reproduce: Build app-containers/docker with CFLAGS set to "-O2" in make.conf Actual Results: The cgo bindings are built without optimization Expected Results: The cgo bindings are built with optimization
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4913cc739d6aeffc72834222f21a2d8ce9efe4e1 commit 4913cc739d6aeffc72834222f21a2d8ce9efe4e1 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-06-25 06:40:23 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-06-25 06:41:21 +0000 app-containers/docker-cli: don't clobber CGO_* Note that we don't have to export now either as go-env.eclass does that. Bug: https://bugs.gentoo.org/900933 Signed-off-by: Sam James <sam@gentoo.org> app-containers/docker-cli/docker-cli-26.1.0.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1375818e7b5b3300812a7e86402526d0b2f72078 commit 1375818e7b5b3300812a7e86402526d0b2f72078 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-06-25 06:39:53 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-06-25 06:41:18 +0000 app-containers/docker: don't clobber CGO_* Note that we don't have to export now either as go-env.eclass does that. Bug: https://bugs.gentoo.org/900933 Signed-off-by: Sam James <sam@gentoo.org> app-containers/docker/docker-26.1.0-r1.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbd4158ebd536bc92d1d28878ed12eee1fbea357 commit cbd4158ebd536bc92d1d28878ed12eee1fbea357 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-06-25 06:38:26 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-06-25 06:41:06 +0000 app-containers/runc: don't clobber CGO_* Note that we don't have to export now either as go-env.eclass does that. Bug: https://bugs.gentoo.org/900933 Signed-off-by: Sam James <sam@gentoo.org> app-containers/runc/runc-1.1.12.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)