commit 3675c40ee7b75749fc066085e8ff8b730c2ca81e Author: Gojko Adzic Date: Thu May 23 11:39:12 2019 +0200 initial scripts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce6f6c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +result +build +cache diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7836fc1 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + +DOCKER_IMAGE ?= lambci/lambda-base-2:build +TARGET ?=/opt/ + +MOUNTS = -v $(PROJECT_ROOT):/var/task \ + -v $(PROJECT_ROOT)result:$(TARGET) \ + -v $(PROJECT_ROOT)cache:/usr/local + +DOCKER = docker run -it --rm -w=/var/task/build +build result cache: + mkdir $@ + +clean: + rm -rf build result cache + +bash: + $(DOCKER) $(MOUNTS) --entrypoint /bin/bash -t $(DOCKER_IMAGE) + +all result/bin/x86_64-linux/latex: build result cache + $(DOCKER) $(MOUNTS) --entrypoint /usr/bin/make -t $(DOCKER_IMAGE) TARGET_DIR=$(TARGET) -f ../Makefile_Latex $@ + +STACK_NAME ?= latex-layer + +build/output.yaml: template.yaml result/bin/x86_64-linux/latex + aws cloudformation package --template $< --s3-bucket $(DEPLOYMENT_BUCKET) --output-template-file $@ + +deploy: build/output.yaml + aws cloudformation deploy --template $< --stack-name $(STACK_NAME) + aws cloudformation describe-stacks --stack-name $(STACK_NAME) --query Stacks[].Outputs --output table + +deploy-example: + cd example && \ + make deploy DEPLOYMENT_BUCKET=$(DEPLOYMENT_BUCKET) LATEX_STACK_NAME=$(STACK_NAME) diff --git a/Makefile_Latex b/Makefile_Latex new file mode 100644 index 0000000..89e63ce --- /dev/null +++ b/Makefile_Latex @@ -0,0 +1,37 @@ +PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +CACHE_DIR=$(PROJECT_ROOT)build/cache + +.ONESHELL: + +### step 1: texlive installer +# see https://www.tug.org/texlive/acquire-netinstall.html +TEXLIVE_SOURCE=install-tl-unx.tar.gz + +$(TEXLIVE_SOURCE): + curl -LO http://mirror.ctan.org/systems/texlive/tlnet/$(TEXLIVE_SOURCE) + +/usr/lib64/perl5/vendor_perl/Digest/MD5.pm: + yum install perl-Digest-MD5 -y + +# see https://wiki.archlinux.org/index.php/TeX_Live +TLMGR=/opt/texlive/bin/x86_64-linux/tlmgr +$(TLMGR): $(TEXLIVE_SOURCE) /usr/lib64/perl5/vendor_perl/Digest/MD5.pm + tar xf $< + cd install-tl* + ./install-tl --profile $(PROJECT_ROOT)texlive.profile + +## see https://pandoc.org/MANUAL.html +pandoc-packages: $(TLMGR) + $(TLMGR) install xcolor amsfonts amsmath lm unicode-math \ + ifxetex ifluatex listings fancyvrb longtable booktabs \ + graphicx grffile hyperref xcolor ulem geometry \ + setspace babel upquote microtype parskip xurl \ + bookmark footnotehyper footnote + +all: $(TLMGR) pandoc-packages + +pandoc-xelatex-packages: + $(TLMGR) fontspec polyglossia xecjk bidi mathspec upquote microtype \ + csquotes natbib biblatex bibtex biber + + diff --git a/texlive.profile b/texlive.profile new file mode 100644 index 0000000..5c13f4e --- /dev/null +++ b/texlive.profile @@ -0,0 +1,19 @@ +selected_scheme scheme-custom +TEXDIR /opt/texlive +TEXMFSYSCONFIG /opt/texlive/texmf-config +TEXMFSYSVAR /opt/texlive/texmf-var +TEXMFLOCAL /opt/texlive/texmf-local +TEXMFHOME /tmp/texmf +TEXMFCONFIG /tmp/texmf-config +TEXMFVAR /tmp/texmf-var +collection-basic 1 +collection-latex 1 +tlpdbopt_autobackup 0 +tlpdbopt_backupdir tlpkg/backups +tlpdbopt_create_formats 0 +tlpdbopt_desktop_integration 0 +tlpdbopt_file_assocs 0 +tlpdbopt_generate_updmap 0 +tlpdbopt_install_docfiles 0 +tlpdbopt_install_srcfiles 0 +tlpdbopt_post_code 1