mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2025-11-08 20:21:12 -06:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
2
.github/workflows/validate-book-build.yml
vendored
2
.github/workflows/validate-book-build.yml
vendored
@@ -29,4 +29,4 @@ jobs:
|
|||||||
options: -v ${{ github.workspace }}:/app
|
options: -v ${{ github.workspace }}:/app
|
||||||
run: |
|
run: |
|
||||||
cd /app/book
|
cd /app/book
|
||||||
make -j build_pdf build_serif_ebook
|
make -j build_pdf build_ebook
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ WEBSITE := make4ht --lua -c website.cfg -a debug -uf html5+tidy+common_domfilter
|
|||||||
CLEAN := latexmk -cd -lualatex -c -use-make
|
CLEAN := latexmk -cd -lualatex -c -use-make
|
||||||
CHECK_1 := lacheck
|
CHECK_1 := lacheck
|
||||||
CHECK_2 := chktex
|
CHECK_2 := chktex
|
||||||
|
CONVERT_PIC := convert
|
||||||
|
REDUCE_PIC := -resize '800x800>' \
|
||||||
|
-strip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
|
||||||
|
-set colorspace Gray -separate -evaluate-sequence Mean
|
||||||
|
RSYNC := rsync -au --exclude 'book.epub' --exclude '*.jpg' --exclude '*.png'
|
||||||
|
|
||||||
# We want bash as shell
|
# We want bash as shell
|
||||||
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
||||||
@@ -36,8 +41,12 @@ images += $(wildcard images/*.jpg)
|
|||||||
images += $(wildcard images/*.png)
|
images += $(wildcard images/*.png)
|
||||||
images += $(wildcard images/*/*.png)
|
images += $(wildcard images/*/*.png)
|
||||||
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.jpg))
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.jpg))
|
||||||
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.jpg))
|
||||||
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.png))
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.png))
|
||||||
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.png))
|
||||||
|
|
||||||
|
# Black and White ebook, we will just re-zip directory after converting the
|
||||||
|
# images to lower resolution and greyscale
|
||||||
bw_images := $(addprefix bw-book-epub/OEBPS/, $(images))
|
bw_images := $(addprefix bw-book-epub/OEBPS/, $(images))
|
||||||
|
|
||||||
src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(images)
|
src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(images)
|
||||||
@@ -78,25 +87,32 @@ book_serif/book.pdf: $(src_all)
|
|||||||
book_sans_serif/book_sans_serif.pdf: $(src_all)
|
book_sans_serif/book_sans_serif.pdf: $(src_all)
|
||||||
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
||||||
|
|
||||||
|
.PHONY: bw_epub copy_ebook_files
|
||||||
|
|
||||||
epub/%.epub: %.tex $(src_all) cover/cover-page.xbb
|
epub/%.epub: %.tex $(src_all) cover/cover-page.xbb
|
||||||
$(EBOOK) -f epub $<
|
$(EBOOK) -f epub $<
|
||||||
|
|
||||||
copy_ebook_files: build_ebook
|
bw-book-epub:
|
||||||
mkdir -p bw-book-epub/
|
mkdir -p bw-book-epub
|
||||||
rsync -au --exclude "book.epub" book-epub/ bw-book-epub/
|
|
||||||
|
|
||||||
convert_ebook_images: copy_ebook_files
|
copy_ebook_files: build_ebook | bw-book-epub
|
||||||
mogrify -resize '800x800>' \
|
$(RSYNC) book-epub/ bw-book-epub/
|
||||||
tstrip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
|
|
||||||
-set colorspace Gray -separate -evaluate-sequence Mean $(bw_images)
|
|
||||||
|
|
||||||
bw_ebook.zip: convert_ebook_images
|
# We not convert SVG to B&W or lower res for now as they are super small
|
||||||
|
# anyway
|
||||||
|
bw-book-epub/OEBPS/%.jpg: %.jpg
|
||||||
|
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
|
||||||
|
|
||||||
|
bw-book-epub/OEBPS/%.png: %.png
|
||||||
|
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
|
||||||
|
|
||||||
|
bw_ebook.zip: copy_ebook_files $(bw_images)
|
||||||
zip -qXr9D bw_ebook.zip bw-book-epub
|
zip -qXr9D bw_ebook.zip bw-book-epub
|
||||||
|
|
||||||
epub/bw_book.epub: bw_ebook.zip
|
epub/bw_book.epub: bw_ebook.zip
|
||||||
mv bw_ebook.zip epub/bw_book.epub
|
mv bw_ebook.zip epub/bw_book.epub
|
||||||
|
|
||||||
bw_epub: epub/bw_book.epub
|
bw_epub: epub/bw_book.epub | bw-book-epub
|
||||||
|
|
||||||
# Now with the rules
|
# Now with the rules
|
||||||
# Expected usual rules first
|
# Expected usual rules first
|
||||||
@@ -165,9 +181,9 @@ build_serif_pdf: book_serif/book.pdf
|
|||||||
|
|
||||||
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
|
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
|
||||||
|
|
||||||
build_ebook: epub/book.epub | make_release_dir
|
build_ebook: epub/book.epub
|
||||||
|
|
||||||
build_bw_ebook: epub/bw_book.epub | make_release_dir
|
build_bw_ebook: epub/bw_book.epub
|
||||||
|
|
||||||
.PHONY: export_figures check
|
.PHONY: export_figures check
|
||||||
# Requires that you have docker running on your computer.
|
# Requires that you have docker running on your computer.
|
||||||
@@ -228,18 +244,19 @@ mrproper: clean
|
|||||||
-rm -rf $(website_dir)
|
-rm -rf $(website_dir)
|
||||||
|
|
||||||
# top level releases rules
|
# top level releases rules
|
||||||
.PHONY: bake make_release_dir release_serif release_sans_serif
|
.PHONY: bake release_serif release_sans_serif
|
||||||
|
|
||||||
bake: release_serif release_sans_serif
|
bake: release_serif release_sans_serif
|
||||||
|
|
||||||
make_release_dir:
|
release:
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
|
|
||||||
release_serif: build_serif_pdf build_ebook build_bw_ebook | make_release_dir
|
release_serif: build_serif_pdf build_ebook build_bw_ebook | release
|
||||||
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
||||||
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
||||||
|
cp epub/bw_book.epub release/TheBreadCode-The-Sourdough-Framework-black-and-white.epub
|
||||||
|
|
||||||
release_sans_serif: build_sans_serif_pdf | make_release_dir
|
release_sans_serif: build_sans_serif_pdf | release
|
||||||
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
|
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
|
||||||
|
|
||||||
# Website stuff
|
# Website stuff
|
||||||
@@ -296,6 +313,10 @@ show_tools_version: # Show version of tools used on the build machine
|
|||||||
@echo ""
|
@echo ""
|
||||||
- ruby --version
|
- ruby --version
|
||||||
@echo ""
|
@echo ""
|
||||||
|
- convert --version
|
||||||
|
@echo ""
|
||||||
|
- rsync --version
|
||||||
|
|
||||||
|
|
||||||
# You can find the value of variable X with the following command:
|
# You can find the value of variable X with the following command:
|
||||||
# make print-X
|
# make print-X
|
||||||
|
|||||||
2
makefile
2
makefile
@@ -22,7 +22,7 @@ website: mrproper
|
|||||||
|
|
||||||
.PHONY: validate
|
.PHONY: validate
|
||||||
validate: mrproper
|
validate: mrproper
|
||||||
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_serif_ebook"
|
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_ebook"
|
||||||
|
|
||||||
.PHONY: mrproper
|
.PHONY: mrproper
|
||||||
mrproper:
|
mrproper:
|
||||||
|
|||||||
Reference in New Issue
Block a user