Skip to content

Commit

Permalink
Improve install on mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Sep 3, 2020
1 parent 6703456 commit 6d3014d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BUSTED=busted
LUACOV=luacov
LUAMON=luamon -w nelua,spec,tools,examples,lib,tests -e lua,nelua -q -x
JEKYLL=bundle exec jekyll
PREFIX=/usr/local

## Variables for Docker
UID=$(shell id -u $(USER))
Expand All @@ -49,10 +50,8 @@ endif
## Detect the lua interpreter to use.
ifeq ($(SYS), Windows)
LUA=$(realpath $(NELUALUA).exe)
PREFIX=/usr
else
LUA=$(NELUALUA)
PREFIX=/usr/local
endif

## The default target.
Expand Down
10 changes: 9 additions & 1 deletion nelua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,13 @@ if [ ! -f "$NELUA_LUALIB/nelua.lua" ]; then
exit 1
fi

# determine nelua's lua package path
if [[ "$OSTYPE" = "msys" ]]; then
NELUA_PACKAGE_PATH="$(cygpath -w $NELUA_LUALIB/)"
else
NELUA_PACKAGE_PATH="$NELUA_LUALIB/"
fi
NELUA_PACKAGE_PATH="$(printf "%q\n" "$NELUA_PACKAGE_PATH")"

# execute nelua compiler
exec $NELUA_LUA -e "package.path='$NELUA_LUALIB/?.lua;'..package.path" $NELUA_LUALIB/nelua.lua "$@"
exec $NELUA_LUA -e "package.path='${NELUA_PACKAGE_PATH}?.lua;'..package.path" $NELUA_LUALIB/nelua.lua "$@"
4 changes: 1 addition & 3 deletions nelua/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ local function run(argv, redirect)
input = fs.ereadfile(infile)
end

if config.before_parse then
config.before_parse()
end
if config.before_parse then config.before_parse() end

-- parse ast
local parser = syntax.parser
Expand Down
7 changes: 0 additions & 7 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ ifneq (,$(findstring MSYS,$(SYS)))
SYS=Windows
endif

## Prefix
ifeq ($(SYS), Windows)
PREFIX=/usr
else
PREFIX=/usr/local
endif

## Install path
DEFS+=-DLUA_ROOT='"$(PREFIX)/"'

Expand Down

0 comments on commit 6d3014d

Please sign in to comment.