Skip to content

Commit

Permalink
chore(build): Tweak build to avoid race condition building manual wit…
Browse files Browse the repository at this point in the history
…h static config
  • Loading branch information
alerque committed Jan 9, 2024
1 parent 931f27d commit 2a0e13b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
46 changes: 35 additions & 11 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ EXTRA_DIST += src/embed.rs.in

BUILT_SOURCES = $(BUILT_LUA_SOURCES) Makefile-distfiles

CLEANFILES = $(DEPFILES) $(ACTUALS) $(TESTPDFS) $(MANUAL) $(_BUILT_SUBDIRS)
CLEANFILES = $(MANUAL)

include $(top_srcdir)/build-aux/rust_boilerplate.mk

Expand Down Expand Up @@ -172,7 +172,10 @@ selfcheck: | $(bin_PROGRAMS) $(_BUILT_SUBDIRS)
$(PDFINFO) $$output | $(GREP) "SILE v$(VERSION)"

.PHONY: docs
docs: $(MANUAL)
docs: $(_MANUAL)

.PHONY: docs-figures
docs-figures: $(FIGURES)

# This is a monkey patch to figure out how many passes we have to to to
# garantee the TOC is up to date, simplify when #230 is fixed.
Expand All @@ -199,16 +202,33 @@ _DOCS_DEPS = $(and $$(filter documentation/%,$@),$(addprefix .fonts/,$(DOCSFONTF
# TODO: remove _BUILT_SUBDIRS hack and replace it with something sensible when
# these subdirs don't do crazy things like copying files outside of their own trees!
_BUILT_SUBDIRS = .built-subdirs
_SUBDIR_TELLS = justenough/.libs/fontmetrics.so \
justenough/.libs/justenoughfontconfig.so \
justenough/.libs/justenoughharfbuzz.so \
justenough/.libs/justenoughicu.so \
justenough/.libs/justenoughlibtexpdf.so \
justenough/.libs/svg.so \
libtexpdf/.libs/libtexpdf.so.0.0.0
_SUBDIR_TELLS =

if SHARED
_SUBDIR_TELLS += justenough/.libs/fontmetrics.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughfontconfig.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughharfbuzz.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughicu.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughlibtexpdf.$(SHARED_LIB_EXT) \
justenough/.libs/svg.$(SHARED_LIB_EXT) \
libtexpdf/.libs/libtexpdf.$(SHARED_LIB_EXT).0.0.0
endif

if STATIC
_SUBDIR_TELLS += justenough/.libs/fontmetrics.a \
justenough/.libs/justenoughfontconfig.a \
justenough/.libs/justenoughharfbuzz.a \
justenough/.libs/justenoughicu.a \
justenough/.libs/justenoughlibtexpdf.a \
justenough/.libs/svg.a \
libtexpdf/.libs/libtexpdf.a
endif

$(_BUILT_SUBDIRS): $(_SUBDIR_TELLS)
touch $@

CLEANFILES += $(_BUILT_SUBDIRS)

$(_SUBDIR_TELLS):
$(MAKE) $(AM_MAKEFLAGS) all-recursive

Expand Down Expand Up @@ -263,6 +283,7 @@ update_libtexpdf:
TESTPDFS = $(addsuffix .pdf,$(basename $(TESTSRCS)))
EXPECTEDS ?= $(filter $(addsuffix .expected,$(basename $(TESTSRCS))),$(TESTEXPECTS))
ACTUALS = $(addsuffix .actual,$(basename $(EXPECTEDS)))
CLEANFILES += $(TESTPDFS) $(ACTUALS)

REGRESSIONSCRIPT := ./tests/regressions.pl
BUSTEDFLAGS ?=
Expand Down Expand Up @@ -341,6 +362,7 @@ tests/%.actual: tests/%.nil $$(patterndeps)

DEPFILES = $(addsuffix .d,$(addprefix $(DEPDIR)/,$(basename $(TESTSRCS) $(MANUAL))))
DEPDIRS = $(sort $(dir $(DEPFILES)))
CLEANFILES += $(DEPFILES)

$(DEPDIRS): | Makefile-distfiles
mkdir -p $@
Expand All @@ -362,19 +384,21 @@ docker: Dockerfile hooks/build .version
docker-dep-check: .docker_deps .aur_deps
diff -u $^

CLEANFILES += .docker_deps
.docker_deps: hooks/build
$(SHELL) -c 'source <($(SED) -nE "/^(RUN|'"'"')/{s/.*=/echo /;p}" $<)' | \
tr ' ' '\n' | \
sort > $@

CLEANFILES += .aur_deps
CLEANFILES += .docker_deps

.aur_deps:
curl -Ls 'https://aur.archlinux.org/cgit/aur.git/plain/.SRCINFO?h=sile-git' | \
$(SED) -nE '/\bdepends =/{s/.*= //;p}' | \
$(GREP) -vxE '(lua-.*|.*\.so|git|glibc)' | \
sort > $@

CLEANFILES += .aur_deps

define docker_push =
test -z "$(DOCKER_PAT)" || \
docker login https://$(DOCKER_REGISTRY) -u $(DOCKER_USERNAME) -p $(DOCKER_PAT)
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ AC_ARG_ENABLE([developer],
[Check for and enable tooling required only for developers]))
AM_CONDITIONAL([DEVELOPER], [test "x$enable_developer" = "xyes"])

AM_CONDITIONAL([SHARED], [test "x$enable_shared" = "xyes"])
AM_CONDITIONAL([STATIC], [test "x$enable_static" = "xyes"])

AC_ARG_ENABLE([embeded],
AS_HELP_STRING([--enable-embeded-resources],
[Compile resources such as Lua module files directly into the Rust CLI binary]))
Expand Down

0 comments on commit 2a0e13b

Please sign in to comment.