Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 234480 - gentoo-sources useflag for custom cflags and ldflags
Summary: gentoo-sources useflag for custom cflags and ldflags
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 16:48 UTC by Stefan Oswald
Modified: 2008-08-13 03:56 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
linux-kernel-custom-cflags.patch (linux-kernel-custom-cflags.patch,437 bytes, patch)
2008-08-12 07:24 UTC, Russell Harmon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Oswald 2008-08-11 16:48:22 UTC
Is it possible to create a USE flag for custom CFLAGS and LDFLAGS? Its Horrible to replace this by hand.

Reproducible: Always
Comment 1 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-08-11 17:12:05 UTC
umm, what?

You want a use flag to insert custom *FLAGS when you compile the kernel? eg. "cd /usr/src/linux ; make"

That isn't possible because that no longer involves the ebuild.
Comment 2 Stefan Oswald 2008-08-11 17:37:55 UTC
If the USE flag is enabled the ebuild patch the /usr/src/linux-.../Makefile and the HOSTCFLAGS and HOSTCXXFLAGS vars getting his values from the /etc/make.conf file.
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-08-11 17:40:13 UTC
(In reply to comment #2)
> If the USE flag is enabled the ebuild patch the /usr/src/linux-.../Makefile and
> the HOSTCFLAGS and HOSTCXXFLAGS vars getting his values from the /etc/make.conf
> file.
> 

Learn something every day. Thanks for the info, do you have a patch as well that works?
Comment 4 Stefan Oswald 2008-08-11 18:20:36 UTC
I dont know how to create a path but i only changed

HOSTCFLAGS   = ...
HOSTCXXFLAGS = ...

to

HOSTCFLAGS   = $(shell portageq envvar CFLAGS)
HOSTCXXFLAGS = $(shell portageq envvar CXXFLAGS)
Comment 5 Russell Harmon 2008-08-12 07:20:07 UTC
Afaik, custom cflags in your kernel is frowned upon because the kernel is so different than all the other software on your system so it already has a set of fine-tuned cflags...

However, that's just knowledge i've gleaned off the general internets, so it may be entirely wrong.
Comment 6 Russell Harmon 2008-08-12 07:24:20 UTC
Created attachment 162724 [details, diff]
linux-kernel-custom-cflags.patch

If you still must do it however, here's a patch...
Comment 7 Santiago M. Mola (RETIRED) gentoo-dev 2008-08-12 09:53:06 UTC
Russell, thanks for the patch, maybe it's useful for someone.

Although, this is potentially dangerous for end users so it's better that the people interested patch their own sources or create their own ebuild. Supporting this officially may result in buggy or even unbootable kernels and angry users.