504f030995a07120830b60b40619840c21fe72f9 markd Fri Jul 24 10:58:20 2026 -0700 submoduleSetup: sync submodules to pinned commit on every build Run 'git submodule update --init --recursive' unconditionally when in a git work tree, rather than only when the submodule was uninitialized. This means a moved submodule pointer (e.g. after a pull) is checked out on every build, and --recursive keeps the nested htscodecs submodule in sync too. git is silent when already in sync. The non-git-work-tree (source release) branch is unchanged. No RM. diff --git src/submodules/submoduleSetup src/submodules/submoduleSetup index 4834fda73d7..353802f8111 100755 --- src/submodules/submoduleSetup +++ src/submodules/submoduleSetup @@ -1,41 +1,42 @@ #!/bin/bash set -beEu -o pipefail # Do required submodule setup to support building the browser -# If need, do the submodule init, also check from having remains of -# old htslib copy to deal with switch from old version. +# Sync submodules to the commits pinned by the parent repo, and check for +# having remains of old htslib copy to deal with switch from old version. if [ -e htslib ] ; then echo "*********************************************************************" >&2 echo "Note: an outdated kent/src/htslib/ exists in the working tree." >&2 echo " It is no longer used and can be removed." >&2 echo "*********************************************************************" >&2 fi -if [ ! -e submodules/htslib/.git -o ! -e submodules/htslib/htscodecs/.git ] ; then if git rev-parse --is-inside-work-tree >/dev/null 2>&1 ; then - echo "Note: initializing git submodules" >&2 - (set -x; git -c protocol.file.allow=always submodule update --init --recursive) + # Sync submodules to the commits pinned by the parent repo on every build, + # not just on first-time init, so a moved pointer (e.g. after a pull) is + # always checked out. --init covers the first-time case, --recursive also + # updates the nested htscodecs submodule. git is silent when already in sync. + git -c protocol.file.allow=always submodule update --init --recursive elif [ ! -e submodules/htslib/hts.c -o ! -e submodules/htslib/htscodecs/htscodecs/htscodecs.c ] ; then # not a git working tree (e.g. a source release); submodule sources must # already be present since they can not be checked out without git. echo "Error: submodule sources under submodules/htslib are missing and this" >&2 echo " is not a git working tree, so they can not be initialized." >&2 exit 1 fi -fi # Generate htslib's compiler-probe makefile fragment (htscodecs.mk) and config.h # SERIALLY, here, before the parallel ("make -j") build descends into htslib. # hts_probe_cc.sh probes SIMD (SSE4/AVX2/AVX512) support using fixed-name # conftest.* temp files in submodules/htslib/. Under -j, a concurrent writer # can clobber conftest.c between its creation and compilation, so the AVX2 probe # "succeeds" with no -mavx2 flag; that records HTS_BUILD_AVX2=1 with an empty # HTS_CFLAGS_AVX2 in htscodecs.mk. config.h then defines HAVE_AVX2, enabling # AVX2 source that is compiled without -mavx2 -> "target specific option # mismatch" build failure. Both files are no-prerequisite make targets, so the # corrupt result is cached and reused until deleted. Building them single- # threaded here guarantees the probe runs exactly once and the -j build never # triggers it. Only done when they are missing, so it does not force needless # htslib recompiles on incremental builds. if [ -e submodules/htslib/Makefile ] && \