Read SOURCE_DATE_EPOCH if it exists

This commit is contained in:
Jasper Van der Jeugt 2016-12-02 11:14:56 +01:00
parent a8e507f944
commit 2accea2c81
2 changed files with 4 additions and 4 deletions

View File

@ -1,8 +1,9 @@
PANDOC_MINOR_VERSION=$(shell ghc-pkg latest pandoc | sed 's/.*-//' | cut -d. -f2)
PATAT_BUILD_DATE=$(shell date '+%B %d, %Y' -d "$(shell git log -1 --format=%cd --date=short)")
SOURCE_DATE_EPOCH?=$(shell git log -1 --format=%cd --date=unix)
SOURCE_DATE=$(shell date '+%B %d, %Y' -d "@${SOURCE_DATE_EPOCH}")
extra/patat.1: README.md extra/make-man
PATAT_BUILD_DATE="$(PATAT_BUILD_DATE)" ./extra/make-man >$@
SOURCE_DATE="$(SOURCE_DATE)" ./extra/make-man >$@
extra/make-man: extra/make-man.hs
ghc -DPANDOC_MINOR_VERSION=${PANDOC_MINOR_VERSION} -Wall -o $@ $<

View File

@ -83,9 +83,8 @@ main = do
Right pandoc0 <- Pandoc.readMarkdown Pandoc.def <$> readFile "README.md"
Right template <- Pandoc.getDefaultTemplate Nothing "man"
-- It's important for reproducible builds that we get the date from git.
version <- getVersion
date <- getEnv "PATAT_BUILD_DATE"
date <- getEnv "SOURCE_DATE"
let writerOptions = Pandoc.def {
#if PANDOC_MINOR_VERSION >= 19