Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 726714

Summary: cargo.eclass: export CC and other toolchain variables
Product: Gentoo Linux Reporter: Georgy Yakovlev <gyakovlev>
Component: EclassesAssignee: Georgy Yakovlev <gyakovlev>
Status: RESOLVED FIXED    
Severity: normal CC: rust
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=726428
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 243502    

Description Georgy Yakovlev archtester gentoo-dev 2020-06-01 23:13:54 UTC
It's needed by some crates, like cc or it's revdeps.
Comment 1 Georgy Yakovlev archtester gentoo-dev 2020-06-01 23:17:05 UTC
cc crate's options documented here
https://crates.io/crates/cc

External configuration via environment variables

To control the programs and flags used for building, the builder can set a number of different environment variables.

    CFLAGS - a series of space separated flags passed to compilers. Note that individual flags cannot currently contain spaces, so doing something like: "-L=foo\ bar" is not possible.
    CC - the actual C compiler used. Note that this is used as an exact executable name, so (for example) no extra flags can be passed inside this variable, and the builder must ensure that there aren't any trailing spaces. This compiler must understand the -c flag. For certain TARGETs, it also is assumed to know about other flags (most common is -fPIC).
    AR - the ar (archiver) executable to use to build the static library.
    CRATE_CC_NO_DEFAULTS - the default compiler flags may cause conflicts in some cross compiling scenarios. Setting this variable will disable the generation of default compiler flags.

Each of these variables can also be supplied with certain prefixes and suffixes, in the following prioritized order:

    <var>_<target> - for example, CC_x86_64-unknown-linux-gnu
    <var>_<target_with_underscores> - for example, CC_x86_64_unknown_linux_gnu
    <build-kind>_<var> - for example, HOST_CC or TARGET_CFLAGS
    <var> - a plain CC, AR as above.

If none of these variables exist, cc-rs uses built-in defaults

In addition to the above optional environment variables, cc-rs has some functions with hard requirements on some variables supplied by cargo's build-script driver that it has the TARGET, OUT_DIR, OPT_LEVEL, and HOST variables.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2020-06-01 23:17:59 UTC
another one is PKG_CONFIG, I've seen unprefixed calls to in -sys crates.
Comment 3 Larry the Git Cow gentoo-dev 2020-06-02 08:55:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d3f2059166f6d8c460c7e60523a3e224438348d

commit 6d3f2059166f6d8c460c7e60523a3e224438348d
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-06-02 08:44:40 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-06-02 08:54:56 +0000

    cargo.eclass: tc-export AR CC
    
    Bug: https://bugs.gentoo.org/726428
    Closes: https://bugs.gentoo.org/726714
    
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 eclass/cargo.eclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8fd7ffef828ccbdf83fff0eb4aac58ae7f5d1bc5

commit 8fd7ffef828ccbdf83fff0eb4aac58ae7f5d1bc5
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-06-02 08:53:05 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-06-02 08:54:57 +0000

    x11-terms/alacritty: remove CC export
    
    how set in eclass
    
    Bug: https://bugs.gentoo.org/726428
    Bug: https://bugs.gentoo.org/726714
    This reverts commit 941788b2803ed563bdc1984c7966df1b86bda4fa.
    
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 x11-terms/alacritty/alacritty-0.4.2-r1.ebuild | 3 +--
 x11-terms/alacritty/alacritty-0.4.3.ebuild    | 3 +--
 x11-terms/alacritty/alacritty-9999.ebuild     | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)