Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ShellCheck Warnings and Improve Build Scripts #964

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ if ! gcc -o "$output" ./*.o; then
exit 1
fi

# rm *.o
# Clean up object files (optional)
# rm ./*.o


echo "Running the executable..."
if ! ./"$output" ../example/test6.salam ../out/; then
Expand Down
6 changes: 3 additions & 3 deletions build-webassembly.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Check for emcc installation
if ! command -v emcc >/dev/null 2>&1; then
echo 'Error: emcc is not installed.' >&2
echo 'Install from https://emscripten.org/docs/getting_started/downloads.html'
Expand Down Expand Up @@ -39,11 +40,9 @@ sources=(
"src/main.c"
)

DEBUG=0
DEBUG_FLAGS=""

if [[ "$1" == "debug" ]]; then
DEBUG=1
echo "Debug mode enabled."
DEBUG_FLAGS="-s VERBOSE=1 -s ASSERTIONS=2 -v"
else
Expand All @@ -64,7 +63,8 @@ if emcc "${sources[@]}" -o "${OUTPUT_BASE}.html" \

if command -v npx >/dev/null 2>&1; then
echo "Transpiling JavaScript for older browsers..."
if npx esbuild "${OUTPUT_BASE}.js" --outfile="${OUTPUT_BASE}.transpiled.js" --minify=true --target=esnext; then
if yes | npx esbuild "${OUTPUT_BASE}.js" --outfile="${OUTPUT_BASE}.transpiled.js" --minify=true --target=esnext; then

mv "${OUTPUT_BASE}.transpiled.js" "${OUTPUT_BASE}.js"
else
echo "Warning: Babel transpiling failed. JavaScript was not transpiled."
Expand Down
Loading