Build a shebanged executable instead of a binary.

This makes the build itself a lot more portable. The executable of
course relies on lua being installed on the machine, but this will
nearly always be the case for a program used by Fennel developers.

Bonus: removes the direct use of the fennel.utils module which was
only used for the table? function and was causing a warning.
This commit is contained in:
Phil Hagelberg 2022-09-07 22:05:58 -07:00 committed by XeroOl
parent 783b1858b2
commit 3eeebdbf11
No known key found for this signature in database
GPG Key ID: 9DD4B4B4DAED0322
2 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,3 @@
LUA_LIB=/usr/lib/liblua.so.5.4
LUA_INCLUDE_DIR=/usr/include/lua5.4
FENNEL=./fennel
EXE=fennel-ls
@ -11,10 +9,13 @@ SRC+=$(wildcard src/fennel-ls/*.fnl)
all: $(EXE)
$(EXE): $(SRC)
LUA_PATH="./src/?.lua;./src/?/init.lua" FENNEL_PATH="./src/?.fnl;./src/?/init.fnl" $(FENNEL) --compile-binary src/fennel-ls.fnl fennel-ls $(LUA_LIB) $(LUA_INCLUDE_DIR)
echo "#!/usr/bin/env lua" > $@
LUA_PATH="./src/?.lua;./src/?/init.lua" FENNEL_PATH="./src/?.fnl;./src/?/init.fnl" \
$(FENNEL) --require-as-include --compile src/fennel-ls.fnl >> $@
chmod 755 $@
clean:
rm -f fennel-ls
rm -f $(EXE)
test:
# requires busted to be installed

View File

@ -2,8 +2,7 @@
The high level analysis system that does deep searches following
the data provided by compiler.fnl."
(local {: sym? : list? : sequence? : sym : view} (require :fennel))
(local {: table?} (require :fennel.utils))
(local {: sym? : list? : sequence? : varg? : sym : view} (require :fennel))
(local utils (require :fennel-ls.utils))
(local state (require :fennel-ls.state))
@ -147,7 +146,7 @@ the data provided by compiler.fnl."
&until result]
(if (contains? child byte)
(recurse child byte)))
(table? ast)
(and (not (sym? ast)) (not (varg? ast)))
(accumulate [(result done) nil
key value (pairs ast)
&until done]