eina: fix reproductible build.

This make eina hamster depend on when configure was generated. This
should only happen really when we make a new tarball for release.

@fix

T5495
This commit is contained in:
Cedric BAIL 2017-05-18 16:19:00 -07:00
parent 7510a2a9ee
commit 26d401351d
2 changed files with 15 additions and 41 deletions

View File

@ -26,6 +26,7 @@ m4_define([v_maj], [$1])dnl
m4_define([v_min], [$2])dnl
m4_define([v_mic], [$3])dnl
m4_define([dev_version], m4_esyscmd([(git rev-list --count HEAD 2>/dev/null || echo 0) | tr -d '\n']))dnl
m4_define([v_time], m4_esyscmd([(git log --format=%ci -1 2>/dev/null || date "+%Y-%m-%d %H:%M:%S %z") | tr -d '\n']))dnl
m4_define([v_rev], m4_if($4, dev, [dev_version], [0]))dnl
m4_define([v_rel], [])dnl
m4_define([def_build_profile], m4_if($4, dev, [dev], [release]))dnl
@ -102,12 +103,14 @@ AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])dnl
AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])dnl
AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])dnl
AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])dnl
AC_DEFINE([VTIME], ["v_time"], [Last source reconfigure])dnl
VMAJ=v_maj
VMIN=v_min
VMIC=v_mic
AC_SUBST([VMAJ])dnl
AC_SUBST([VMIN])dnl
AC_SUBST([VMIC])dnl
AC_SUBST([VTIME])dnl
dnl
dnl TODO: warning - lt_cur:
dnl the previous code assumed v_maj + v_min, but this will be a problem when

View File

@ -35,8 +35,7 @@
* @cond LOCAL
*/
const char *_eina_hamster_time = __TIME__;
const char *_eina_hamster_date = __DATE__;
const char *_eina_hamster = VTIME;
static int _eina_hamsters = -1;
/**
@ -57,50 +56,22 @@ eina_hamster_count(void)
if (_eina_hamsters < 0)
{
int hrs = 0, min = 0, sec = 0;
char mon[8] = "";
int monnum = 0, day = 0, year = 0;
int zone = 0;
int fields;
fields = sscanf(_eina_hamster_time, "%02d:%02d:%02d", &hrs, &min, &sec);
if (fields == 3)
fields = sscanf(_eina_hamster, "%04d-%02d-%02d %02d:%02d:%02d %d",
&year, &monnum, &day, &hrs, &min, &sec, &zone);
if (fields == 7)
{
_eina_hamsters = (hrs * 60) + min;
fields = sscanf(_eina_hamster_date, "%s %d %d", mon, &day, &year);
if (fields == 3)
{
int i;
const char *mons[] =
{
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
};
for (i = 0; i < 12; i++)
{
if (!strcmp(mon, mons[i]))
{
monnum = i + 1;
break;
}
}
// alloc 60 for mins, 24 for hrs
// alloc 1-31 (32) for days, 1-12 (13) for months
// use year as-is, for 31 bits (signed) this gives us up to
// 3584 years, which is good enough imho. - 1500 years from
// now or so. :)
_eina_hamsters +=
(day + (monnum * 32) + (13 * 32 * year)) * (24 * 60);
}
// alloc 60 for mins, 24 for hrs
// alloc 1-31 (32) for days, 1-12 (13) for months
// use year as-is, for 31 bits (signed) this gives us up to
// 3584 years, which is good enough imho. - 1500 years from
// now or so. :)
_eina_hamsters +=
(day + (monnum * 32) + (13 * 32 * year)) * (24 * 60);
}
}