Use sh alternatives and fix change directory in building shell scripts (#769)

* Use sh alternatives and fix change directory in building shell scripts

The usage of the cd command in the shell scripts under building/ can
conflict at some point during the procedure. As far as I'm aware, it's
supposed to cd to the parent directory, but it does so strangely. On
some occasions, this may cause the directory to switch to /tmp
on Linux instead. This commit resolves that by instead using the
typical .. syntax, which is a shorthand for the parent directory of the
process.

Additionally, proper shebangs have been added that instead use
"/usr/bin/env sh", which returns the path to a suitable sh alternative:
that is, the closest program that can be found using 'sh' in the name.
This is one of the most recommended shebangs for a shell script, due
to 'env' typically being in the exact same position.

* Update cd in building shell scripts to use script relative path properly

The two prior versions would use the working directory's own parent
directory, not the script's. This commit simply makes it so that
changing the directory in the script uses its directory's parent instead.

* dont mind me

---------

Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
This commit is contained in:
rufius
2025-09-21 17:19:09 +02:00
committed by GitHub
co-authored by ⍚~Nex
parent bacd218e0b
commit 3b8859120f
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
cd "$(dirname "$(cd "$(dirname "$0")" && pwd)")"
#!/usr/bin/env sh
cd "$(dirname "$0")/.."
haxe -cp commandline -D analyzer-optimize --run Main $@
+2 -1
View File
@@ -1,2 +1,3 @@
cd "$(dirname "$(cd "$(dirname "$0")" && pwd)")"
#!/usr/bin/env sh
cd "$(dirname "$0")/.."
haxe -cp commandline -D analyzer-optimize --run Main setup