Skip to content
Permalink
Browse files

Make the build reproducible if SOURCE_DATE_EPOCH is set.

Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
  • Loading branch information...
lamby authored and smcameron committed Jan 18, 2017
1 parent 9d77b4c commit c890eb38211741261f0e18692131ebfcddc847e8
Showing with 8 additions and 0 deletions.
  1. +8 −0 stamp.c
@@ -7,10 +7,18 @@ int main(int argc, char *argv[])
{
struct timeval tv;
int uid;
char *source_date_epoch;

gettimeofday(&tv, NULL);
uid = getuid();

source_date_epoch = getenv("SOURCE_DATE_EPOCH");
if (source_date_epoch) {
printf("static int builder = 0;\n");
printf("static uint64_t builtat = %s;\n", source_date_epoch);
exit(0);
}

printf("static int builder = %d;\n", uid);
printf("static uint64_t builtat = %d;\n", tv.tv_sec);

0 comments on commit c890eb3

Please sign in to comment.
You can’t perform that action at this time.