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

modify lua bash script to work with cygwin and mingw on windows #2

Open
tapir opened this issue Mar 11, 2016 · 0 comments
Open

modify lua bash script to work with cygwin and mingw on windows #2

tapir opened this issue Mar 11, 2016 · 0 comments

Comments

@tapir
Copy link

tapir commented Mar 11, 2016

Hi,

For people that want to use ulua from cygwin or mingw can you modify the bash script to work with it. With my limited bash-fu I rewrote the bash file. Everything seems to be OK yet somehow it can't find the __init module.

Here is the file if you want a headstart

#!/bin/bash
if [[ "$(arch)" == *"32"* ]]; then
  LJ_ARCH="x86"
elif [[ "$(arch)" == *"64"* ]]; then
  LJ_ARCH="x64"
else
  echo "ERROR - Unsupported system architecture: $(arch)" 1>&2 && exit 1
fi

if [[ "$(uname -s)" == *"MINGW"* ]] || [[ "$(uname -s)" == *"CYGWIN"* ]]; then
  LJ_SYS="Windows"
elif [[ "$(uname)" == "Darwin" ]]; then
  LJ_SYS="OSX"
elif [[ "$(uname -s)" == *"Linux"* ]]; then
  LJ_SYS="Linux"
else
  echo "ERROR - Unsupported system: $(uname -s)" 1>&2 && exit 1
fi

if [[ "$LJ_SYS" == "Windows" ]]; then
  SO_EXT="dll"
else
  SO_EXT="so"
fi

LJ_VER_EXT="luajit/2_1_head20151128"
LUA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LJ_CORE="$LUA_ROOT/$LJ_VER_EXT/$LJ_SYS/$LJ_ARCH"
LUA_PATH="$LJ_CORE/?.lua;$LUA_ROOT/?/init.lua;$LUA_ROOT/?.lua;$LJ_CORE/?/init.lua;"
LUA_CPATH="$LUA_ROOT/?.$SO_EXT;$LUA_ROOT/loadall.$SO_EXT;"

export LUA_ROOT="$LUA_ROOT"
export LUA_PATH="$LUA_PATH"
export LUA_CPATH="$LUA_CPATH"

"$LJ_CORE/luajit" -l__init $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant