about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-03-06 14:46:38 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-03-06 14:46:38 +0100
commit0985044c75fff285928c451a3d43056b0955b761 (patch)
treed1e6dcae84200650bc6a7b9274075e3712200dbf /scripts
parent274a7ac4c49c31bc87672fbbf5f1002c96fec1aa (diff)
downloadrust-0985044c75fff285928c451a3d43056b0955b761.tar.gz
rust-0985044c75fff285928c451a3d43056b0955b761.zip
Use --print file-names instead of a match on uname
Diffstat (limited to 'scripts')
-rw-r--r--scripts/config.sh14
1 files changed, 3 insertions, 11 deletions
diff --git a/scripts/config.sh b/scripts/config.sh
index c2ed2bf256d..99b302ee1d9 100644
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -2,15 +2,7 @@
 
 set -e
 
-unamestr=$(uname)
-if [[ "$unamestr" == 'Linux' || "$unamestr" == 'FreeBSD' ]]; then
-   dylib_ext='so'
-elif [[ "$unamestr" == 'Darwin' ]]; then
-   dylib_ext='dylib'
-else
-   echo "Unsupported os"
-   exit 1
-fi
+dylib=$(echo "" | rustc --print file-names --crate-type dylib --crate-name rustc_codegen_cranelift -)
 
 if echo "$RUSTC_WRAPPER" | grep sccache; then
 echo
@@ -24,10 +16,10 @@ dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
 export RUSTC=$dir"/bin/cg_clif"
 
 export RUSTDOCFLAGS=$linker' -Cpanic=abort -Zpanic-abort-tests '\
-'-Zcodegen-backend='$dir'/lib/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir
+'-Zcodegen-backend='$dir'/lib/'$dylib' --sysroot '$dir
 
 # FIXME fix `#[linkage = "extern_weak"]` without this
-if [[ "$unamestr" == 'Darwin' ]]; then
+if [[ "$(uname)" == 'Darwin' ]]; then
    export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
 fi