Skip to content

Commit

Permalink
chore(build): Make building the manual and running tests more ergonomic
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jun 2, 2023
1 parent 38c5334 commit ab0befc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Expand Up @@ -39,7 +39,6 @@ jobs:
run: |
./bootstrap.sh
./configure PDFINFO=false \
--datarootdir=$(cd ..; pwd) \
--with-luajit \
--disable-font-variations \
--without-system-luarocks \
Expand Down
18 changes: 10 additions & 8 deletions Makefile.am
Expand Up @@ -231,7 +231,8 @@ check: selfcheck
selfcheck: | $(SILE) $(_BUILT_SUBDIRS)
output=$$(mktemp -t selfcheck-XXXXXX.pdf)
trap 'rm -f $$output' EXIT HUP TERM
echo "<sile>foo</sile>" | ./$(SILE) -o $$output -
export SILE_PATH
echo "<sile>foo</sile>" | SILE_PATH=$(PWD) ./$(SILE) -o $$output -
$(PDFINFO) $$output | $(GREP) "SILE v$(VERSION)"

.PHONY: docs
Expand All @@ -241,7 +242,8 @@ docs: $(MANUAL)
# garantee the TOC is up to date, simplify when #230 is fixed.
hastoc = [ -f $(subst .pdf,.toc,$@) ] && echo true || echo false
pages = $(PDFINFO) $@ | $(AWK) '$$1 == "Pages:" {print $$2}' || echo 0
silepass = $(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) $< -o $@ && pg0=$${pg} pg=$$($(pages)) || false
localsile = $(LOCALTESTFONTS) SILE_PATH=$(PWD) ./$(SILE) $(SILEFLAGS)
silepass = $(localsile) $< -o $@ && pg0=$${pg} pg=$$($(pages)) || false
define runsile =
set -e
pg=$$($(pages)) hadtoc=$$($(hastoc))
Expand Down Expand Up @@ -350,27 +352,27 @@ time-%.json: benchmark-%/time.json
update_expecteds: $(EXPECTEDS)

tests/%.expected: tests/%.sil $$(patterndeps)
$(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) -b debug $< -o $@
$(localsile) -b debug $< -o $@

tests/%.expected: tests/%.xml $$(patterndeps)
$(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) -b debug $< -o $@
$(localsile) -b debug $< -o $@

tests/%.expected: tests/%.nil $$(patterndeps)
$(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) -b debug $< -o $@
$(localsile) -b debug $< -o $@

regression_previews: $(TESTPREVIEWS)

tests/%.actual: tests/%.sil $$(patterndeps)
-$(if $(CLEAN),rm -f $@,:)
$(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) -b debug $< -o $@
$(localsile) -b debug $< -o $@

tests/%.actual: tests/%.xml $$(patterndeps)
-$(if $(CLEAN),rm -f $@,:)
$(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) -b debug $< -o $@
$(localsile) -b debug $< -o $@

tests/%.actual: tests/%.nil $$(patterndeps)
-$(if $(CLEAN),rm -f $@,:)
$(LOCALTESTFONTS) ./$(SILE) $(SILEFLAGS) -b debug $< -o $@
$(localsile) -b debug $< -o $@

DEPFILES = $(addsuffix .d,$(addprefix $(DEPDIR)/,$(basename $(TESTSRCS) $(MANUAL))))
DEPDIRS = $(sort $(dir $(DEPFILES)))
Expand Down
11 changes: 9 additions & 2 deletions configure.ac
Expand Up @@ -302,8 +302,15 @@ AC_SUBST([LUAROCKSARGS])

AX_SUBST_TRANSFORMED_PACKAGE_NAME

adl_RECURSIVE_EVAL(["${datadir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_PATH])
AC_DEFINE_UNQUOTED([SILE_PATH],["${SILE_PATH}"],[Path for SILE packages and classes])
# Avoid need for `--datarootdir=$(cd ..; pwd)` hack to run locally for
# tests/manual build when developer mode is enabled
AM_COND_IF([DEVELOPER], [
AC_DEFINE_UNQUOTED([SILE_PATH],["$(pwd)"],[Path for SILE packages and classes])
],[
adl_RECURSIVE_EVAL(["${datadir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_PATH])
AC_DEFINE_UNQUOTED([SILE_PATH],["${SILE_PATH}"],[Path for SILE packages and classes])
])

AC_SUBST([SILE_PATH])

adl_RECURSIVE_EVAL(["${libdir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_LIB_PATH])
Expand Down
2 changes: 1 addition & 1 deletion core/pathsetup.lua.in
Expand Up @@ -55,7 +55,7 @@ local pathvar = os.getenv("SILE_PATH")
if pathvar then
for path in string.gmatch(pathvar, "[^;]+") do
if not path:match("^./") and path:len() >= 1 then
extendPaths(path)
extendPaths(path, true)
end
end
end
Expand Down

0 comments on commit ab0befc

Please sign in to comment.