From 4f974b48fe52530ddd14e4174c3f805fc10d5cfa Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Thu, 8 Sep 2022 22:42:30 -0400 Subject: [PATCH] check if lld is available before using in RUSTFLAGS --- justfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/justfile b/justfile index f8b6cde..7e5517f 100644 --- a/justfile +++ b/justfile @@ -1,14 +1,9 @@ -# load any variables in .env set dotenv-load := true - -# version of rustc used for cargo commands rustc-version := "nightly" - -# name of crate registry to publish versions of this tool to publish-registry := "shipyard-rs-public" -# env settings exported for cargo settings -export RUSTFLAGS := "-C link-arg=-fuse-ld=lld -C target-cpu=native" +# complicated/ugly one-liner to use lld linker if it's available +export RUSTFLAGS := `LLD=$(which lld) && test $? -eq "0" && echo "-C link-arg=-fuse-ld=lld" || echo ''` # cargo wrapper; executes a cargo command using the settings in justfile (RUSTFLAGS, etc.) cargo +args='':