-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add Lua 5.3 compatibility and fix script argument handling #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| /bin/ | ||
| /obj/ | ||
| Makefile | ||
| *.make | ||
| bin | ||
| obj | ||
| .cache | ||
|
|
||
|
|
||
| *.log | ||
|
|
||
|
|
||
| .cache/ | ||
|
|
||
|
|
||
| .vscode/ | ||
|
|
||
|
|
||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| build-tracer.lisp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [submodule "lib/compat53"] | ||
| path = lib/compat53 | ||
| url = https://github.com/lunarmodules/lua-compat-5.3.git | ||
| [submodule "lib/hashmap"] | ||
| path = lib/hashmap | ||
| url = https://github.com/tidwall/hashmap.c.git | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Function to install packages using apt (Debian/Ubuntu) | ||
| install_with_apt() { | ||
| sudo apt-get update | ||
| sudo apt-get install -y lua5.4 liblua5.4-dev | ||
| } | ||
|
|
||
| # Function to install packages using yum (Red Hat/CentOS) | ||
| install_with_yum() { | ||
| sudo yum install -y epel-release | ||
| sudo yum install -y lua lua-devel | ||
| } | ||
|
|
||
| # New package manager used in Fedora | ||
| install_with_dnf() { | ||
| sudo dnf install -y lua lua-devel | ||
| } | ||
|
|
||
| # Function to install packages using pacman (Arch Linux) | ||
| install_with_pacman() { | ||
| sudo pacman -Sy --noconfirm lua | ||
| } | ||
|
|
||
| if [ -f /etc/arch-release ]; then | ||
| install_with_pacman | ||
| elif [ -f /etc/debian_version ]; then | ||
| install_with_apt | ||
| elif [ -f /etc/redhat-release ] || [ -f /etc/centos-release ]; then | ||
| if command -v dnf >/dev/null 2>&1; then | ||
| install_with_dnf | ||
| else | ||
| install_with_yum | ||
| fi | ||
| else | ||
| echo "Your linux distro is not supported currently." | ||
| echo "You need to manually install these packages: lua and your distro's lua dev package" | ||
| fi | ||
|
|
||
| PREMAKE_VERSION="5.0.0-beta2" | ||
| OS="linux" | ||
|
|
||
| echo "downloading premake $PREMAKE_VERSION" | ||
| wget -q https://github.com/premake/premake-core/releases/download/v${PREMAKE_VERSION}/premake-${PREMAKE_VERSION}-${OS}.tar.gz -O premake.tar.gz | ||
| echo "extracting premake" | ||
| tar -xzf premake.tar.gz | ||
| echo "installing premake" | ||
| sudo mv premake5 example.so libluasocket.so /usr/bin | ||
| sudo chmod +x /usr/bin/premake5 | ||
| rm premake.tar.gz | ||
|
|
||
| premake5 gmake | ||
| make | ||
| if [ ! -d ~/.lush ]; then | ||
| cp -rf ./.lush ~/ | ||
| fi | ||
|
|
||
| # always update example | ||
| cp -f ./.lush/scripts/example.lua ~/.lush/scripts/example.lua | ||
|
|
||
| # Install the new shell binary to a temporary location | ||
| sudo cp ./bin/Debug/lush/lush /usr/bin/lush.new | ||
|
|
||
| # Atomically replace the old binary | ||
| sudo mv /usr/bin/lush.new /usr/bin/lush | ||
|
|
||
| # Ensure the shell is registered in /etc/shells | ||
| if ! grep -Fxq "/usr/bin/lush" /etc/shells; then | ||
| echo "/usr/bin/lush" | sudo tee -a /etc/shells >/dev/null | ||
| fi | ||
|
|
||
| # Optionally change the shell | ||
| chsh -s /usr/bin/lush | ||
|
|
||
| echo "=====================" | ||
| echo "INSTALLATION FINISHED" | ||
| echo "=====================" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,34 @@ | ||
| workspace("lush") | ||
| configurations({ "Debug", "Release" }) | ||
|
|
||
| -- lush project | ||
| project("lush") | ||
| kind("ConsoleApp") | ||
| language("C") | ||
| targetdir("bin/%{cfg.buildcfg}/lush") | ||
|
|
||
| local lua_inc_path = "/usr/include" | ||
| local lua_lib_path = "/usr/lib" | ||
| links({ "lua5.4" }) | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what there an issue with how the linking/including was handled that would make these changes needed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, there was definitely an issue with how the linking was handled. The original approach using The Main Problem:
The generic So What Was Happening?: By switching to
Additional Context: pkg-config --libs lua5.4 # Returns: -llua5.4The include path ( The original linking approach assumed a generic Also, for some additional context here:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I apologize for not covering that in my pull description. I actually forgot I even made that change. I need to start keeping tabs in a notebook or something of what changes I made and where, for Open Source projects. |
||
| if os.findlib("lua5.4") then | ||
| lua_inc_path = "/usr/include/lua5.4" | ||
| lua_lib_path = "/usr/lib/5.4" | ||
| links({ "lua5.4" }) | ||
| else | ||
| links({ "lua" }) | ||
| end | ||
| -- Add all necessary include directories | ||
| includedirs({ | ||
| lua_inc_path, | ||
| "lib/hashmap", | ||
| "lib/compat53/c-api" | ||
| }) | ||
|
|
||
| includedirs({ lua_inc_path, "lib/hashmap" }) | ||
| libdirs({ lua_lib_path }) | ||
| libdirs({ "/usr/lib" }) | ||
|
|
||
| -- Compile all necessary source files, including the compat library | ||
| files({ | ||
| "src/**.h", | ||
| "src/**.c", | ||
| "lib/hashmap/**.h", | ||
| "lib/hashmap/**.c", | ||
| "src/**.h", | ||
| "src/**.c", | ||
| "lib/hashmap/hashmap.h", | ||
| "lib/hashmap/hashmap.c", | ||
| "lib/compat53/c-api/compat-5.3.h", | ||
| "lib/compat53/c-api/compat-5.3.c" | ||
| }) | ||
| defines({ 'LUSH_VERSION="0.3.2"' }) | ||
|
|
||
| defines({ 'LUSH_VERSION="0.3.2"', 'COMPAT53_PREFIX=""' }) | ||
|
|
||
| filter("configurations:Debug") | ||
| defines({ "DEBUG" }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why rename the file instead of using the .sh extension