From 39fd5a7bf212e9bec7bb33de57944a97bdb5235b Mon Sep 17 00:00:00 2001 From: "Rodney, Tiara" Date: Sun, 23 Mar 2025 19:34:36 +0100 Subject: [PATCH] feat(build): init vendor integration Now, the HTML theme build is daisy-chained to the build of the Sphinx theme, including a skeleton for watching, which will be part of user-acceptance testing, which will be sphinx-autobuild building `docs/`. --- Makefile | 17 ++++- configure | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 14 ++++ 3 files changed, 238 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c86eb9a..7c211fd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,8 @@ -.PHONY: requirements.txt requirements-dev.txt configure Pipfile.lock +.PHONY: requirements.txt requirements-dev.txt configure Pipfile.lock src/sphinx_theme_ref/assets + +PKG_BASENAME := sphinx_theme_ref + +VENDOR_OUTPUT_PATH := $(shell realpath ./src/sphinx_theme_ref/assets) Pipfile.lock: .venv/bin/pipenv lock @@ -11,3 +15,14 @@ requirements-dev.txt: configure: autoconf + +src/sphinx_theme_ref/assets: + rm -r src/$(PKG_BASENAME)/assets + make -C vendor/html-theme-ref build/production OUTPUT_PATH=$(VENDOR_OUTPUT_PATH) + +# user acceptance testing +uat: + trap 'kill 0' SIGINT; \ + make -C vendor/html-theme-ref watch OUTPUT_PATH=$(VENDOR_OUTPUT_PATH) & \ + wait + diff --git a/configure b/configure index b2b0bb0..564cdd2 100644 --- a/configure +++ b/configure @@ -607,8 +607,12 @@ PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS +NODE +NPM PYTHON3 GIT +REALPATH +MAKE target_alias host_alias build_alias @@ -1709,6 +1713,103 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# required in Makefile to ensure proper path resolution during preprocessing +for ac_prog in make +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MAKE+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$MAKE"; then + ac_cv_prog_MAKE="$MAKE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MAKE="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +MAKE=$ac_cv_prog_MAKE +if test -n "$MAKE"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5 +printf "%s\n" "$MAKE" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$MAKE" && break +done + +for ac_prog in realpath +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_REALPATH+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$REALPATH"; then + ac_cv_prog_REALPATH="$REALPATH" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_REALPATH="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +REALPATH=$ac_cv_prog_REALPATH +if test -n "$REALPATH"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $REALPATH" >&5 +printf "%s\n" "$REALPATH" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$REALPATH" && break +done + for ac_prog in git do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -1806,10 +1907,117 @@ fi done +# HTML theme reference dependency for dynamic building, alternatively this could +# be removed and instead the HTML theme reference could be statically integrated +# by storing the build package archive under vendor/ instead and untar the +# archive into src/. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for vendor build dependencies..." >&5 +printf "%s\n" "$as_me: checking for vendor build dependencies..." >&6;} +for ac_prog in npm +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NPM+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$NPM"; then + ac_cv_prog_NPM="$NPM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_NPM="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +NPM=$ac_cv_prog_NPM +if test -n "$NPM"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NPM" >&5 +printf "%s\n" "$NPM" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$NPM" && break +done + +for ac_prog in node +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NODE+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$NODE"; then + ac_cv_prog_NODE="$NODE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_NODE="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +NODE=$ac_cv_prog_NODE +if test -n "$NODE"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NODE" >&5 +printf "%s\n" "$NODE" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$NODE" && break +done + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: initializing Git submodules..." >&5 printf "%s\n" "$as_me: initializing Git submodules..." >&6;} git submodule update --init --remote --recursive +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: initializing vendors..." >&5 +printf "%s\n" "$as_me: initializing vendors..." >&6;} +sh -xc "cd vendor/html-theme-ref && npm install" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: initializing python3 venv..." >&5 printf "%s\n" "$as_me: initializing python3 venv..." >&6;} python3 -m venv .venv diff --git a/configure.ac b/configure.ac index 73cd4aa..d782e95 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,25 @@ AC_INIT +# required in Makefile to ensure proper path resolution during preprocessing +AC_CHECK_PROGS([MAKE], [make]) +AC_CHECK_PROGS([REALPATH], [realpath]) AC_CHECK_PROGS([GIT], [git]) AC_CHECK_PROGS([PYTHON3], [python3]) +# HTML theme reference dependency for dynamic building, alternatively this could +# be removed and instead the HTML theme reference could be statically integrated +# by storing the build package archive under vendor/ instead and untar the +# archive into src/. +AC_MSG_NOTICE([checking for vendor build dependencies...]) +AC_CHECK_PROGS([NPM], [npm]) +AC_CHECK_PROGS([NODE], [node]) + AC_MSG_NOTICE([initializing Git submodules...]) git submodule update --init --remote --recursive +AC_MSG_NOTICE([initializing vendors...]) +sh -xc "cd vendor/html-theme-ref && npm install" + AC_MSG_NOTICE([initializing python3 venv...]) python3 -m venv .venv