2021-01-13 23:30:20 +00:00
|
|
|
#!/bin/sh
|
2020-07-11 21:48:14 +00:00
|
|
|
|
|
|
|
OUTPUT_DIR=$1;
|
|
|
|
|
2020-07-11 23:52:14 +00:00
|
|
|
FILE="fceux_git_info.cpp"
|
2020-07-11 21:48:14 +00:00
|
|
|
TMP_FILE="/tmp/$FILE";
|
|
|
|
|
2020-07-11 23:52:14 +00:00
|
|
|
echo "Output File: $OUTPUT_DIR/$FILE";
|
|
|
|
|
2020-07-11 21:48:14 +00:00
|
|
|
GIT_URL=`git config --get remote.origin.url`;
|
|
|
|
GIT_REV=`git rev-parse HEAD`;
|
|
|
|
|
2021-02-09 01:51:24 +00:00
|
|
|
echo "// fceux_git_info.cpp -- DO NOT EDIT: This file is auto-generated at build" >| $TMP_FILE;
|
2020-07-11 23:52:14 +00:00
|
|
|
echo "#include \"Qt/fceux_git_info.h\" " >> $TMP_FILE;
|
2020-07-11 21:48:14 +00:00
|
|
|
echo "#define FCEUX_GIT_URL \"$GIT_URL\" " >> $TMP_FILE;
|
|
|
|
echo "#define FCEUX_GIT_REV \"$GIT_REV\" " >> $TMP_FILE;
|
2020-07-11 23:52:14 +00:00
|
|
|
echo "const char *fceu_get_git_url(void){ return FCEUX_GIT_URL; }" >> $TMP_FILE
|
|
|
|
echo "const char *fceu_get_git_rev(void){ return FCEUX_GIT_REV; }" >> $TMP_FILE
|
2020-07-11 21:48:14 +00:00
|
|
|
|
2020-07-12 00:04:58 +00:00
|
|
|
echo "Git URL: $GIT_URL ";
|
|
|
|
echo "Git Rev: $GIT_REV ";
|
2020-07-11 21:48:14 +00:00
|
|
|
if [ -e $OUTPUT_DIR/$FILE ]; then
|
|
|
|
|
2020-07-12 00:04:58 +00:00
|
|
|
diff -q $TMP_FILE $OUTPUT_DIR/$FILE
|
2020-07-11 21:48:14 +00:00
|
|
|
|
|
|
|
if [ $? != 0 ]; then
|
2020-07-12 00:04:58 +00:00
|
|
|
mv -f $TMP_FILE $OUTPUT_DIR/$FILE;
|
|
|
|
echo "Updated $OUTPUT_DIR/$FILE";
|
2020-07-11 21:48:14 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
mv -f $TMP_FILE $OUTPUT_DIR/$FILE
|
2020-07-12 00:04:58 +00:00
|
|
|
echo "Generated $OUTPUT_DIR/$FILE";
|
2020-07-11 21:48:14 +00:00
|
|
|
fi
|