Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: automatically handle GIT submodule checkout for dtc
Currently if DTC is required by configure and not available in the host OS install, we exit with an error message telling the user to checkout a git submodule or install the library. This introduces automatic handling of the git submodule checkout process and enables it for dtc. This only runs if building from GIT, so users of release tarballs still need the system library install. The current state of the git checkout is stashed in .git-submodule-status, and a helper program is used to determine if this state matches the desired submodule state. A dependency against 'Makefile' ensures that the submodule state is refreshed at the start of the build process Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170929101201.21039-2-berrange@redhat.com [ kraxel: use /bin/sh not bash for scripts/git-submodule.sh ] [ kraxel: fix Makefile dependencies ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> [fixup] Makefile dep
- Loading branch information
Showing
5 changed files
with
94 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,7 @@ | |
/docs/version.texi | ||
*.tps | ||
.stgit-* | ||
.git-submodule-status | ||
cscope.* | ||
tags | ||
TAGS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
# | ||
# This code is licensed under the GPL version 2 or later. See | ||
# the COPYING file in the top-level directory. | ||
|
||
set -e | ||
|
||
substat=".git-submodule-status" | ||
|
||
command=$1 | ||
shift | ||
modules="$@" | ||
|
||
if test -z "$modules" | ||
then | ||
test -e $substat || touch $substat | ||
exit 0 | ||
fi | ||
|
||
if ! test -e ".git" | ||
then | ||
echo "$0: unexpectedly called with submodules but no git checkout exists" | ||
exit 1 | ||
fi | ||
|
||
case "$command" in | ||
status) | ||
test -f "$substat" || exit 1 | ||
trap "rm -f ${substat}.tmp" EXIT | ||
git submodule status $modules > "${substat}.tmp" | ||
diff "${substat}" "${substat}.tmp" >/dev/null | ||
exit $? | ||
;; | ||
update) | ||
git submodule update --init $modules 1>/dev/null 2>&1 | ||
git submodule status $modules > "${substat}" | ||
;; | ||
esac |