From 2bad480b4f59cd047626b9b5697eb90fa723ef07 Mon Sep 17 00:00:00 2001 From: MrAzteca Date: Wed, 27 Nov 2024 18:33:55 +0100 Subject: [PATCH] Fix `env.sh`. (#944) --- env.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/env.sh b/env.sh index 4e85405f0..cc1284601 100644 --- a/env.sh +++ b/env.sh @@ -4,6 +4,10 @@ # # You can copy this file to .envrc/.env and adapt it for your environment. +# This line will ensure that the script can be used from any directory, not just +# the project's root. +ROOT_DIR="$(realpath $(dirname "${BASH_SOURCE[0]}"))" + case $(uname) in Darwin) # If installed with brew @@ -11,7 +15,7 @@ case $(uname) in MLIR_SYS_190_PREFIX="$(brew --prefix llvm@19)" LLVM_SYS_191_PREFIX="$(brew --prefix llvm@19)" TABLEGEN_190_PREFIX="$(brew --prefix llvm@19)" - CAIRO_NATIVE_RUNTIME_LIBRARY="$(pwd)/target/release/libcairo_native_runtime.a" + CAIRO_NATIVE_RUNTIME_LIBRARY="$ROOT_DIR/target/release/libcairo_native_runtime.a" export LIBRARY_PATH export MLIR_SYS_190_PREFIX @@ -24,7 +28,7 @@ case $(uname) in MLIR_SYS_190_PREFIX=/usr/lib/llvm-19 LLVM_SYS_191_PREFIX=/usr/lib/llvm-19 TABLEGEN_190_PREFIX=/usr/lib/llvm-19 - CAIRO_NATIVE_RUNTIME_LIBRARY="$(pwd)/target/release/libcairo_native_runtime.a" + CAIRO_NATIVE_RUNTIME_LIBRARY="$ROOT_DIR/target/release/libcairo_native_runtime.a" export MLIR_SYS_190_PREFIX export LLVM_SYS_191_PREFIX