diff --git a/compile b/compile index 8a76f4a062438c59397aee1a1ec5207296886c24..295890fa6177ffa253c2dac364894316b4f1b70e 100755 --- a/compile +++ b/compile @@ -23,35 +23,37 @@ then ./sanityCheck fi -case "$(uname -m)" in -x86_64|amd64) - echo "x64 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" - fi - ;; -x86|i[3-6]86) - echo "x86 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" - fi - ;; -arm*) - echo "arm arch" - # tweego doesn't provide arm binaries so you have to build it yourself - export TWEEGO_PATH=devTools/tweeGo/storyFormats - TWEEGO_EXE="tweego" - ;; -*) - echo "unsupported architecture" - exit 2 -esac +export TWEEGO_PATH=devTools/tweeGo/storyFormats +TWEEGO_EXE="tweego" + +if hash $TWEEGO_EXE 2>/dev/null; then + echo "system tweego binary" +else + case "$(uname -m)" in + x86_64|amd64) + echo "x64 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" + fi + ;; + x86|i[3-6]86) + echo "x86 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" + fi + ;; + *) + echo "No system tweego binary found, and no pecompiled binary for your platform available" + echo "Please compile tweego and put the executable in PATH" + exit 2 + esac +fi -$TWEEGO_EXE -o "bin/FC_pregmod.html" src/ || build_failed="true" +$TWEEGO_EXE -o "bin/FC_pregmod_tmp.html" src/ || build_failed="true" # Revert AlphaDisclaimer for next compilation git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw @@ -62,4 +64,5 @@ then fi #Make the output prettier, replacing \t with a tab and \n with a newline -sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod.html +sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod_tmp.html \ + && mv bin/FC_pregmod_tmp.html bin/FC_pregmod.html diff --git a/compile-git b/compile-git index a50b484b4223b4300b34187ef2e4be4917faf1f6..f077fe27905091abd6b7511ae45a4e9607d140bd 100755 --- a/compile-git +++ b/compile-git @@ -5,37 +5,40 @@ HASH="$(git rev-list -n 1 --abbrev-commit HEAD)" -case "$(uname -m)" in -x86_64|amd64) - echo "x64 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" - fi - ;; -x86|i[3-6]86) - echo "x86 arch" - if [ "$(uname -s)" = "Darwin" ]; then - TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" - else - TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" - fi - ;; -arm*) - echo "arm arch" - # tweego doesn't provide arm binaries so you have to build it yourself - export TWEEGO_PATH=devTools/tweeGo/storyFormats - TWEEGO_EXE="tweego" - ;; -*) - echo "unsupported architecture" - exit 2 -esac +export TWEEGO_PATH=devTools/tweeGo/storyFormats +TWEEGO_EXE="tweego" -$TWEEGO_EXE -o "bin/FC_pregmod_$HASH.html" src/ +if hash $TWEEGO_EXE 2>/dev/null; then + echo "system tweego binary" +else + case "$(uname -m)" in + x86_64|amd64) + echo "x64 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" + fi + ;; + x86|i[3-6]86) + echo "x86 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" + fi + ;; + *) + echo "No system tweego binary found, and no pecompiled binary for your platform available" + echo "Please compile tweego and put the executable in PATH" + exit 2 + esac +fi + +$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ #Make the output prettier, replacing \t with a tab and \n with a newline -sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_$HASH.html" +sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \ + && mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html" -echo "FC_pregmod_$HASH.html" compilation finished. +echo "FC_pregmod_$HASH.html compilation finished."