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 PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin BINDIR ?= $(PREFIX)/bin
OPTS=--add-package-path "src/?.lua" --add-fennel-path "src/?.fnl" FENNELFLAGS=--add-package-path "src/?.lua" --add-fennel-path "src/?.fnl"
OPTS+=--skip-include fennel.compiler FENNELFLAGS+=--skip-include fennel.compiler
EXTRA_FENNELFLAGS ?=
FENNELFLAGS+= $(EXTRA_FENNELFLAGS)
.PHONY: all clean test install ci selfcheck .PHONY: all clean test install ci selfcheck
@ -21,7 +23,7 @@ all: $(EXE)
$(EXE): $(SRC) $(EXE): $(SRC)
echo "#!/usr/bin/env $(LUA)" > $@ 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 $@ chmod 755 $@
clean: clean:
@ -29,10 +31,10 @@ clean:
rm -rf $(BUILD_DIR) rm -rf $(BUILD_DIR)
test: 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: repl:
$(FENNEL) $(OPTS) --add-fennel-path "test/faith/?.fnl" $(FENNEL) $(FENNELFLAGS) --add-fennel-path "test/faith/?.fnl"
testall: testall:
$(MAKE) test LUA=lua5.1 $(MAKE) test LUA=lua5.1
@ -42,7 +44,7 @@ testall:
$(MAKE) test LUA=luajit $(MAKE) test LUA=luajit
docs: 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) install: $(EXE)
mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/ mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/
@ -50,4 +52,4 @@ install: $(EXE)
ci: testall $(EXE) ci: testall $(EXE)
selfcheck: 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" "src/fennel.lua"
;; delete vendored "fennel" (build dependency) ;; delete vendored "fennel" (build dependency)
"fennel" "fennel"
;; delete vendored "faith" (build dependency) ;; delete vendored "faith" (test dependency)
"test/faith/faith.fnl" "test/faith/faith.fnl"
;; delete vendored "penlight" (build dependency) ;; delete vendored "penlight" (test dependency)
"test/pl/stringio.lua") "test/pl/stringio.lua")
;; write a dummy file to forward to the installation of penlight on LUA_PATH ;; I can't delete rxi/json because fennel-ls has a forked version with custom patches.
(doto (io.open "test/pl/stringio.lua") ;; 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)") (: :write "(require :pl.stringio)")
(: :close)) (: :close))

View File

@ -16,15 +16,15 @@
"https://git.sr.ht/~technomancy/fennel" "https://git.sr.ht/~technomancy/fennel"
fennel-version) fennel-version)
(sh :make :-C "build/fennel")) (sh :make :-C "build/fennel"))
sh :cp "build/fennel/fennel" "." (sh :cp "build/fennel/fennel" ".")
(sh :cp "build/fennel/fennel.lua" "src") (sh :cp "build/fennel/fennel.lua" "src")
;; get faith ;; 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)) (git-clone "build/faith" "https://git.sr.ht/~technomancy/faith" faith-version))
(sh :cp "build/faith/faith.fnl" "test/faith/faith.fnl") (sh :cp "build/faith/faith.fnl" "test/faith/faith.fnl")
;; get penlight.stringio ;; 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)) (git-clone "build/penlight" "https://github.com/lunarmodules/Penlight" penlight-version))
(sh :cp "build/penlight/lua/pl/stringio.lua" "test/pl/stringio.lua") (sh :cp "build/penlight/lua/pl/stringio.lua" "test/pl/stringio.lua")