buildRustCrate: Add some commentary about target_os.

This commit is contained in:
Shea Levy 2018-07-02 11:22:47 -04:00
parent cb692ff813
commit 98ddba156c
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27

View File

@ -15,6 +15,12 @@ let makeDeps = dependencies:
" --extern ${extern}=${dep.out}/lib/lib${extern}-${dep.metadata}${buildPlatform.extensions.sharedLibrary}")
) dependencies);
# This doesn't appear to be officially documented anywhere yet.
# See https://github.com/rust-lang-nursery/rust-forge/issues/101.
target_os = if buildPlatform.isDarwin
then "macos"
else buildPlatform.parsed.kernel.name;
echo_build_heading = colors: ''
echo_build_heading() {
start=""
@ -101,7 +107,7 @@ let makeDeps = dependencies:
export CARGO_PKG_AUTHORS="${authors}"
export CARGO_CFG_TARGET_ARCH=${buildPlatform.parsed.cpu.name}
export CARGO_CFG_TARGET_OS=${if buildPlatform.isDarwin then "macos" else buildPlatform.parsed.kernel.name}
export CARGO_CFG_TARGET_OS=${target_os}
export CARGO_CFG_TARGET_FAMILY="unix"
export CARGO_CFG_UNIX=1
export CARGO_CFG_TARGET_ENV="gnu"