]> git.lizzy.rs Git - rust.git/commitdiff
Use rpath to compile the cg_clif executable
authorbjorn3 <bjorn3@users.noreply.github.com>
Fri, 13 Nov 2020 18:48:49 +0000 (19:48 +0100)
committerbjorn3 <bjorn3@users.noreply.github.com>
Fri, 13 Nov 2020 18:48:49 +0000 (19:48 +0100)
build.sh
scripts/config.sh

index 420ec825f92283152f23b91fef7f1a1e62379338..26041b59cca1876bfcf56640a76b104125854ae3 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -28,6 +28,16 @@ done
 # Build cg_clif
 unset CARGO_TARGET_DIR
 export RUSTFLAGS="-Zrun_dsymutil=no"
+unamestr=$(uname)
+if [[ "$unamestr" == 'Linux' ]]; then
+   export RUSTFLAGS='-Clink-arg=-Wl,-rpath=$ORIGIN/../lib '$RUSTFLAGS
+elif [[ "$unamestr" == 'Darwin' ]]; then
+   export RUSTFLAGS='-Clink-arg=-Wl,-rpath,@loader_path/../lib -Zosx-rpath-install-name '$RUSTFLAGS
+   dylib_ext='dylib'
+else
+   echo "Unsupported os"
+   exit 1
+fi
 if [[ "$CHANNEL" == "release" ]]; then
     cargo build --release
 else
index 1ac6bf265b42a185cb61588aab11ffe9357560b0..aaacd57a4af31f7190d0a5fd7a50764030fef3c0 100644 (file)
@@ -53,7 +53,7 @@ if [[ $(uname) == 'Darwin' ]]; then
    export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
 fi
 
-export LD_LIBRARY_PATH="$dir/lib:$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib"
+export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib"
 export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
 
 export CG_CLIF_DISPLAY_CG_TIME=1