Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: November 15, 2024, 2:30 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing scripts for UNIX-like operating systems
#4
RE: Writing scripts for UNIX-like operating systems
(January 13, 2023 at 5:05 pm)FlatAssembler Wrote: I've tried to write a as-portable-as-possible script for downloading the source code and building the Analog Clock in AEC (AEC being the programming language I've designed and written two compilers for).
For AEC-to-x86:
Code:
mkdir ArithmeticExpressionCompiler
cd ArithmeticExpressionCompiler
if [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ] # Check if "wget" exists, see those StackOverflow answers for more details:
                                                                                         # https://stackoverflow.com/a/75103891/8902065
                                                                                         # https://stackoverflow.com/a/75103209/8902065
then
  wget https://flatassembler.github.io/Duktape.zip
else
  curl -o Duktape.zip https://flatassembler.github.io/Duktape.zip
fi
unzip Duktape.zip
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  gcc -o aec aec.c duktape.c -lm # The linker that comes with recent versions of Debian Linux insists that "-lm" is put AFTER the source files, or else it outputs some confusing error message.
else
  clang -o aec aec.c duktape.c -lm
fi
./aec analogClock.aec
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  gcc -o analogClock analogClock.s -m32
else
  clang -o analogClock analogClock.s -m32
fi
./analogClock
        
For AEC-to-WebAssembly:
Code:
if [ $(command -v git > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  git clone https://github.com/FlatAssembler/AECforWebAssembly.git
  cd AECforWebAssembly
elif [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  mkdir AECforWebAssembly
  cd AECforWebAssembly
  wget https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip
  unzip master.zip
  cd AECforWebAssembly-master
else
  mkdir AECforWebAssembly
  cd AECforWebAssembly
  curl -o AECforWebAssembly.zip -L https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip # Without the "-L", "curl" will store HTTP Response headers of redirects to the ZIP file instead of the actual ZIP file.
  unzip AECforWebAssembly.zip
  cd AECforWebAssembly-master
fi
if [ $(command -v g++ > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  g++ -std=c++11 -o aec AECforWebAssembly.cpp # "-std=c++11" should not be necessary for newer versions of "g++". Let me know if it is, as that probably means I disobeyed some new C++ standard (say, C++23).
else
  clang++ -o aec AECforWebAssembly.cpp
fi
cd analogClock
../aec analogClock.aec
npx -p wabt wat2wasm analogClock.wat
node analogClock
Is there anybody knowledgeable about various operating systems here to know how to make the scripts better?

Yes.

My consulting rate is $250 USD / hour with a 4 hour minimum.
Reply



Messages In This Thread
RE: Writing scripts for UNIX-like operating systems - by Jackalope - January 13, 2023 at 5:34 pm

Possibly Related Threads...
Thread Author Replies Views Last Post
  License for operating social media Fake Messiah 2 865 December 16, 2022 at 10:41 pm
Last Post: Rev. Rye
  TempleOS: a Christian Operating System Rev. Rye 5 1473 December 23, 2018 at 12:32 pm
Last Post: Rev. Rye
  Operating systems Wars! Sterben 60 6119 March 14, 2017 at 8:49 pm
Last Post: Sterben
  Using SSDs for dual boot systems emjay 9 1816 November 8, 2016 at 7:33 pm
Last Post: emjay



Users browsing this thread: 3 Guest(s)