thirdparty: update thirdparty-linux-amd64_tcc.sh, to also record its own full invocation command, and commit the changes automatically

This commit is contained in:
Delyan Angelov 2025-03-22 11:14:07 +02:00
parent 9fb0f8b5aa
commit e411ee1411
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -1,4 +1,18 @@
#!/usr/bin/env bash ## NOTE: this script does *not* use a shebang **deliberately**, in order to
## access the same shell, to capture its own launching command with `fc`,
## and to record it later in the new commit message in thirdpart/tcc.
## WARNING: THE ORIGINAL OF THIS SCRIPT IS IN:
## https://github.com/vlang/v/blob/master/thirdparty/build_scripts/thirdparty-linux-amd64_tcc.sh ,
## I.E. IN THE MAIN V REPOSITORY. IF YOU NEED TO MAKE CHANGES, CHANGE THAT.
##
## THE `build.sh` FILE IN `vlang/tccbin` REPO IS A COPY, RECORDED AT THE TIME
## OF REBUILDING, FOR EASIER/RELIABLE REPRODUCTION OF HISTORIC VERSIONS.
## IT IS NOT INTENDED TO BE MODIFIED.
BUILD_CMD=`fc -nl -0`
## remove whitespaces before/after the actual command:
BUILD_CMD="$(echo "${BUILD_CMD}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
set -e set -e
@ -13,9 +27,10 @@ export TCC_COMMIT="${TCC_COMMIT:-mob}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}" export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
export CC="${CC:-gcc}" export CC="${CC:-gcc}"
echo " BUILD_CMD: \`$BUILD_CMD\`"
echo " CC: $CC" echo " CC: $CC"
echo "TCC_COMMIT: $TCC_COMMIT" echo "TCC_COMMIT: $TCC_COMMIT"
echo "TCC_FOLDER: $TCC_FOLDER" echo "TCC_FOLDER: \`$TCC_FOLDER\`"
echo =============================================================== echo ===============================================================
rm -rf tinycc/ rm -rf tinycc/
@ -69,4 +84,11 @@ uname -a > $TCC_FOLDER/build_machine_
## show the builtin search paths for sanity checking: ## show the builtin search paths for sanity checking:
$TCC_FOLDER/tcc.exe -v -v $TCC_FOLDER/tcc.exe -v -v
pushd .
cd $TCC_FOLDER
git add .
git commit -m "build with \`$BUILD_CMD\`"
popd
echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH . The tcc executable is ready in $TCC_FOLDER/tcc.exe " echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH . The tcc executable is ready in $TCC_FOLDER/tcc.exe "