Skip to content

Commit

Permalink
Allow environment variable to set the Lua executable
Browse files Browse the repository at this point in the history
For some distros (e.g. Arch Linux) packaging binaries compiled elsewhere
is a big no-no, and the more so when they are duplicates of something
the system has anyway. The current Arch Linux packaging for example has
to remove the generated binaries from the installation, then patch this
wrapper script to use the system Lua executable.

This change will make that process easier. First it will be possible to
run with a different Lua executable by setting an environment variable:

    LUA_EXECUTABLE=/usr/bin/lua zbstudio

Second, the coding style in the script will make it much easier to patch
to make the that choice stick.
  • Loading branch information
alerque committed Feb 12, 2020
1 parent e09d861 commit 8c43e96
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions zbstudio/zbstudio.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#!/usr/bin/env sh

if [[ "$(uname -m)" == "x86_64" ]]; then ARCH="x64"; else ARCH="x86"; fi
CWD="$PWD" # save the current directory, as it's going to change
# Stash the current PWD so we can pass it to the IDE, the
# IDE itself will be launched from it's own location
CWD="$PWD"

# Figure out which architecture binary is approprate for the host system
case $(uname -m) in
*64) ARCH="x64" ;;
*) ARCH="x86" ;;
esac

# Lua executable to run, can be overridden with ENV variable
: ${LUA_EXECUTABLE:="bin/linux/$ARCH/lua"}

cd "@IDE_DATADIR@"
exec bin/linux/$ARCH/lua src/main.lua zbstudio -cwd "$CWD" "$@"
exec "$LUA_EXECUTABLE" src/main.lua zbstudio -cwd "$CWD" "$@"

0 comments on commit 8c43e96

Please sign in to comment.