From 5728f680762145d3cd1e9a5428412e0a13df1598 Mon Sep 17 00:00:00 2001 From: Wen Kokke Date: Thu, 2 Jul 2020 15:46:48 +0100 Subject: [PATCH] Install packages to lua_modules/, add to path if found. --- .gitignore | 5 ++--- .travis.yml | 1 + Makefile | 7 ++++++- epub/set_paths.lua | 4 ++++ 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 epub/set_paths.lua diff --git a/.gitignore b/.gitignore index 0967dd49..3a8c59f5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,12 +21,11 @@ Gemfile.lock *.spl *.synctex.gz -## EPUB files -*.epub +## Lua files +lua_modules/ ## Emacs files auto/ ## Misc build files out/ -src/plfa/acknowledgements_epub.md diff --git a/.travis.yml b/.travis.yml index 70d53641..edce3071 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ cache: addons: apt: packages: + - epubcheck - libgmp-dev - libicu-dev - luarocks diff --git a/Makefile b/Makefile index cdde572d..9edb2ab5 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,11 @@ AGDAI := $(shell find . -type f -and \( -path '*/src/*' -or -path '*/courses/*' LUA := $(shell find . -type f -and -path '*/epub/*' -and -name '*.lua') MARKDOWN := $(subst courses/,out/,$(subst src/,out/,$(subst .lagda.md,.md,$(AGDA)))) PLFA_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +LUA_MODULES := lua_modules/ + +ifneq ($(wildcard $(LUA_MODULES)),) + LUA_FLAGS += -l epub/set_paths +endif ifeq ($(AGDA_STDLIB_VERSION),) AGDA_STDLIB_URL := https://agda.github.io/agda-stdlib/ @@ -69,7 +74,7 @@ out/epub/plfa.epub: out/epub/ | $(AGDA) $(LUA) epub/main.css out/epub/acknowledg epub/index.md out/epub/acknowledgements.md: src/plfa/acknowledgements.md _config.yml - lua epub/render-liquid-template.lua _config.yml $< $@ + lua $(LUA_FLAGS) epub/render-liquid-template.lua _config.yml $< $@ # Convert literal Agda to Markdown diff --git a/epub/set_paths.lua b/epub/set_paths.lua new file mode 100644 index 00000000..3242dbdd --- /dev/null +++ b/epub/set_paths.lua @@ -0,0 +1,4 @@ +-- set_paths.lua +local version = _VERSION:match("%d+%.%d+") +package.path = 'lua_modules/share/lua/' .. version .. '/?.lua;lua_modules/share/lua/' .. version .. '/?/init.lua;' .. package.path +package.cpath = 'lua_modules/lib/lua/' .. version .. '/?.so;' .. package.cpath \ No newline at end of file