From 49c11b425107786c9b696a2a535eb31f6f371df7 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Mon, 13 Jan 2020 23:18:14 -0500 Subject: Updated ./run.sh script. --- run.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index eb97199..c724a32 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # MESA_GLSL_VERSION_OVERRIDE # @@ -41,15 +41,25 @@ #cmd=gix cmd=meshsketch +cmdpath=$(ls -1ta $(find .stack-work/ dist/ dist-newstyle -type f -name $cmd 2>/dev/null) | head -n1) -quiet() { "$@" >/dev/null 2>&1; } +[ -n "$cmdpath" ] || stack build -quiet which $cmd || quiet stack exec -- which $cmd || stack build +cmdpath=$(ls -1ta $(find .stack-work/ dist/ dist-newstyle -type f -name $cmd 2>/dev/null) | head -n1) -[ -e .stack-work ] && run='stack run --' || run= +if [ "${cmdpath#.stack-work}" = "$cmdpath" ]; then + lc=./lc +else + lc="stack run -- lc" +fi + +export MESA_GL_VERSION_OVERRIDE=3.3 +export MESA_GLSL_VERSION_OVERRIDE=330 + +set -x if [ "$cmd" = meshsketch ]; then - [ -e hello_obj2.json ] || $run lc hello_obj2.lc + [ ! -e hello_obj2.json -o hello_obj2.json -ot hello_obj2.lc ] && $lc hello_obj2.lc fi -MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330 $run $cmd +$cmdpath "$@" -- cgit v1.2.3