Fix unreproducible build
authorDmitry Bogatov <KAction@gnu.org>
Mon, 29 Aug 2016 23:35:43 +0000 (02:35 +0300)
committerPhilipp Takacs <philipp@bureaucracy.de>
Wed, 31 Aug 2016 15:33:37 +0000 (17:33 +0200)
Hostname and date of compilation are no longer embeded in version
string. See https://reproducible-builds.org

config/version.sh

index 5a9628c..6396306 100755 (executable)
@@ -11,34 +11,8 @@ if [ -z "$1" ]; then
 fi
 
 VERSION=$1
-OFS="$IFS"
-IFS=:
-HOSTNAME=unknown
 
-# Find out the name of the host we are compiling on
-for prog in uname hostname
-do
-       for dir in $PATH
-       do
-               if [ ! -f $dir/$prog ]; then
-                       continue
-               fi
-               case $prog in
-                       uname)
-                               HOSTNAME=`$prog -n`
-                               ;;
-                       hostname)
-                               HOSTNAME=`$prog`
-                               ;;
-               esac
-               break
-       done
-       if [ X"$HOSTNAME" != X  -a  X"$HOSTNAME" != Xunknown ]; then
-               break
-       fi
-done
+git_info="$(git show --pretty'=format: [%h -- %cD]' HEAD | head -n1)"
 
-IFS=" "
-
-echo "char *version_str = \"mmh-$VERSION [compiled on $HOSTNAME at `date`]\";"
+echo "char *version_str = \"mmh-${VERSION}${git_info}\";"
 echo "char *version_num = \"mmh-$VERSION\";"