Merge pull request #124518 from collares/olean-backport

[21.05] lean: substitute release commit sha1
This commit is contained in:
Gabriel Ebner 2021-05-26 19:22:26 +02:00 committed by GitHub
commit 84ad09b57b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,11 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "leanprover-community";
repo = "lean";
rev = "v${version}";
# lean's version string contains the commit sha1 it was built
# from. this is then used to check whether an olean file should be
# rebuilt. don't use a tag as rev because this will get replaced into
# src/githash.h.in in preConfigure.
rev = "a5822ea47ebc52eec6323d8f1b60f6ec025daf99";
sha256 = "sha256-gJhbkl19iilNyfCt2TfPmghYA3yCjg6kS+yk/x/k14Y=";
};
@ -20,6 +24,13 @@ stdenv.mkDerivation rec {
# library.
doCheck = true;
preConfigure = assert builtins.stringLength src.rev == 40; ''
substituteInPlace src/githash.h.in \
--subst-var-by GIT_SHA1 "${src.rev}"
substituteInPlace library/init/version.lean.in \
--subst-var-by GIT_SHA1 "${src.rev}"
'';
postPatch = "patchShebangs .";
postInstall = lib.optionalString stdenv.isDarwin ''