22
33_reponame=Starship
44pkgname=starship-sf64-git
5- pkgver=v2.0.0.r36.g3d63f60f
5+ pkgver=v2.0.0.r74.g3d882079
66pkgrel=1
77pkgdesc=" An unofficial native port of Star Fox 64 (git)"
88license=(" CC0-1.0" " MIT" )
@@ -47,6 +47,57 @@ _init_submodule() {
4747 git -c protocol.file.allow=always submodule update " ${dir} "
4848}
4949
50+ # -- Print helpers
51+ _msg_info () {
52+ echo " ${BOLD} >> ${GREEN} $@ ${ALL_OFF} "
53+ }
54+
55+ _msg_warn () {
56+ echo " ${BOLD} >> ${YELLOW} $@ ${ALL_OFF} "
57+ }
58+
59+ _walk_submodules () {
60+ absdir=" $( pwd | sed " s|^${srcdir} /||" ) "
61+ _msg_info " Entering directory <${absdir} >"
62+
63+ local submodules=" $( git ls-tree -r HEAD | awk ' $2 == "commit"' ) "
64+
65+ if [ -z " $submodules " ]; then
66+ return
67+ fi
68+
69+ local mode type hash dir
70+ while ifs=" " read -r mode type hash dir; do
71+ local basedir=" $( basename " $dir " ) "
72+ local submodule_url=" $( git config -f .gitmodules " submodule.${dir} .url" ) "
73+
74+ if [ ! -e " ${srcdir} /${basedir} " ]; then
75+ _msg_warn " Local repository ${basedir} (${submodule_url} ) is missing. ${dir} is ignored for init!"
76+ continue
77+ fi
78+
79+ _msg_info " Initializing submodule ${dir} "
80+
81+ # Check if this specific commit exists locally within the repo
82+ (
83+ cd " ${srcdir} /${basedir} "
84+ if ! git branch -a --contains " $hash " > /dev/null; then
85+ _msg_warn " Commit ${hash} of repo ${basedir} didn't get pulled from remote (${submodule_url} ). Fetching now..."
86+ git fetch " $submodule_url " " $hash "
87+ fi
88+ )
89+
90+ # Initialize and update submodule
91+ git submodule init " ${dir} "
92+ git config " submodule.${dir} .url" " ${srcdir} /${basedir} "
93+ git -c protocol.file.allow=always submodule update " ${dir} "
94+
95+ ( cd " $dir " ; _walk_submodules; )
96+ done <<< " $submodules"
97+
98+ _msg_info " Leaving directory <${absdir} >"
99+ }
100+
50101pkgver () {
51102 cd " ${srcdir} /${_reponame} "
52103
@@ -56,9 +107,7 @@ pkgver() {
56107
57108prepare () {
58109 cd " ${srcdir} /${_reponame} "
59-
60- _init_submodule libultraship
61- _init_submodule tools/Torch Torch
110+ _walk_submodules
62111
63112 patch -Np1 -i " ${srcdir} /starship-stack-underflow-guard.patch"
64113}
0 commit comments