add support for multi-page pdfs from stag

This commit is contained in:
2025-11-26 23:45:50 +01:00
parent 90c0e28187
commit c5187d8620
5 changed files with 120 additions and 128 deletions

View File

@@ -3,14 +3,17 @@ PACKS_ROOT := $(BUILD_DIR)/pack
PACKDIR := $(PACKS_ROOT)/tultemplate2
BUNDLEDIR := $(PACKS_ROOT)/bundle
TO_PACK := $(shell find template -type f) template/LICENSE
LIB_MUCHPDFTOOLS := lib.typ much_pdf_tools.wasm
LIBS := $(LIB_MUCHPDFTOOLS:%=much_pdf_tools/%)
TO_PACK := $(shell find template -type f) template/LICENSE $(LIBS:%=template/lib/%)
BUNDLE_THESES := bp_cs bp_en dp_cs dp_en prj_cs prj_en sp_cs sp_en
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp_cs.typ \
$(BUNDLE_THESES:%=$(BUNDLEDIR)/%.typ) $(BUNDLEDIR)/Makefile
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib $(PACKDIR)/Makefile
TEMPLATE_SRCS := $(shell find template -type f)
TEMPLATE_SRCS := $(shell find template -type f) $(LIBS:%=template/lib/%)
# == MAIN TARGETS ==
@@ -41,6 +44,7 @@ documentation: $(BUILD_DIR)/documentation.pdf
.PHONY: clean
clean:
rm -rf target
rm -rf template/lib
# == ROOTS ==
@@ -70,6 +74,16 @@ define replace_with_file_line
sed "s/$(1)/$$(sed '$(3)q;d' $(2))/g"
endef
# == LIBS ==
template/lib:
mkdir -p $@
$(LIB_MUCHPDFTOOLS:%=template/lib/much_pdf_tools/%): | template/lib
cd template/lib && wget "https://tulsablona.zumepro.cz/lib/much_pdf_tools.tar.gz" && \
tar -xvf much_pdf_tools.tar.gz && \
rm much_pdf_tools.tar.gz
# == DOCUMENTATION ==
$(BUILD_DIR)/documentation.pdf: documentation.typ $(TEMPLATE_SRCS) | $(BUILD_DIR)