Skip to content

Commit

Permalink
fix(build): Include modules for all supported Lua versions in dist
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Feb 3, 2020
1 parent 19ca14f commit a4e9f03
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ else
SUBDIRS = libtexpdf src
endif

SUPPORTED_LUAS = 5.3 5.2 5.1

dist_man_MANS = sile.1
bin_SCRIPTS = sile
subdir_files = $(shell find core classes languages packages lua-libraries -type f -print)
nobase_dist_pkgdata_DATA = $(subdir_files)
nobase_dist_pkgdata_DATA = $(shell find core classes languages packages lua-libraries -type f -print)
EXTRA_DIST = CHANGELOG.md README.md LICENSE spec tests examples documentation sile-dev-1.rockspec build-aux/git-version-gen .version fontconfig.conf
EXTRA_DIST += $(extra_dist)

SHELL = bash
.ONESHELL:
.SECONDEXPANSION:
.DELETE_ON_ERROR:

if !SYSTEM_LUAROCKS
subdir_files += $(shell find lua_modules -type f -print)
LUAROCKS := luarocks --tree lua_modules
LUAROCKSARGS ?=
nobase_nodist_pkgdata_DATA = $(shell find lua_modules -type f -print)
extra_dist = $(shell find lua_modules_dist -type f -print)
LUAROCKS := luarocks --tree lua_modules --lua-version $(LUA_VERSION)
LUAMODLOCK := sile-dev-1.rockslock
LUAMODSPEC := sile-dev-1.rockspec
genrockslock := $(LUAROCKS) list --porcelain | awk '{print $$1 " " $$2}'
genrockslock := $(LUAROCKS) $(LUAROCKSARGS) list --porcelain | awk '{print $$1 " " $$2}'
rocksmatch := cmp -s $(LUAMODLOCK) <($(genrockslock))
endif

Expand All @@ -36,7 +38,7 @@ BUILT_SOURCES = .version
cmp -s $@{,-prev} || autoreconf configure.ac --force -W none
sed -i -e '/rm -f/s/ core / /' configure aclocal.m4 ||:

dist-hook:
dist-hook: lua_modules_dist
echo $(VERSION) > $(distdir)/.tarball-version
sed -i -e '/rm -f/s/ core / /' configure aclocal.m4 ||:

Expand Down Expand Up @@ -83,14 +85,26 @@ if !SYSTEM_LUAROCKS
installrocks: $(LUAMODLOCK) $(shell $(rocksmatch) || echo lua_modules)

lua_modules: $(LUAMODSPEC) $(shell $(rocksmatch) || echo force)
$(LUAROCKS) $(LUAROCKSARGS) install --only-deps $<
if test -e .git; then
$(LUAROCKS) $(LUAROCKSARGS) install --only-deps $<
else
rm -rf lua_modules
cp -a lua_modules_dist lua_modules
$(foreach LUA,$(filter-out $(LUA_VERSION),$(SUPPORTED_LUAS)),
find lua_modules -maxdepth 3 -type d -name "*$(LUA)" -execdir rm -rf {} \;)
fi

$(LUAMODLOCK): lua_modules $(LUAMODSPEC)
$(genrockslock) > $@

sile: installrocks
endif

.PHONY: lua_modules_dist
lua_modules_dist: $(LUAMODSPEC) force
$(foreach LUA,$(SUPPORTED_LUAS),
$(LUAROCKS) --tree lua_modules_dist --lua-version $(LUA) install --only-deps $<)

DEPDIR := .deps
REGRESSIONSCRIPT := ./tests/regressions.pl
LOCALTESTFONTS := FONTCONFIG_FILE=$(PWD)/fontconfig.conf
Expand Down

0 comments on commit a4e9f03

Please sign in to comment.