Install packages to lua_modules/, add to path if found.

This commit is contained in:
Wen Kokke 2020-07-02 15:46:48 +01:00
parent 0b4df68fba
commit 5728f68076
4 changed files with 13 additions and 4 deletions

5
.gitignore vendored
View file

@ -21,12 +21,11 @@ Gemfile.lock
*.spl *.spl
*.synctex.gz *.synctex.gz
## EPUB files ## Lua files
*.epub lua_modules/
## Emacs files ## Emacs files
auto/ auto/
## Misc build files ## Misc build files
out/ out/
src/plfa/acknowledgements_epub.md

View file

@ -21,6 +21,7 @@ cache:
addons: addons:
apt: apt:
packages: packages:
- epubcheck
- libgmp-dev - libgmp-dev
- libicu-dev - libicu-dev
- luarocks - luarocks

View file

@ -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') LUA := $(shell find . -type f -and -path '*/epub/*' -and -name '*.lua')
MARKDOWN := $(subst courses/,out/,$(subst src/,out/,$(subst .lagda.md,.md,$(AGDA)))) MARKDOWN := $(subst courses/,out/,$(subst src/,out/,$(subst .lagda.md,.md,$(AGDA))))
PLFA_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) 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),) ifeq ($(AGDA_STDLIB_VERSION),)
AGDA_STDLIB_URL := https://agda.github.io/agda-stdlib/ 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 epub/index.md
out/epub/acknowledgements.md: src/plfa/acknowledgements.md _config.yml 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 # Convert literal Agda to Markdown

4
epub/set_paths.lua Normal file
View file

@ -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