From 23ba778f9fd70a09e1c0fe3578664ee036e8ae54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 28 Apr 2022 22:35:21 -0400 Subject: [PATCH] meson: Fix unix epoch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- meson.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meson.build b/meson.build index d3b4f590d..a835a3e53 100644 --- a/meson.build +++ b/meson.build @@ -182,12 +182,16 @@ endif ## Time EPOCH. sh = find_program('sh') +date = find_program('date') git = find_program('git', required: false) time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check: true).stdout().strip() if time_epoch == '' and git.found() and run_command('test', '-e', '.git', check: false).returncode() == 0 # If we're in a git repository, use the creation time of the latest git tag. latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags', check: true).stdout().strip() time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag, check: true).stdout() +else + # Fallback to current epoch + time_epoch = run_command(date, '+%s', check: true).stdout() endif time_epoch = time_epoch.to_int() conf.set('TIME_EPOCH', time_epoch)