-
Notifications
You must be signed in to change notification settings - Fork 10
/
setenv
executable file
·34 lines (30 loc) · 1.11 KB
/
setenv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# execute this command if needed when building on OSX if there are linker errors.
# dylib files in extra-lib-dirs don't get forwarded to ghc
# in some versions of OSX. See https://github.com/commercialhaskell/stack/issues/1826
HASKTORCH_LIB_PATH="$(pwd)/libtorch/lib/"
function add_vendor_lib_path {
case "$(uname)" in
"Darwin")
DYLD_LIBRARY_PATH=$HASKTORCH_LIB_PATH:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
;;
"Linux"|"FreeBSD")
LD_LIBRARY_PATH=$HASKTORCH_LIB_PATH:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
;;
*)
echo "OS doesn't have known environment variable hacks to set"
;;
esac
}
if ! type git &> /dev/null; then
echo "git is not installed, setenv cannot reliably perform checks to set your system's library path"
fi
if [[ "$(basename "$(git rev-parse --show-toplevel)")" == "openmemex" ]] &> /dev/null; then
echo "updating library path..."
add_vendor_lib_path
echo "...done!"
else
echo "couldn't update library path. Please file an issue or adjust this script for your system and submit a pull request"
fi