|
|
@ -5,38 +5,18 @@ |
|
|
|
# is then built as a regular source file as part of the compilation process. |
|
|
|
# is then built as a regular source file as part of the compilation process. |
|
|
|
# One can run "strings executable_filename | grep _build_" to find the version of |
|
|
|
# One can run "strings executable_filename | grep _build_" to find the version of |
|
|
|
# the source that we used to build the executable file. |
|
|
|
# the source that we used to build the executable file. |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# create git version file |
|
|
|
|
|
|
|
VFILE=$PWD/util/build_version.cc.tmp |
|
|
|
|
|
|
|
trap "rm $VFILE" EXIT |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check to see if git is in the path |
|
|
|
OUTFILE="$PWD/util/build_version.cc" |
|
|
|
which git > /dev/null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
GIT_SHA="" |
|
|
|
env -i git rev-parse HEAD 2>&1 | |
|
|
|
if command -v git >/dev/null 2>&1; then |
|
|
|
awk ' |
|
|
|
GIT_SHA=$(git rev-parse HEAD 2>/dev/null) |
|
|
|
BEGIN { |
|
|
|
|
|
|
|
print "#include \"build_version.h\"\n" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
{ print "const char* rocksdb_build_git_sha = \"rocksdb_build_git_sha:" $0"\";" } |
|
|
|
|
|
|
|
' > ${VFILE} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "git not found" | |
|
|
|
|
|
|
|
awk ' |
|
|
|
|
|
|
|
BEGIN { |
|
|
|
|
|
|
|
print "#include \"build_version.h\"" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
{ print "const char* rocksdb_build_git_sha = \"rocksdb_build_git_sha:git not found\";" } |
|
|
|
|
|
|
|
' > ${VFILE} |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "const char* rocksdb_build_git_datetime = \"rocksdb_build_git_datetime:$(date)\";" >> ${VFILE} |
|
|
|
cat > "${OUTFILE}" <<EOF |
|
|
|
echo "const char* rocksdb_build_compile_date = __DATE__;" >> ${VFILE} |
|
|
|
#include "build_version.h" |
|
|
|
echo "const char* rocksdb_build_compile_time = __TIME__;" >> ${VFILE} |
|
|
|
const char* rocksdb_build_git_sha = "rocksdb_build_git_sha:${GIT_SHA}"; |
|
|
|
|
|
|
|
const char* rocksdb_build_git_datetime = "rocksdb_build_git_datetime:$(date)"; |
|
|
|
OUTFILE=$PWD/util/build_version.cc |
|
|
|
const char* rocksdb_build_compile_date = __DATE__; |
|
|
|
if [ ! -e $OUTFILE ] || ! cmp -s $VFILE $OUTFILE; then |
|
|
|
const char* rocksdb_build_compile_time = __TIME__; |
|
|
|
cp $VFILE $OUTFILE |
|
|
|
EOF |
|
|
|
fi |
|
|
|
|
|
|
|