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