On 2020-07-03 18:35, Xianwen Chen (陈贤文) wrote: > > In the Makefile, it is written that > > cc = g++ > > I would like to use sed to patch it so that it ebuild knows which g++ to > use. For example, depending on whether ccache is set, ebuild shall know > whether to use ccache.
First, you should suggest to upstream that they don't force a particular compiler in their Makefile. One uncontroversial way to do this is by setting the default only if the user does not already have one set, with the "?=" assignment operator: cc ?= g++ Then, you should suggest that they change the name of that variable to the relatively-standard "CXX" that is used for the C++ compiler: CXX ?= g++ Finally, in your ebuild, you should run emake CXX=$(tc-getCXX) ... to override the default CXX in the Makefile. Even if upstream doesn't respond right away, you can patch the Makefile with these suggestions in Gentoo and send them the patch.