More tools changes

This commit is contained in:
XeroOl 2024-06-08 00:35:28 -05:00
parent 083383cfa4
commit c92c834cf6
3 changed files with 19 additions and 14 deletions

View File

@ -12,8 +12,10 @@ DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
OPTS=--add-package-path "src/?.lua" --add-fennel-path "src/?.fnl"
OPTS+=--skip-include fennel.compiler
FENNELFLAGS=--add-package-path "src/?.lua" --add-fennel-path "src/?.fnl"
FENNELFLAGS+=--skip-include fennel.compiler
EXTRA_FENNELFLAGS ?=
FENNELFLAGS+= $(EXTRA_FENNELFLAGS)
.PHONY: all clean test install ci selfcheck
@ -21,7 +23,7 @@ all: $(EXE)
$(EXE): $(SRC)
echo "#!/usr/bin/env $(LUA)" > $@
$(FENNEL) $(OPTS) --require-as-include --compile src/fennel-ls.fnl >> $@
$(FENNEL) $(FENNELFLAGS) --require-as-include --compile src/fennel-ls.fnl >> $@
chmod 755 $@
clean:
@ -29,10 +31,10 @@ clean:
rm -rf $(BUILD_DIR)
test:
TESTING=1 $(FENNEL) $(OPTS) --add-fennel-path "test/faith/?.fnl" test/init.fnl
TESTING=1 $(FENNEL) $(FENNELFLAGS) --add-fennel-path "test/faith/?.fnl" test/init.fnl
repl:
$(FENNEL) $(OPTS) --add-fennel-path "test/faith/?.fnl"
$(FENNEL) $(FENNELFLAGS) --add-fennel-path "test/faith/?.fnl"
testall:
$(MAKE) test LUA=lua5.1
@ -42,7 +44,7 @@ testall:
$(MAKE) test LUA=luajit
docs:
$(FENNEL) $(OPTS) --add-fennel-path "tools/?.fnl" tools/gen-docs.fnl
$(FENNEL) $(FENNELFLAGS) --add-fennel-path "tools/?.fnl" tools/gen-docs.fnl
install: $(EXE)
mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/
@ -50,4 +52,4 @@ install: $(EXE)
ci: testall $(EXE)
selfcheck:
$(FENNEL) $(OPTS) src/fennel-ls.fnl --check $(SRC)
$(FENNEL) $(FENNELFLAGS) src/fennel-ls.fnl --check $(SRC)

View File

@ -5,12 +5,15 @@
"src/fennel.lua"
;; delete vendored "fennel" (build dependency)
"fennel"
;; delete vendored "faith" (build dependency)
;; delete vendored "faith" (test dependency)
"test/faith/faith.fnl"
;; delete vendored "penlight" (build dependency)
;; delete vendored "penlight" (test dependency)
"test/pl/stringio.lua")
;; write a dummy file to forward to the installation of penlight on LUA_PATH
(doto (io.open "test/pl/stringio.lua")
;; I can't delete rxi/json because fennel-ls has a forked version with custom patches.
;; I'm working to address this. fennel-ls' forked version will not interfere with the normal version because its statically linked.
;; write a dummy file so that the tests search for penlight on LUA_PATH
(doto (io.open "test/pl/stringio.lua" :w)
(: :write "(require :pl.stringio)")
(: :close))

View File

@ -16,15 +16,15 @@
"https://git.sr.ht/~technomancy/fennel"
fennel-version)
(sh :make :-C "build/fennel"))
sh :cp "build/fennel/fennel" "."
(sh :cp "build/fennel/fennel" ".")
(sh :cp "build/fennel/fennel.lua" "src")
;; get faith
(when (not (io.open "build/fennel/faith.fnl"))
(when (not (io.open "build/faith/faith.fnl"))
(git-clone "build/faith" "https://git.sr.ht/~technomancy/faith" faith-version))
(sh :cp "build/faith/faith.fnl" "test/faith/faith.fnl")
;; get penlight.stringio
(when (not (io.open "build/pl/stringio.lua"))
(when (not (io.open "build/penlight/lua/pl/stringio.lua"))
(git-clone "build/penlight" "https://github.com/lunarmodules/Penlight" penlight-version))
(sh :cp "build/penlight/lua/pl/stringio.lua" "test/pl/stringio.lua")