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
*.synctex.gz
## EPUB files
*.epub
## Lua files
lua_modules/
## Emacs files
auto/
## Misc build files
out/
src/plfa/acknowledgements_epub.md

View file

@ -21,6 +21,7 @@ cache:
addons:
apt:
packages:
- epubcheck
- libgmp-dev
- libicu-dev
- 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')
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

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