diff options
-rwxr-xr-x | run.sh | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/bash |
2 | 2 | ||
3 | # MESA_GLSL_VERSION_OVERRIDE | 3 | # MESA_GLSL_VERSION_OVERRIDE |
4 | # | 4 | # |
@@ -41,15 +41,25 @@ | |||
41 | 41 | ||
42 | #cmd=gix | 42 | #cmd=gix |
43 | cmd=meshsketch | 43 | cmd=meshsketch |
44 | cmdpath=$(ls -1ta $(find .stack-work/ dist/ dist-newstyle -type f -name $cmd 2>/dev/null) | head -n1) | ||
44 | 45 | ||
45 | quiet() { "$@" >/dev/null 2>&1; } | 46 | [ -n "$cmdpath" ] || stack build |
46 | 47 | ||
47 | quiet which $cmd || quiet stack exec -- which $cmd || stack build | 48 | cmdpath=$(ls -1ta $(find .stack-work/ dist/ dist-newstyle -type f -name $cmd 2>/dev/null) | head -n1) |
48 | 49 | ||
49 | [ -e .stack-work ] && run='stack run --' || run= | 50 | if [ "${cmdpath#.stack-work}" = "$cmdpath" ]; then |
51 | lc=./lc | ||
52 | else | ||
53 | lc="stack run -- lc" | ||
54 | fi | ||
55 | |||
56 | export MESA_GL_VERSION_OVERRIDE=3.3 | ||
57 | export MESA_GLSL_VERSION_OVERRIDE=330 | ||
58 | |||
59 | set -x | ||
50 | 60 | ||
51 | if [ "$cmd" = meshsketch ]; then | 61 | if [ "$cmd" = meshsketch ]; then |
52 | [ -e hello_obj2.json ] || $run lc hello_obj2.lc | 62 | [ ! -e hello_obj2.json -o hello_obj2.json -ot hello_obj2.lc ] && $lc hello_obj2.lc |
53 | fi | 63 | fi |
54 | 64 | ||
55 | MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330 $run $cmd | 65 | $cmdpath "$@" |